HawcPlusChannelData

class sofia_redux.scan.custom.hawc_plus.channels.channel_data.channel_data.HawcPlusChannelData(channels=None)[source]

Bases: SingleColorChannelData, SofiaChannelData

Initialize the channel data for the HAWC+ instrument.

Parameters:
channelsHawcPlusChannels, optional

The full channel object on which to base the data.

Attributes Summary

default_field_types

Return the defaults for the various channel data parameters.

info

Return the instrument information object.

Methods Summary

apply_info(info)

Apply information to the channel data.

calculate_sibs_position()

Calculate the SIBS position for each pixel.

copy()

Return a copy of the channel data.

geometric_cols()

Return the number of geometric columns in the detector array.

geometric_rows()

Return the number of geometric rows in the detector array.

get_geometric_overlap_indices(radius)

Return a cross-array indicating overlapping indices from data.

initialize_from_detector(detector)

Apply detector information to create and populate the channel data.

read_channel_data_file(filename)

Read a channel data file and return the information within.

read_jump_hdu(hdu)

Read the jump levels from a given FITS HDU.

set_channel_data(index, channel_info)

Set the channel info for a selected index.

set_reference_position(reference_position)

Sets the reference position by subtracting from the position field.

set_sibs_positions(detector_array)

Set the pixel positions based on detector array information.

set_uniform_gains([field])

Sets the gain and coupling to 1.0 for all channels.

to_string([indices, frame])

Return a string representation of channels.

validate_pixel_data()

Validates data read from the pixel data file.

Attributes Documentation

default_field_types

Return the defaults for the various channel data parameters.

Returns:
defaultsdict
info

Return the instrument information object.

Returns:
HawcPlusInfo

Methods Documentation

apply_info(info)[source]

Apply information to the channel data.

This initializes the channel data and derives the channel positions in relation to the SIBS pixel position.

Parameters:
infosofia_redux.scan.custom.hawc_plus.info.info.HawcPlusInfo
Returns:
None
calculate_sibs_position()[source]

Calculate the SIBS position for each pixel.

Returns:
None
copy()[source]

Return a copy of the channel data.

Returns:
HawcPlusChannelData
geometric_cols()[source]

Return the number of geometric columns in the detector array.

Returns:
colsint
geometric_rows()[source]

Return the number of geometric rows in the detector array.

Returns:
rowsint
get_geometric_overlap_indices(radius)[source]

Return a cross-array indicating overlapping indices from data.

Overlaps are calculated based on the geometric properties of channels (rows and columns). A maximum radius must be supplied as well as the pixel size indicating the separation between pixels in the x and y directions.

For HAWC_PLUS, the subrow attribute is used instead of row for the y-coordinate.

Parameters:
radiusastropy.units.Quantity

The maximum radius about which to include overlaps.

Returns:
overlap_indicesscipy.sparse.csr.csr_matrix (bool)

A Compressed Sparse Row (CSR) matrix of shape (channels, channels) where a True value for overlap_indices[i, j] signals that channel i overlaps with the channel j.

initialize_from_detector(detector)[source]

Apply detector information to create and populate the channel data.

The following attributes are determined from the detector:

- col: The column on the subarray (index mod sub_cols)
- row: The row on the array (index div sub_cols)
- sub: The subarray index (index div sub_pixels)
- pol: The polarization index of the subarray (sub // 2)
- fits_row: The FITS row index (row mod detector_rows)
- fits_col: The FITS column index (sub * sub_cols) + col
- subrow: The row on the subarray (row mod detector_rows)
- mux: Multiplexer readout index (sub * sub_cols) + col
- bias_line: The SQUID detector bias index (row // 2)
- series_array: The second stage SQUID series array (mux // 4)
- fits_index: The index on the FITS file (fits_row * 128) + fits_row

Additionally, the channel string ID is set to:

<SubPolID>[<subrow>,<col>]

where subrow and col are described above and SubPolID may be one of {R0, R1, T0, R1} where R relates to sub=0 and T relates to sub=1, and the second character represents pol.

Parameters:
detectorHawcPlusDetectorArrayInfo
Returns:
None
classmethod read_channel_data_file(filename)[source]

Read a channel data file and return the information within.

Returns a pandas DataFrame with the following columns: {gain, weight, flag, coupling, mux_gain, idx, sub, row, col, unknown}.

Parameters:
filenamestr

The path to a channel data file.

Returns:
channel_infopandas.DataFrame
read_jump_hdu(hdu)[source]

Read the jump levels from a given FITS HDU.

Parameters:
hdufits.PrimaryHDU
Returns:
None
set_channel_data(index, channel_info)[source]

Set the channel info for a selected index.

Parameters:
indexint

The channel index for which to set new data.

channel_infodict

A dictionary of the form {field: value} where. The attribute field at ‘index’ will be set to value.

Returns:
None
set_reference_position(reference_position)[source]

Sets the reference position by subtracting from the position field.

Parameters:
reference_positionCoordinate2D

The reference position to subtract

Returns:
None
set_sibs_positions(detector_array)[source]

Set the pixel positions based on detector array information.

BLIND channels will have NaN pixel positions. The spatial units will be those defined by the detector array for pixel_xy_size. The result will be to populate the position attribute with an (N, 2) array of (x, y) positions.

Parameters:
detector_arrayHawcPlusDetectorArrayInfo
Returns:
None
set_uniform_gains(field=None)[source]

Sets the gain and coupling to 1.0 for all channels.

Parameters:
fieldstr, optional

If supplied, sets all values of the requested field to unity.

Returns:
None
to_string(indices=None, frame=False)[source]

Return a string representation of channels.

Parameters:
indicesnumpy.ndarray or slice, optional

The channel indices (not fixed) to return. The default is all channels.

framebool, optional

If True, returns a pd.DataFrame instead of a string representation.

Returns:
str or pd.DataFrame
validate_pixel_data()[source]

Validates data read from the pixel data file.

Returns:
None