HawcPlusIntegration

class sofia_redux.scan.custom.hawc_plus.integration.integration.HawcPlusIntegration(scan=None)[source]

Bases: SofiaIntegration

Initialize a HAWC+ integration.

Parameters:
scansofia_redux.scan.custom.hawc_plus.scan.scan.HawcPlusScan

The scan to which this integration belongs (optional).

Attributes Summary

scan_astrometry

Return the scan astrometry.

Methods Summary

apply_configuration()

Apply configuration options to an integration.

check_consistency(channels, frame_dependents)

Check consistency of frame dependents and channels.

check_jumps()

Checks for jumps in the jump counter.

correct_jumps()

Correct jumps in the data.

detect_jumps()

Attempt to detect jumps in the frame data when not reported.

flag_zeroed_channels()

Flags all channels with completely zeroed frame data as DISCARD/DEAD.

get_first_frame([reference])

Return the first valid frame.

get_full_id([separator])

Return the full integration ID.

get_jump_blank_range()

Return the number of frames to flag before and after a jump.

get_last_frame([reference])

Return the first valid frame.

get_mean_hwp_angle()

Return the mean Half Wave Plate angle.

get_table_entry(name)

Return a parameter value for the given name.

level_jumps(channels, frame_dependents[, ...])

Levels frame data based on jump locations.

print_equivalent_taus(tau)

Write a log message for the given tau value.

read(hdus)

Read integration information from a list of Data HDUs.

remove_drifts([target_frame_resolution, robust])

Remove drifts in frame data given a target frame resolution.

set_tau([spec, value])

Set the tau values for the integration.

shift_chopper(n_frames)

Shift the chopper position by a given number of frames

update_inconsistencies(channels, ...)

Check consistency of frame dependents and channels.

validate()

Validate the integration after a read.

Attributes Documentation

scan_astrometry

Return the scan astrometry.

Returns:
HawcPlusAstrometryInfo

Methods Documentation

apply_configuration()[source]

Apply configuration options to an integration.

Returns:
None
check_consistency(channels, frame_dependents, start_frame=None, stop_frame=None)[source]

Check consistency of frame dependents and channels.

In addition to the standard consistency checks, will also fix jumps in the frame data if configuration settings allow, and jumps are present.

Parameters:
channelsChannelGroup
frame_dependentsnumpy.ndarray (float)
start_frameint, optional

The starting frame (inclusive). Defaults to the first (0) frame.

stop_frameint, optional

The end frame (exclusive). Defaults to the last (self.size) frame.

Returns:
consistentnumpy.ndarray (bool)

An array of size self.size where True indicates a consistent frame.

check_jumps()[source]

Checks for jumps in the jump counter.

Returns:
has_jumpsbool

True if jumps were detected.

correct_jumps()[source]

Correct jumps in the data.

The data are corrected by:

data -= jump_counter * channel_jumps

where jump_counter is created for each frame and channel, and jumps are per channel. Since jump counter is a byte valued, wrap around values are accounted for by jump_range (power of 2 value).

Returns:
None
detect_jumps()[source]

Attempt to detect jumps in the frame data when not reported.

If fixjumps.detect is set to a positive value and fixjumps is also enabled, attempts to detect unreported jumps in the SQ1Feedback data. Jumps are only searched for in channels that do not currently contain any known jumps, and the frame jump counter is incremented to mark a jump for subsequent processing by the standard fixjumps algorithm.

The fixjumps.detect threshold (x) is used in the following way:

dd = frame_data[1:] - frame_data[:-1]
mad = medabsdev(dd)
threshold = x * mad
possible_jumps = dd >= threshold

For each possible jump, if the median of the data before differs to the median of the data after by more than threshold, then the jump is considered valid. Note that each before/after chunk only extends to the previous/next possible jump.

Returns:
None
flag_zeroed_channels()[source]

Flags all channels with completely zeroed frame data as DISCARD/DEAD.

Returns:
None
get_first_frame(reference=0)[source]

Return the first valid frame.

Parameters:
referenceint, optional

The first actual frame index after which to return the first valid frame. The default is the first (0).

Returns:
HawcPlusFrames
get_full_id(separator='|')[source]

Return the full integration ID.

Parameters:
separatorstr, optional

The separator character/phase between the scan and integration ID.

Returns:
str
get_jump_blank_range()[source]

Return the number of frames to flag before and after a jump.

Returns:
blank_framesnumpy.ndarray (int)

The [flag_before, flag_after] number of frames to flag before and after each jump.

get_last_frame(reference=None)[source]

Return the first valid frame.

Parameters:
referenceint, optional

The last actual frame index before which to return the last valid frame. The default is the last.

Returns:
HawcPlusFrames
get_mean_hwp_angle()[source]

Return the mean Half Wave Plate angle.

The mean HWP angle is given as the mean of the first and last valid frame HWP angle values.

Returns:
astropy.units.Quantity

The mean HWP angle.

get_table_entry(name)[source]

Return a parameter value for the given name.

Parameters:
namestr

The name of the parameter to retrieve.

Returns:
value
level_jumps(channels, frame_dependents, start_frame=None, stop_frame=None)[source]

Levels frame data based on jump locations.

Parameters:
channelsChannelGroup
frame_dependentsnumpy.ndarray (float)
start_frameint, optional

The starting frame (inclusive). Defaults to the first (0) frame.

stop_frameint, optional

The end frame (exclusive). Defaults to the last (self.size) frame.

Returns:
consistentnumpy.ndarray (bool)

An array of size self.size where True indicates a consistent frame.

print_equivalent_taus(tau)[source]

Write a log message for the given tau value.

Parameters:
taufloat
Returns:
None
read(hdus)[source]

Read integration information from a list of Data HDUs. All HDUs should consist of “timestream” data.

Parameters:
hduslist (astropy.io.fits.hdu.table.BinTableHDU)

A list of data HDUs containing “timestream” data.

Returns:
None
remove_drifts(target_frame_resolution=None, robust=False)[source]

Remove drifts in frame data given a target frame resolution.

Will also set the filter time scale based on the target frame resolution.

Sets additional attributes based on jumps.

Parameters:
target_frame_resolutionint

The number of frames for the target resolution.

robustbool, optional

If True use the robust (median) method to determine means.

Returns:
None
set_tau(spec=None, value=None)[source]

Set the tau values for the integration.

If a value is explicitly provided without a specification, will be used to set the zenith tau if ground based, or transmission. If a specification and value is provided, will set the zenith tau as:

((band_a / t_a) * (value - t_b)) + band_b

where band_a/b are retrieved from the configuration as tau.<spec>.a/b, and t_a/b are retrieved from the configuration as tau.<instrument>.a/b.

Parameters:
specstr, optional

The tau specification to read from the configuration. If not supplied, will be read from the configuration ‘tau’ setting.

valuefloat, optional

The tau value to set. If not supplied, will be retrieved from the configuration as tau.<spec>.

Returns:
None
shift_chopper(n_frames)[source]

Shift the chopper position by a given number of frames

Parameters:
n_framesint

The number of frames to shift the chopper signal.

Returns:
None
update_inconsistencies(channels, frame_dependents, drift_size)[source]

Check consistency of frame dependents and channels.

Looks for inconsistencies in the channel and frame data post levelling and updates the inconsistencies attribute of the channel data.

Parameters:
frame_dependentsnumpy.ndarray (float)
channelsHawcPlusChannelGroup
drift_sizeint

The size of the drift removal block size in frames.

Returns:
None
validate()[source]

Validate the integration after a read.

Returns:
None