ExampleChannelData

class sofia_redux.scan.custom.example.channels.channel_data.channel_data.ExampleChannelData(channels=None)[source]

Bases: SingleColorChannelData

Initialize the channel data for the example instrument.

Parameters:
channelssofia_redux.scan.channels.channels.Channels, optional

The parent channels for the channel data.

Attributes Summary

default_field_types

Return the default values for the data attributes.

info

Return the example instrument information object.

Methods Summary

apply_info(info)

Apply information to the channel data.

calculate_sibs_position()

Calculate the SIBS position for each pixel.

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 this information to create and populate the channel data.

read_channel_data_file(filename)

Read a channel data file and return the information within.

set_channel_data(index, channel_info)

Set the channel info for a selected index.

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.

Attributes Documentation

default_field_types

Return the default values for the data attributes.

Returns:
field_defaultsdict

Keys contain the name of the attribute and values contain the value.

info

Return the example instrument information object.

Returns:
infosofia_redux.scan.custom.example.info.info.ExampleInfo

Methods Documentation

apply_info(info)[source]

Apply information to the channel data.

Parameters:
infoInfo
Returns:
None
calculate_sibs_position()[source]

Calculate the SIBS position for each pixel.

Pixels that are flagged as BLIND will have their positions set to NaN.

Returns:
None
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 this information to create and populate the channel data.

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

Read a channel data file and return the information within.

Parameters:
filenamestr

The path to a channel data file.

Returns:
channel_infodict

A nested dictionary of the form {row,col: {key: value}}.

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_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_arrayExampleDetectorArrayInfo
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