{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PISCES Data Reduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import sys\n", "codefolder = '../../../../crispy' # this is the path to the entire repo (that contains crispy, docs, notebooks)\n", "if codefolder not in sys.path: sys.path.append(codefolder)\n", "from crispy.PISCESparams import Params\n", "par = Params('../../../crispy')\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is simple: load the reduction function, and call it!" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "../../../crispy/ReferenceFiles/Calibra_170306/IFS665nm.fits\n", "crispy - INFO - Read data from HDU 0 of ../../../crispy/ReferenceFiles/Calibra_170306/IFS665nm.fits\n", "crispy - INFO - Read data from HDU 0 of ../../../crispy/ReferenceFiles/Calibra_170306/IFSdark665nm.fits\n", "crispy - INFO - Writing data to ../../../crispy/SimResults/test_varia.fits\n", "crispy - INFO - Read data from HDU 1 of ../../../crispy/SimResults/test_varia.fits\n", "crispy - INFO - Reduced cube will have 26 wavelength bins\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "WARNING: AstropyDeprecationWarning: \"clobber\" was deprecated in version 1.3 and will be removed in a future version. Use argument \"overwrite\" instead. [astropy.utils.decorators]\n", "/Users/mrizzo/anaconda/lib/python2.7/site-packages/numpy/lib/nanfunctions.py:703: RuntimeWarning: Mean of empty slice\n", " warnings.warn(\"Mean of empty slice\", RuntimeWarning)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "crispy - INFO - Writing data to ../../../crispy/SimResults/test_varia_red_optext.fits\n", "crispy - INFO - Elapsed time: 18.090558s\n" ] } ], "source": [ "import glob\n", "# call the reduction routine with an example image\n", "VARIA_ON= glob.glob(par.wavecalDir+'IFS665nm.fits')\n", "VARIA_OFF= glob.glob(par.wavecalDir+'IFSdark665nm.fits')\n", "print(VARIA_ON[0])\n", "from crispy.IFS import reduceIFSMap\n", "from crispy.tools.image import Image\n", "test_img = Image(data = (Image(VARIA_ON[0]).data - Image(VARIA_OFF[0]).data)).write(par.exportDir+'/test_varia.fits')\n", "reduced_cube= reduceIFSMap(par,par.exportDir+'/test_varia.fits')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The wavelengths of the cube slices are the following:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "crispy - INFO - Reduced cube will have 26 wavelength bins\n", "('Wavelengths at midpoints (nm): ', array([ 607.10887147, 611.34869295, 615.61812376, 619.91737068,\n", " 624.24664194, 628.6061472 , 632.99609763, 637.41670582,\n", " 641.86818589, 646.35075344, 650.86462556, 655.41002088,\n", " 659.98715953, 664.59626322, 669.23755516, 673.91126015,\n", " 678.61760456, 683.35681631, 688.12912494, 692.9347616 ,\n", " 697.77395902, 702.64695159, 707.55397533, 712.49526788,\n", " 717.47106857, 722.48161839]))\n", "('Wavelengths at endpoints (nm): ', array([ 605. , 609.22509391, 613.4796943 , 617.76400723,\n", " 622.0782402 , 626.42260216, 630.79730352, 635.20255616,\n", " 639.63857343, 644.1055702 , 648.6037628 , 653.13336909,\n", " 657.69460847, 662.28770183, 666.91287165, 671.57034192,\n", " 676.26033822, 680.9830877 , 685.73881911, 690.52776276,\n", " 695.3501506 , 700.2062162 , 705.09619475, 710.02032308,\n", " 714.97883968, 719.97198471, 725. ]))\n" ] } ], "source": [ "from crispy.tools.reduction import calculateWaveList\n", "lam_midpts,lam_endpts = calculateWaveList(par)\n", "print('Wavelengths at midpoints (nm): ',lam_midpts)\n", "print('Wavelengths at endpoints (nm): ',lam_endpts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The files are exported in the folder par.exportDir. Look for the introduction documentation page for more details." ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 1 }