Quick Start
The Data Reduction Pipeline (DRP) of WIRC+Pol is a modular, object-oriented software designed to reduce data taken by the WIRC+Pol infrared (IR) spectropolarimeter on the 200-inch Hale Telescope at Palomar Observatory. It is also designed to be adaptable to reduce data from other multi-channel spectropolarimeter.
There are two classes of objects the DRP uses: wirc_data
and wircpol_source
. Each wirc_data
object encapsulate one image recorded by WIRC+Pol including the full image, all header informations, and its calibration and reduction history. For each wirc_data
object, there may be a list of wircpol_source
objects, each of which describes a source in the wirc_data
object. This object contains the position of the source along with cutouts of the source’s four spectral traces. It may also include spectra and polarization extracted for the source. To reduce WIRC+Pol data, the DRP loads the raw image in as a wirc_data
object, then operate on it through the following steps to produce polarization spectra.
Steps of Operation
Basic Calibration: a science image is dark subtracted and flattened using dark and flat frames taken on the same night, or on a night close to the science observation. This step is performed by the method
wirc_data.calibrate
.background-subtraction: a calibrated science image is then background subtracted. This is a crucial step to remove polarimetric biases from the bright IR sky emission. There are several methods, but generally they rely on a library of background frames taken with some offsets from the science observations. If the slit is used, the source is typically observed at two dither positions inside the slit (AB) so images from one position can be used as background for another position. The method for generating background file for subtraction is
wirc_data.generate_bkg
.Source Finding: after background subtraction, one can either run automatic source finding using the method of
wirc_data.find_sources_v2
, or manually specify the location of the source to be extracted using theadd_source
method. Either way, this will createwircpol_source
objects associated with thatwirc_data
object. Theget_source_cutouts
method is run to retrieve small thumbnails of the four spectral traces for extraction.Spectral Extraction: once the background image and the location of the source(s) are defined, the
extract_spectra
method can be run on eachwircpol_source
object to retrieve four flux spectra from the upper left, lower right, upper right, and lower left spectral traces of a source. The output spectral cube, which is thetrace_spectra
attribute of thewircpol_source
object, is an array of shape [4, 3, spectral_length] where the first index is the four spectra, the second index is (wavelength, flux, flux_uncertainty), and the last index is the spectrum. For example, the upper left flux is wircpol_source.trace_spectra[0,1,:]. Wavelength calibration can be obtained by therough_lambda_calibration
method. Note that this step is sometimes unreliable, and the resulting wavelength solution should be verified.polarization-calculation: and Calibration: this calculation is performed after all science images in the dataset have been reduced and extracted. The calculation is performed on the datacube of all extracted spectra (dimensions [n_images, 4, 3, spectral_length], where n_images is the number of images in the observation sequence. In addition, we also need an array of the half-wave plate angle (with length equals to n_images). The calculation can be performed by using the function
compute_qu_for_obs_sequence
insource_utils.py
on the spectra cube and the HWP angle array. Finally, the normalized Stokes parameters fromcompute_qu_for_obs_sequence
can be calibrated using thecalibrate_qu
function incalibration.py
.
For the example of these steps, see the Tutorial notebooks. Functions to perform steps 2-5 automatically are in dataset.py
.