PISCES Data Reduction

The data reduction pipeline for PISCES is kept as simple as possible for easing integration with JPL’s coronagraph control software. It requires an existing wavelength calibration.

In [1]:
import sys
codefolder = '../../../../crispy' # this is the path to the entire repo (that contains crispy, docs, notebooks)
if codefolder not in sys.path: sys.path.append(codefolder)
from crispy.PISCESparams import Params
par = Params('../../../crispy')

This is simple: load the reduction function, and call it!

In [2]:
import glob
# call the reduction routine with an example image
VARIA_ON= glob.glob(par.wavecalDir+'IFS665nm.fits')
VARIA_OFF= glob.glob(par.wavecalDir+'IFSdark665nm.fits')
print(VARIA_ON[0])
from crispy.IFS import reduceIFSMap
from crispy.tools.image import Image
test_img = Image(data = (Image(VARIA_ON[0]).data - Image(VARIA_OFF[0]).data)).write(par.exportDir+'/test_varia.fits')
reduced_cube= reduceIFSMap(par,par.exportDir+'/test_varia.fits')
../../../crispy/ReferenceFiles/Calibra_170306/IFS665nm.fits
crispy - INFO - Read data from HDU 0 of ../../../crispy/ReferenceFiles/Calibra_170306/IFS665nm.fits
crispy - INFO - Read data from HDU 0 of ../../../crispy/ReferenceFiles/Calibra_170306/IFSdark665nm.fits
crispy - INFO - Writing data to ../../../crispy/SimResults/test_varia.fits
crispy - INFO - Read data from HDU 1 of ../../../crispy/SimResults/test_varia.fits
crispy - INFO - Reduced cube will have 26 wavelength bins
WARNING: AstropyDeprecationWarning: "clobber" was deprecated in version 1.3 and will be removed in a future version. Use argument "overwrite" instead. [astropy.utils.decorators]
/Users/mrizzo/anaconda/lib/python2.7/site-packages/numpy/lib/nanfunctions.py:703: RuntimeWarning: Mean of empty slice
  warnings.warn("Mean of empty slice", RuntimeWarning)
crispy - INFO - Writing data to ../../../crispy/SimResults/test_varia_red_optext.fits
crispy - INFO - Elapsed time: 18.090558s

The wavelengths of the cube slices are the following:

In [3]:
from crispy.tools.reduction import calculateWaveList
lam_midpts,lam_endpts = calculateWaveList(par)
print('Wavelengths at midpoints (nm): ',lam_midpts)
print('Wavelengths at endpoints (nm): ',lam_endpts)
crispy - INFO - Reduced cube will have 26 wavelength bins
('Wavelengths at midpoints (nm): ', array([ 607.10887147,  611.34869295,  615.61812376,  619.91737068,
        624.24664194,  628.6061472 ,  632.99609763,  637.41670582,
        641.86818589,  646.35075344,  650.86462556,  655.41002088,
        659.98715953,  664.59626322,  669.23755516,  673.91126015,
        678.61760456,  683.35681631,  688.12912494,  692.9347616 ,
        697.77395902,  702.64695159,  707.55397533,  712.49526788,
        717.47106857,  722.48161839]))
('Wavelengths at endpoints (nm): ', array([ 605.        ,  609.22509391,  613.4796943 ,  617.76400723,
        622.0782402 ,  626.42260216,  630.79730352,  635.20255616,
        639.63857343,  644.1055702 ,  648.6037628 ,  653.13336909,
        657.69460847,  662.28770183,  666.91287165,  671.57034192,
        676.26033822,  680.9830877 ,  685.73881911,  690.52776276,
        695.3501506 ,  700.2062162 ,  705.09619475,  710.02032308,
        714.97883968,  719.97198471,  725.        ]))

The files are exported in the folder par.exportDir. Look for the introduction documentation page for more details.