GradPak_skysub¶
This is a script used to do sky subtraction on multispec files produced by the WIYN Bench Spectrograph and the GradPak IFU. To make use of this script the spectra need to be reduced usig the gradpak_sizes.iraf aperture table. This table defines different beam numbers for each fiber size such that the beam number is fibersize(in microns)/100. The sky fibers are assigned beam numbers as fibersize/100*11.
General Usage¶
First, make sure you have skysub = no in your dohydra parameter file so that dohydra doesn’t do (incorrect) sky subtraction first. After that using this module is very straight forward. Simply run:
>python GradPak_skysub.py INPUT_FILE.ms_lin.fits OUTPUT_FILE.ms_s_lin.fits
That’s it! If you follow the above naming convention and have your extracted, linearly sampled spectra in *.ms_lin.fits files then you can omit the output file argument and GradPak_skysub will assume it to be of the form above (.ms_s_lin.fits).
When you run GradPak_skysub you will be shown the interactive IRAF skysub graphs 5 times; one for each fiber size. In these windows you can delete specific fibers with the ‘d’ key (use ‘r’ to redraw the plot after you do this). Once you are satisified with the selection of sky fibers hit ‘q’ to be taken to the next fiber size. Once all 5 sizes are done the output file will be generated and you’ll be thrown back to your command prompt.
Individual functions are documented below, but only for completeness; you should never have to call any of them directly from within python.
Functions¶
-
GradPak_skysub.
cleanup
(imagelist)¶ Delete all the intermediate, single-fiber-size, sky-subtracted images
Parameters: imagelist : list of str
List of files to be deleted
Returns: None
All files in the input list will be deleted
-
GradPak_skysub.
main
()¶ Do everything
Take the input file and do a sky subtraction for each of the GradPak fiber sizes. Then combine everything back into the output file name.
-
GradPak_skysub.
recombine
(imagelist, outputimage)¶ Recombine a group of multispec files by aperture
This uses the scombine task with group set to apertures. Because the aperture information is preserved when doing sky subtraction all this does is concatenate the individual .ms files into a single file.
Parameters: imagelist : list of str
List of individual file names of the temporary, single-size .ms files created by skysub
outputimage : str
Name of the resulting image that has all apertures from the input list
Returns: None
The result is a multispec file that is a concatination of all the files in the input list.
Notes
To work as intended, each file in the input list should contain a unique set of aperture identifications. Any repeating apertures will be averaged together, which probably isn’t what you want.
-
GradPak_skysub.
skysub
(imagename, fibersize)¶ Take a multispec file with GradPak beam numbers and do a sky subtraction of a single fiber size.
Actual sky subtraction is done with IRAF’s hydra.skysub. The fiber size is an integer that is the actual size of the fibers (in microns) divided by 100. So the 200 micron fibers have fibersize=2.
Parameters: imagename : str
Name of the fits file to do sky subtraction on. It should be a file that can be recognized by the hydra package.
fibersize : {2,3,4,5,6} int
Fiber size to perform sky subtraction on. It is given in units of arcseconds rounded to the nearest integer.
Returns: skyname : str
Name of the temporary sky-subtracted file generated by skysub. This file contains only fibers of the size specified.
Notes
This is a helper function that should probably not be called directly unless you know what you’re doing. The main result is a .ms file that contains sky subtracted spectra for only that particular fiber size. For this function to work you need to have set apidtab = gradpak_sizes.iraf in dohydra.