Keck-DataReductionPipelines / MosfireDRP

http://keck-datareductionpipelines.github.io/MosfireDRP
10 stars 13 forks source link

Wavelength.py apply_lambda_simple index error #139

Closed bpcoy closed 5 years ago

bpcoy commented 5 years ago

When trying to reduce MOSFIRE data in J-band I get this error message for a certain dataset:

Traceback (most recent call last): File "Longslit_A0_HIP17971.py", line 39, in Wavelength.apply_lambda_simple(maskname, band, obsfiles, waveops,longslit=longslit) File "/anaconda3/envs/mospy_2018_macos/lib/python3.6/site-packages/MOSFIRE-1.0.dev0-py3.6.egg/MOSFIRE/Wavelength.py", line 980, in apply_lambda_simple dlam = np.ma.median(np.diff(lams[line,:])) IndexError: index 2054 is out of bounds for axis 0 with size 2048

It seems that in the method apply_lambda_simple it is indexing passed the total width of the image field. Specifically this block of code:
while dlam==0: line = central_line+(10step) print(line) dlam = np.ma.median(np.diff(lams[line,:])) if dlam==0: line = central_line-(10step) dlam = np.ma.median(np.diff(lams[line,:])) step=step+1

Seems to be failing to stop line from overstepping the bounds of lams/the wavelength solution. Is there any easy fix for this? This only seems to happen in certain datasets and not all

lucarizzi commented 5 years ago

THank you for reporting this problem.

As you might know, the MOSFIRE pipeline project welcomes contribution from the community and is open developed and supported.

It seems as if you are rather familiar with it and with Python, so if you see an easy solution to this problem, feel free to submit a pull request.

Otherwise, we will add it to the list of bug fixes and we will get to it as soon as possible.

Thank you luca

On Tue, Jul 9, 2019 at 2:47 PM bpcoy notifications@github.com wrote:

When trying to reduce MOSFIRE data in J-band I get this error message for a certain dataset:

Traceback (most recent call last): File "Longslit_A0_HIP17971.py", line 39, in Wavelength.apply_lambda_simple(maskname, band, obsfiles, waveops,longslit=longslit) File "/anaconda3/envs/mospy_2018_macos/lib/python3.6/site-packages/MOSFIRE-1.0.dev0-py3.6.egg/MOSFIRE/Wavelength.py", line 980, in apply_lambda_simple dlam = np.ma.median(np.diff(lams[line,:])) IndexError: index 2054 is out of bounds for axis 0 with size 2048

It seems that in the method apply_lambda_simple it is indexing passed the total width of the image field. Specifically this block of code: while dlam==0: line = central_line+(10

step) print(line) dlam = np.ma.median(np.diff(lams[line,:])) if dlam==0: line = central_line-(10step) dlam = np.ma.median(np.diff(lams[line,:])) step=step+1

Seems to be failing to stop line from overstepping the bounds of lams/the wavelength solution. Is there any easy fix for this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Keck-DataReductionPipelines/MosfireDRP/issues/139?email_source=notifications&email_token=AAEAFHKYCIPRXRINIABRCILP6TTLZA5CNFSM4H7IX2KKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G6F45VA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEAFHLVMUSZAF7H6I376SDP6TTLZANCNFSM4H7IX2KA .

joshwalawender commented 5 years ago

@bpcoy Can you send me a (minimal) data set which produces this problem? I want to understand what the data looks like when this happens.

joshwalawender commented 5 years ago

Another user reported the same symptom. It was eventually traced to a bad wavelength solution which was somehow causing the code snippet referenced in this issue to overstep bounds. The solution there was to get a better wavelength solution using the interactive tools. See also #66