readhwp

sofia_redux.instruments.hawc.steps.basehawc.readhwp(step, nsamp, hwp_tol, sampfreq)[source]

Determine HWP state for all samples.

This function determines HWP angles and moving intervals. It also makes sure all HWP intervals have roughly the same length (short intervals are removed).

The hwp_tol parameter is used to determine when the HWP is moving. If the HWP angle changes by more than this amount between two samples, then the code counts this as a division between HWP angles, and starts a new HWP position. Furthermore, a division will only be accounted for if the HWP angle stays in its new position for more than 2 seconds, in order to avoid considering noisy peaks that might occur as a real change in the HWP angle. Set hwp_tol to a number greater than 360 to force all the data to be in the same HWP angle The recommended value is between 0.2 and 0.3 for discrete HWP and 400 for continuous HWP movement.

The step.praw[‘HWP Index’] column is updated in place by this function: it is filled with the angle index found (starting at 0).

Parameters:
stepStepParent

The calling pipe step, containing data loaded into step.praw.

nsamp: int

The number of samples in the input data.

hwp_tolfloat

HWP angle tolerance in degrees.

sampfreqfloat

The sampling frequency in Hz.

Returns:
hwpstatearray-like

The HWP state array contains values 1 (good) and 0 (bad).

nhwpint

The number of HWP angles found.