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
74 stars 45 forks source link

trouble with 'rimexam' #210

Open afkowalski opened 4 years ago

afkowalski commented 4 years ago

Hi, First, really helpful program! I'm glad someone has taken the lead on this.

I am having trouble with the 'r' key in imexam. I've tried two different datasets, it seems to be a datatype conflict of some sort. Thanks - Adam K.

====== xc=324.9759 yc=122.6763 Background per pixel: 1392.6505760531472 Traceback (most recent call last): File "", line 1, in File "/anaconda3/envs/hst/lib/python3.6/site-packages/imexam/connect.py", line 150, in imexam self._run_imexam() File "/anaconda3/envs/hst/lib/python3.6/site-packages/imexam/connect.py", line 265, in _run_imexam x, y, current_key) File "/anaconda3/envs/hst/lib/python3.6/site-packages/imexam/imexamine.py", line 201, in do_option self.imexam_option_funcs[key][0](x, y, self._data) File "/anaconda3/envs/hst/lib/python3.6/site-packages/imexam/imexamine.py", line 1163, in radial_profile flux -= sky_per_pix numpy.core._exceptions.UFuncTypeError: Cannot cast ufunc 'subtract' output from dtype('float64') to dtype('uint16') with casting rule 'same_kind'

afkowalski commented 4 years ago

Here is the fix:

viewer.rimexam() # gives a list of parameters viewer.set_plot_pars('r', 'background', 0) viewer.imexam()

karlglazebrook commented 4 years ago

I tried imexam for the first time (searching for a replacement as this is the one thing I still use iraf for).

Had the exact same problem with the very first images I tried, using the 'r' key. The fix above worked though it is not clear to me exactly what it is doing.

The offending line seems to be

flux -= sky_per_pix This seems relevant: https://techoverflow.net/2019/05/22/how-to-fix-numpy-typeerror-cannot-cast-ufunc-subtract-output-from-dtypefloat64-to-dtypeint64-with-casting-rule-same_kind/

Is it as simple as making the line

flux = flux-sky_per_pix

?

sosey commented 4 years ago

@karlglazebrook - I've been on vacation all month. Let me see if I have a better example to point you to, are you still having issue?

karlglazebrook commented 4 years ago

No worries!

I haven’t tried it recently, happy to download and try again

Karl

On 29 Aug 2020, at 9:10 am, Megan Sosey notifications@github.com wrote:  @karlglazebrook - I've been on vacation all month. Let me see if I have a better example to point you to, are you still having issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

sosey commented 4 years ago

cool, which version of imexam do you have installed? conda list imexam or import and then return imexam.__version__

karlglazebrook commented 4 years ago

version 0.9.1

I also tried the latest version from GitHub, but could not get that to build, the offending line:

Command '['sh', './configure', '--prefix=/Users/karl/anaconda3']' returned non-zero exit status 127.
yas-nakajima commented 4 years ago

I have the same problem with version 0.9.1 when I use it with the int16 data.
I think correcting flux -= sky_per_pix to flux = flux - sky_per_pixat L1163 of imexamine.py is the easiest way as suggested by Karl.