Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Circle' object has no property 'ax' #244

Open
patkel opened this issue Jan 15, 2022 · 1 comment
Open

AttributeError: 'Circle' object has no property 'ax' #244

patkel opened this issue Jan 15, 2022 · 1 comment

Comments

@patkel
Copy link

patkel commented Jan 15, 2022

Hi all, I am having this problem that I think was the same as the previous ticket. I tried to install the current version on github, and believe I succeeded:

In [14]: imexam.version
Out[14]: '0.9.2.dev40+gb397573'

I was able to get plots to show up by deleting ax=ax from lines
--> 691 apertures.plot(ax=ax, color='green', alpha=0.75, lw=3)
and
693 annulus_apertures.plot(ax=ax, color='red', alpha=0.75, lw=3)
of
~/anaconda3/envs/python38/lib/python3.10/site-packages/imexam/imexamine.py

I'm using Python 3.10.2

and

In [2]: photutils.version
Out[2]: '1.3.0'

This may not be an ideal solution, of course!

I'll also note that sometimes I have to hit 'a' twice before any plot shows up -- not sure about that one.

Cheers Pat


AttributeError Traceback (most recent call last)
in
----> 1 viewer.imexam()

~/anaconda3/envs/python38/lib/python3.10/site-packages/imexam/connect.py in imexam(self)
148 self._run_event_imexam()
149 else:
--> 150 self._run_imexam()
151 else:
152 warnings.warn("No valid image loaded in viewer")

~/anaconda3/envs/python38/lib/python3.10/site-packages/imexam/connect.py in _run_imexam(self)
262 if self.window.iscube():
263 self._check_slice()
--> 264 self.exam.do_option(
265 x, y, current_key)
266 except KeyError:

~/anaconda3/envs/python38/lib/python3.10/site-packages/imexam/imexamine.py in do_option(self, x, y, key)
199 self.imexam_option_funcs[key]0
200 else:
--> 201 self.imexam_option_funcs[key][0](x, y, self._data)
202
203 def get_options(self):

~/anaconda3/envs/python38/lib/python3.10/site-packages/imexam/imexamine.py in aper_phot(self, x, y, data, genplot, fig, error)
689 cmap=self.aper_phot_pars['cmap'][0])
690
--> 691 apertures.plot(ax=ax, color='green', alpha=0.75, lw=3)
692 if subsky:
693 annulus_apertures.plot(ax=ax, color='red', alpha=0.75, lw=3)

~/anaconda3/envs/python38/lib/python3.10/site-packages/photutils/aperture/core.py in plot(self, axes, origin, **kwargs)
560 axes = plt.gca()
561
--> 562 patches = self._to_patch(origin=origin, **kwargs)
563 if self.isscalar:
564 patches = (patches,)

~/anaconda3/envs/python38/lib/python3.10/site-packages/photutils/aperture/circle.py in _to_patch(self, origin, **kwargs )
185 patches = []
186 for xy_position in xy_positions:
--> 187 patches.append(mpatches.Circle(xy_position, self.r,
188 **patch_kwargs))
189

~/anaconda3/envs/python38/lib/python3.10/site-packages/matplotlib/patches.py in init(self, xy, radius, **kwargs)
1820 %(Patch:kwdoc)s
1821 """
-> 1822 super().init(xy, radius * 2, radius * 2, **kwargs)
1823 self.radius = radius
1824

~/anaconda3/envs/python38/lib/python3.10/site-packages/matplotlib/patches.py in init(self, xy, width, height, angle , **kwargs)
1506 %(Patch:kwdoc)s
1507 """
-> 1508 super().init(**kwargs)
1509
1510 self._center = xy

~/anaconda3/envs/python38/lib/python3.10/site-packages/matplotlib/patches.py in init(self, edgecolor, facecolor, co lor, linewidth, linestyle, antialiased, hatch, fill, capstyle, joinstyle, **kwargs)
111
112 if len(kwargs):
--> 113 self.update(kwargs)
114
115 def get_verts(self):
~/anaconda3/envs/python38/lib/python3.10/site-packages/matplotlib/artist.py in update(self, props)
1062 func = getattr(self, f"set_{k}", None)
1063 if not callable(func):
-> 1064 raise AttributeError(f"{type(self).name!r} object "
1065 f"has no property {k!r}")
1066 ret.append(func(v))

AttributeError: 'Circle' object has no property 'ax'

@patkel
Copy link
Author

patkel commented Jan 18, 2022

I was able to figure out that photutils would like the argument to be
axes as opposed to ax

In [2]: photutils.version
Out[2]: '1.3.0'

the following seems to work:

            apertures.plot(axes=ax, color='green', alpha=0.75, lw=3)

            annulus_apertures.plot(axes=ax, color='red', alpha=0.75, lw=3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant