Keck-DataReductionPipelines / MosfireDRP

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

DRP fails while finding slit edges #77

Closed dalekocevski closed 7 years ago

dalekocevski commented 7 years ago

We recently completed a MOSFIRE run and I’m trying to get the DRP working in order to start reducing our data. I’ve successfully installed anaconda (with python 2.7) and the DRP code, but I get a fatal error when trying to reduce the example data mentioned in the manual.

2017-10-03 15:35:40,598 - Flats. handle_flats - INFO: Flat written to combflat_2d_H.fits 2017-10-03 15:35:40,599 - Flats. handle_flats - INFO: Finding slit edges in combflat_2d_H.fits Traceback (most recent call last): File "Driver.py", line 32, in Flats.handle_flats('Flat.txt', maskname, band, flatops) File "/Users/kocevski/anaconda2/lib/python2.7/site-packages/MOSFIRE-1.0.dev0-py2.7.egg/MOSFIRE/Flats.py", line 155, in handle_flats results = find_and_fit_edges(data, header, bs, options,edgeThreshold=edgeThreshold) File "/Users/kocevski/anaconda2/lib/python2.7/site-packages/MOSFIRE-1.0.dev0-py2.7.egg/MOSFIRE/Flats.py", line 821, in find_and_fit_edges threshold_area = vertical_profile[spatial_centers[target]-3:spatial_centers[target]+3] File "/Users/kocevski/anaconda2/lib/python2.7/site-packages/numpy/ma/core.py", line 3220, in getitem dout = self.data[indx] TypeError: slice indices must be integers or None or have an index method

It appears to be dying at the edge detection step. Have you guys seen anything like this? I get the same error when running the DRP on our actual data. If you have any suggestions on how to fix this, I’d really appreciate it.

dalekocevski commented 7 years ago

I see now that this issue is due to an incompatibility with numpy v1.12. Is there a solution for this other than downgrading to numpy 1.11.2?

joshwalawender commented 7 years ago

@dalekocevski Yes, that is correct. We’re going to post instructions for a workaround (probably tomorrow), but the short answer is downgrading numpy.

I’m going to try to go through the code and eliminate these TypeErrors, but that probably won’t be for another week at least.

joshwalawender commented 7 years ago

Hi all,

Sherry tested out a workaround for the numpy problem. The easiest thing to do is probably to create a conda "environment" for the DRP. More on conda environments here: https://conda.io/docs/user-guide/tasks/manage-environments.html

Here are the instructions from Sherry:

Here is what I did to work around the numpy problem.

conda create -n mosfire_drp
conda install -n mosfire_drp numpy=1.11.2
conda install -n mosfire_drp astropy 
conda install -n mosfire_drp -c astropy ccdproc

I didn’t reinstall scipy, it’s included in the installation of ccdproc. The versions of the packages are:

numpy 1.11.2 astropy u2.0.2 scipy 0.18.1

Then I did

source activate mosfire_drp
unzip MosfireDRP-master.zip
cd MosfireDRP-master
python setup.py install

I am actually using Python 2.7 for the IRAF that came with astroconda. My OS X is 10.11.6.

dalekocevski commented 7 years ago

Great, I'll give this a shot. Thanks for the quick fix!