StepRegion

class sofia_redux.instruments.hawc.steps.stepregion.StepRegion[source]

Bases: StepParent

Apply data quality cuts to polarization vectors.

This step examines polarization vectors present in the POL DATA table and removes poor quality vectors, according to the parameters defined for the step. The quality cuts defined include signal-to-noise thresholds and range cutoffs. This step also writes a DS9 formatted region file containing vectors that survive the quality cuts.

Input for this step is a DataFits with STOKES and ERROR frames for I, Q and U each and a table containing polarization vectors (POL DATA). This step should be run after sofia_redux.instruments.hawc.steps.StepPolVec.

Output for this step is the same as the input, with the addition of a FINAL POL DATA table, containing the vectors after quality cuts. As a side effect, a text file containing the selected polarization vectors will be saved to disk, to the same directory and base name as the input, with the product type indicator replaced with REG.

Methods Summary

run()

Run the data reduction algorithm.

setup()

Set parameters and metadata for the pipeline step.

write_ds9(xpix, ypix, pol, angle)

Write output file with polarization data in DS9 region format.

Methods Documentation

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. Apply quality cuts determined by parameters.

  2. Store the data in a FINAL POL DATA table.

  3. Save a DS9 region file to disk.

setup()[source]

Set parameters and metadata for the pipeline step.

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

Parameters defined for this step are:

skipint

If greater than 1, then only every ‘skip’ vectors will be saved.

offsetlist of int

Offset in pixels, given as [x, y], to start keeping vectors, if ‘skip’ is greater than 1. For example, offset = [1, 1] and skip = 2 will keep pixel (1,1), (1, 3), (3, 1), (3, 3), etc.

minifloat

Do not save vectors with flux less than this fraction of peak flux in Stokes I.

minpfloat

Do not save vectors with flux less than this value.

sigmafloat

Do not save vectors with polarization percentage signal-to-noise less than this value.

minisigifloat

Do not save vectors with Stokes I signal-to-noise less than this value.

maxpfloat

Do not save vectors with polarization percentage greater than this value.

scalebool

If not set, all vectors in the output DS9 region file will be the same length.

lengthfloat

Scale factor for length of polarization vectors in DS9 region file.

rotatebool

If set, vectors shown in the output DS9 region file will be rotated (B-field) vectors.

debiasbool

If set, debiased polarization vectors will be used to make the DS9 region file.

write_ds9(xpix, ypix, pol, angle)[source]

Write output file with polarization data in DS9 region format.

Parameters:
xpixarray-like

X pixel values.

ypixarray-like

Y pixel values.

polarray-like

Polarization percentage values.

anglearray-like

Polarization angle values.