StepRotate

class sofia_redux.instruments.hawc.steps.steprotate.StepRotate[source]

Bases: StepParent

Rotate Stokes Q and U from detector reference frame to sky.

The rotation angle is derived from telescope data and the half-wave plate (HWP) position for the observation. The telescope vertical position angle (VPA) is read from the FITS header keyword VPOS_ANG. HWP zero angle and actual initial angle are read from the keywords HWPSTART and HWPINIT, respectively.

Input for this step is a DataFits containing STOKES and ERROR frames for I, Q and U each, as well as COVAR Q I, COVAR U I, and COVAR Q U extensions. This step is typically run after the sofia_redux.instruments.hawc.steps.StepIP pipeline step. The output image contains the same image frames as the input image. STOKES and ERROR frames for Q and U have been rotated; the covariance frames have been propagated.

Notes

The rotation angle is defined per the HAWC+ Geometric Reference (Kovács memo, Appendix H), and is applied to the Q and U images with a standard rotation matrix as follows:

\[Q' = cos(\alpha) Q + sin(\alpha) U\]
\[U' = sin(\alpha) Q - cos(\alpha) U.\]
\[\sigma_Q' = \sqrt{(cos(\alpha)\sigma_Q)^2 + (sin(\alpha) \sigma_U)^2 + 2 cos(\alpha) sin(\alpha) \sigma_{QU}}\]
\[\sigma_U' = \sqrt{(sin(\alpha)\sigma_Q)^2 + (cos(\alpha) \sigma_U)^2 - 2 cos(\alpha) sin(\alpha) \sigma_{QU}}\]
\[\sigma_{Q'I} = cos(\alpha) \sigma_{QI} + sin(\alpha) \sigma_{UI}\]
\[\sigma_{U'I} = sin(\alpha) \sigma_{QI} - cos(\alpha) \sigma_{UI}\]
\[\sigma_{Q'U'} = cos(\alpha)sin(\alpha)(\sigma_Q^2 - \sigma_U^2) + (sin^2(\alpha) - cos^2(\alpha)) \sigma_{QU}.\]

Methods Summary

read_angle()

Read a grid angle value from the parameters.

run()

Run the data reduction algorithm.

setup()

Set parameters and metadata for the pipeline step.

Methods Documentation

read_angle()[source]

Read a grid angle 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 grid angle.

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 the rotation angle from VPA, HWP zero, and the grid angle.

  2. Rotate Stokes Q and U arrays.

  3. Propagate errors and covariances.

setup()[source]

Set parameters and metadata for the pipeline step.

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

Parameters defined for this step are:

gridanglelist of float

Angle of the grid in degrees (one value for each waveband).

hwpzero_tolfloat

Tolerance for the difference between commanded and actual initial HWP angles.

hwpzero_optionstr

If set to ‘commanded’, then the HWPSTART keyword will be used if the difference between the initial HWP angles is > hwpzero_tol. If set to ‘actual’, the HWPINIT keyword will be used. Otherwise, an error will be raised.