StepPolVec

class sofia_redux.instruments.hawc.steps.steppolvec.StepPolVec[source]

Bases: StepParent

Calculate polarization vectors.

This step uses the Stokes parameter images and associated errors and covariances to compute the percent polarization and angle for each pixel. It also computes the debiased polarization and the rotated angle (for B-field directions). These values are all stored in a FITS table extension named ‘Pol Data’.

The input for this step is a DataFits object with images: STOKES I, ERROR I, STOKES Q, STOKES U, COVAR Q I, COVAR U I, COVAR Q U. This step is typically run after sofia_redux.instruments.hawc.steps.StepMerge.

Output for this step contains the same image frames as the input files, plus a table with the polarization vectors for each pixel (POL DATA). Images of these data are also added as separate extensions. The added extensions are named: PERCENT POL, DEBIASED PERCENT POL, ERROR PERCENT POL, POL ANGLE, ROTATED POL ANGLE, ERROR POL ANGLE, POL FLUX, ERROR POL FLUX, DEBIASED POL FLUX. Finally, the PROCSTAT header keyword will be updated to LEVEL_4 after this step.

Notes

The standard equations are used to convert from Stokes parameters to polarization percentage and angle:

\[\theta = \frac{90}{\pi} arctan\Big(\frac{U}{Q}\Big)\]
\[\sigma_\theta = \frac{90}{\pi (Q^2 + U^2)} \sqrt{(U\sigma_Q)^2 + (Q\sigma_U)^2 - 2 Q U \sigma_{QU}}.\]

The percent polarization (\(p\)) and its error are calculated as

\[p = 100 \sqrt{\Big(\frac{Q}{I}\Big)^2 + \Big(\frac{U}{I}\Big)^2}\]
\[\sigma_p = \frac{100}{I} \sqrt{\frac{1}{(Q^2 + U^2)} \Big[(Q \sigma_Q)^2 + (U \sigma_U)^2 + 2 Q U \sigma_{QU}\Big] + \Big[\Big(\frac{Q}{I}\Big)^2 + \Big(\frac{U}{I}\Big)^2\Big] \sigma_I^2 - 2 \frac{Q}{I}\sigma_{QI} - 2 \frac{U}{I} \sigma_{UI}}.\]

The debiased polarization percentage (\(p'\))is also calculated, as:

\[p' = \sqrt{p^2 - \sigma_p^2}.\]

The polarization efficiency provided in the ‘eff’ parameter is applied to the Q and U values (and their associated errors and covariances) after calculating \(\theta\), but before calculating percent polarization.

Methods Summary

read_eff()

Read an efficiency value from the parameters.

run()

Run the data reduction algorithm.

setup()

Set parameters and metadata for the pipeline step.

Methods Documentation

read_eff()[source]

Read an efficiency value from the parameters.

The parameters are expected to be defined as a list, with one entry for each HAWC band. The correct value for the input data is selected from the list.

Returns:
float

The polarization efficiency.

run()[source]

Run the data reduction algorithm.

Because this step is single-in, single-out (SISO), self.datain must be a DataFits object. The output is also a DataFits object, stored in self.dataout.

The process is:

  1. Compute polarization vector magnitude and direction. Propagate errors accordingly.

  2. Store the data in tables and images.

setup()[source]

Set parameters and metadata for the pipeline step.

Output files have PRODTYPE = ‘polvec’, and are named with the step abbreviation ‘VEC’.

Parameters defined for this step are:

efflist of float

Telescope + instrument polarization efficiency. One value per HAWC waveband.