spacetelescope / imexam

imexam is a python tool for simple image examination, and plotting, with similar functionality to IRAF's imexamine
http://imexam.readthedocs.io
BSD 3-Clause "New" or "Revised" License
75 stars 45 forks source link

radial profile ("r") and aperture photometry ("a") failing, but "j" and "k" work #238

Open janerigby opened 3 years ago

janerigby commented 3 years ago

I am attempting to measure the PSF from stars in an HST WFC3-IR F160W image. For recordkeeping, the image is V4.0_PSZ1G311.65-18.48_F160W_0.03g0.8_cr4.0_0.7_drz_sci.fits (Please email me and I can send it privately.)

I am getting an error when doing aperture photometry ("a"), and non-sensical answers for radial profile ("r"), as follows:

1) Using "j" makes a nice fit with FWHM=6.4 pix

2) Using "k" makes a nice fit with FWHM=6.2 pix

3) sing "r" makes a fit that looks good: by eye the fwhm is a few pixels, but the fit reports a FWHM=17 pix, which is just ridiculous. I have screenshots I can send; I don't see how to attach them here.

4) Trying to run aperture photometry ("a") fails with the error below.

Please advise. I can send the fits image and the screenshots. Best, Jane

AttributeError Traceback (most recent call last)

in 1 import imexam 2 viewer = imexam.connect('ds9') ----> 3 viewer.imexam() ~/anaconda3/envs/astropy_stable3/lib/python3.7/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/astropy_stable3/lib/python3.7/site-packages/imexam/connect.py in _run_imexam(self) 263 self._check_slice() 264 self.exam.do_option( --> 265 x, y, current_key) 266 except KeyError: 267 print(f"Invalid key, use\n: {self.exam.print_options()}") ~/anaconda3/envs/astropy_stable3/lib/python3.7/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/astropy_stable3/lib/python3.7/site-packages/imexam/imexamine.py in aper_phot(self, x, y, data, genplot, fig, error) 690 cmap=self.aper_phot_pars['cmap'][0]) 691 --> 692 apertures.plot(ax=ax, color='green', alpha=0.75, lw=3) 693 if subsky: 694 annulus_apertures.plot(ax=ax, color='red', alpha=0.75, lw=3) ~/anaconda3/envs/astropy_stable3/lib/python3.7/site-packages/photutils/aperture/core.py in plot(self, axes, origin, **kwargs) 566 axes = plt.gca() 567 --> 568 patches = self._to_patch(origin=origin, **kwargs) 569 if self.isscalar: 570 patches = (patches,) ~/anaconda3/envs/astropy_stable3/lib/python3.7/site-packages/photutils/aperture/circle.py in _to_patch(self, origin, **kwargs) 187 for xy_position in xy_positions: 188 patches.append(mpatches.Circle(xy_position, self.r, --> 189 **patch_kwargs)) 190 191 if self.isscalar: ~/anaconda3/envs/astropy_stable3/lib/python3.7/site-packages/matplotlib/patches.py in __init__(self, xy, radius, **kwargs) 1573 %(Patch_kwdoc)s 1574 """ -> 1575 super().__init__(xy, radius * 2, radius * 2, **kwargs) 1576 self.radius = radius 1577 ~/anaconda3/envs/astropy_stable3/lib/python3.7/site-packages/matplotlib/patches.py in __init__(self, xy, width, height, angle, **kwargs) 1447 %(Patch_kwdoc)s 1448 """ -> 1449 super().__init__(**kwargs) 1450 1451 self._center = xy ~/anaconda3/envs/astropy_stable3/lib/python3.7/site-packages/matplotlib/patches.py in __init__(self, edgecolor, facecolor, color, linewidth, linestyle, antialiased, hatch, fill, capstyle, joinstyle, **kwargs) 106 107 if len(kwargs): --> 108 self.update(kwargs) 109 110 def get_verts(self): ~/anaconda3/envs/astropy_stable3/lib/python3.7/site-packages/matplotlib/artist.py in update(self, props) 1060 func = getattr(self, f"set_{k}", None) 1061 if not callable(func): -> 1062 raise AttributeError(f"{type(self).__name__!r} object " 1063 f"has no property {k!r}") 1064 ret.append(func(v)) AttributeError: 'Circle' object has no property 'ax'
sosey commented 3 years ago

cross-referencing with #165, doh. working on the fix.

janerigby commented 3 years ago

I got iraf's imexam working remotely on a linux box, and verified that the running "r" on the V4.0 F160W file produces a FWHM of 4.6 pixel, which is sensible.
This is consistent with the behavior seen by others in issue #165