Contents:
Time-series photometric reduction for ground-based IR photometry and spectroscopy.
Assumes a single filter and a regular dither pattern (or ‘staring’), and sky (& dark) removal via subtraction of temporally adjacent frames.
Take raw NIR frames and output sky-subtracted, flat-fielded frames ready for photometry extraction.
Subtract sky (and dark) levels from a set of dithered exposures with equal exposure settings.
For now, compute a robust mean sky frame from each ndither set. Then subtract them, flat-field them, and output.
NOTE: unlike other reduction tasks, the input index here refers ONLY to science frames.
Add keyword to FITS header, without overwriting existing keys.
INPUTS: |
|
---|
Initialize variables for ground-based IR data analysis.
obsname: (str) – e.g., 20091203k, 20091203h, ‘20120427_chip2’ cal : str
Valid options are ‘dome’ and ‘sky’, in case two sets of calibration files are available. If not, this option will have no effect.
Correct a set of IR array measurements for nonlinearity.
INPUTS: |
|
---|---|
OUTPUTS: | A Numpy array of the same shape as ‘measurement,’ but appropriately linearized following the algorithm of the reference below. If retall is True, the linearized measurement is the first element of a 2-tuple. |
NOTES: | Vacca et al. recommend that this algorithm be applied _after_ dark current has been subtracted and flat-fielding performed. |
SEE_ALSO: | makefmap_moircs(), linearity_moircs() |
REFERENCE: | Vacca et al. 2004, PASP. |
EXAMPLE: | raw_mosfire_data = 2e4 * np.ones((2048, 2048), dtype=float)
coef_fn = '/Users/ianc/proj/transit/data/mosfire_linearity/linearity/mosfire_linearity_cnl_coefficients_bic-optimized_corners-fixed.fits'
fmap = ir.makefmap_mosfire()
corrected_data = ir.linearity_correct(dat, 1, 1, 100, 101, fmap, ir.linearity_mosfire, npix=2048*2048, verbose=True, linfuncargs=dict(polycoef=coef_fn))
|
Linearity correction curve for Keck/MOSFIRE detectors.
INPUTS: |
|
---|---|
NOTES: | This function should not be used to perform linearity corrections on MOSFIRE data; for that, you should use linearity_correct() (for which this function is only a helper). |
SEE_ALSO: | makefmap_mosfire(), linearity_correct() linearity_moircs() |
REFERENCE: | Vacca et al. 2004, PASP. |
Make bad pixel mask from science frames.
list of filenames, in ADU (i.e., DN).
These files should already have been flat-fielded!
Helper function; input is list of FITS filenames and dark (to subtract).
Make f-map for linearity correction of Subaru/MOIRCS data.
INPUTS: |
|
---|---|
OUTPUTS: |
|
REFERENCES: | Vacca et al. 2004, PASP. Private communications w/Dr. I. Tanaka, NAOJ/Subaru |
Make f-map for linearity correction of Keck/MOSFIRE data.
INPUTS: |
|
---|---|
OUTPUTS: |
|
REFERENCES: | Vacca et al. 2004, PASP.
|
If an array is passed, return it. Otherwise, return a median stack of the input filename list.
Defringe multiple subregions in MOIRCS multi-object spectroscopy frames.
defringe_options – passed along to spec.defringe_sinusoid()
Tanaka-san’s prescription for inital calibration of MOIRCS images.
INPUTS: |
|
---|---|
EXAMPLE: |
|
NOTES: |
|
As you may already know, making object mask is a critical part of the good median-sky data.
Perform inital calibration of MOIRCS spectroscopic data.
INPUTS: |
|
---|---|
EXAMPLE: |
|
DESCRIPTION: |
|
NOTES: | Unfortunately, MOIRCS reduction is best done as a two-step process. First, set up the observations in initobs() using some standard, generic bad pixel mask (perhaps produced by makebadpixelmask_darks()); reduce the data using this routine. From the reduced, flattened data, generate a second (higher-fidelity) bad pixel map (using makebadpixelmask_science()). Combine these two bad pixel masks (and perhaps, as well, the appropriate mask from the MOIRCS instrument website). Insert the proper reference to this in initobs(), and then re-reduce the data. |
Extract spectra from a calibrated MOIRCS multi-object frame.
INPUTS: |
|
---|---|
OPTIONS: |
|
OUTPUT: | For each frame, an object will be returned with various interesting and useful fields. The ‘specs’ field will contain a list (one per subregion), for which each element is the output of spec.optspecextr_idl(). |
TO_DO: | Allow the routine to write files to disk, and update FITS headers (writefns, returnspec). Do better at finding the spectral trace. |
REQUIREMENTS: | |
SEE_ALSO: | |
EXAMPLE: |
|
Compute and return MOSFIRE reference pixel values, from individual readouts.
INPUTS: |
|
---|---|
OPTIONS: |
|
OUTPUTS: | a length-32 Numpy array. |
NOTES: | For a filename ‘frame.fits’, reads in the file as well as the individual CDS reads “frame_001.fits” and “frame_002.fits”. Computes the difference between (frame - (frame002-frame001)), and uses it to return the reference pixel bias levels. |
Perform inital calibration of MOSFIRE spectroscopic data.
INPUTS: |
|
---|---|
EXAMPLE: |
|
DESCRIPTION: |
|
NOTES: | Unfortunately, MOSFIRE reduction is best done as a two-step process. First, set up the observations in initobs() using some standard, generic bad pixel mask (perhaps produced by makebadpixelmask_darks()); reduce the data using this routine. From the reduced, flattened data, generate a second (higher-fidelity) bad pixel map (using makebadpixelmask_science()). Combine these two bad pixel masks (and perhaps, as well, the appropriate mask from the MOIRCS instrument website). Insert the proper reference to this in initobs(), and then re-reduce the data. |
Python script to call Pyraf and extract spectra from a file.
INPUTS: |
|
---|
Combine dark frames into a single dark frame:
Dark-correct flats, make normalized super-flat.
Combine numbered super-flats into a single flat.
Dark-subtract science frames.
I don’t currently use this (Jan 2010)
Subtract one file from a list of others, and save in a new location.
First two inputs are lists of strings, ‘subfile’ is a string.
Use PyRaf tasks to set airmass for Lick/GEMINI camera observations. Assumes PST times.
Find boundaries of each slit’s spectrum, using a flat-field frame:
Helper function for mosfire_speccal() and moircs_speccal()