StepZeroLevel

class sofia_redux.instruments.hawc.steps.stepzerolevel.StepZeroLevel[source]

Bases: StepParent

Correct zero level for scanning data.

This step applies an optional zero-level correction to the Stokes I image for scan mode imaging data, using user input or a mean- or median-filter to identify the background region in the image.

Input for this step must be a single DataFits that contains 3 image planes (HDUs) for the total Stokes I flux. The three images are: DATA, ERROR, and EXPOSURE.

Output from this step has the same format as the input.

Methods Summary

correct_zero_level_auto(data, method, radius)

Correct image zero level from automatically determined regions.

correct_zero_level_region(data, method, ...)

Correct image zero level from specified circular regions.

read_radius()

Read a radius value from the parameters.

run()

Run the data reduction algorithm.

setup()

Set parameters and metadata for the pipeline step.

Methods Documentation

correct_zero_level_auto(data, method, radius)[source]

Correct image zero level from automatically determined regions.

Data array is updated in place.

Parameters:
dataarray-like

Data to correct.

method{‘mean’, ‘median’}

Filter method.

radiusint

Radius in pixels for filter kernel.

correct_zero_level_region(data, method, region, refheader, robust=5.0)[source]

Correct image zero level from specified circular regions.

Data array is updated in place.

Parameters:
dataarray-like

Data to correct.

method{‘mean’, ‘median’}

Statistics method.

regionlist of float

Region specified as [RA, Dec, radius] in degrees.

refheaderastropy.Header

Reference header to use for WCS.

robustfloat

Sigma value to use for clipping statistics. Set to 0 to turn off clipping.

Raises:
ValueError

If any specified region is not on the array.

read_radius()[source]

Read a radius 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:
radiusfloat

Radius value for the input data.

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. Check and gather all input data.

  2. Correct zero level if desired.

setup()[source]

Set parameters and metadata for the pipeline step.

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

Parameters defined for this step are:

zero_level_method{‘mean’, ‘median’, ‘none’}

Statistic for zero-level calculation. If ‘none’, the zero-level will not be corrected. For the other options, either a mean or median statistic will be used to determine the zero-level value from the region set by the region parameters.

zero_level_regionstr

If set to ‘header’, the zero-level region will be determined from the ZERO_RA, ZERO_DEC, ZERO_RAD keywords (for RA center, Dec center, and radius, respectively). If set to ‘auto’, a mean- or median-filter will be applied to image, with the radius specified by the zero_level_radius parameter. The lowest negative local average is assumed to be the zero level. Otherwise, a region may be directly provided as a list of [RA center, Dec center, radius], in degrees.

zero_level_radiuslist of float

Filter radius for zero-level calculation, in arcseconds (per band). Used only for zero_level_region = ‘auto’.

zero_level_sigmafloat

Sigma value for statistics clipping. Ignored for zero_level_region = ‘auto’.