Camera

class sofia_redux.scan.channels.camera.camera.Camera(name=None, parent=None, info=None, size=0)[source]

Bases: Channels

Initialize camera channels.

The Camera class extends the Channels class by including additional handling of the channels with respect to their field of view such as rotation with respect to a reference, correlated sky gradient modalities, and how to read and apply the hardware file containing channel data.

Parameters:
namestr, optional

The name for the channels.

parentobject, optional

The owner of the channels such as a Reduction, Scan or Integration.

infosofia_redux.scan.info.info.Info, optional

The channel information.

sizeint, optional

The number of stored channels.

Attributes Summary

rotation

Return the camera rotation angle.

Methods Summary

flag_invalid_positions([maximum_distance])

Flag positions as blind if the distance is greater than a given limit.

get_rcp_header()

Return the header for an RCP file.

get_rcp_info(filename)

Return the RCP file information as a pandas data frame.

get_rotation_angle()

Return the rotation angle.

init_modalities()

Initializes channel modalities.

load_channel_data()

Load the channel data.

print_pixel_rcp([header])

Return string information of the pixel RCP info.

read_rcp(filename)

Read and apply the RCP file information to channels (pixels).

rotate(angle)

Apply a rotation to channel (pixel) positions.

set_reference_position(reference)

Subtract a reference position from pixel positions.

Attributes Documentation

rotation

Return the camera rotation angle.

Returns:
angleunits.Quantity

Methods Documentation

flag_invalid_positions(maximum_distance=<Quantity 1. deg>)[source]

Flag positions as blind if the distance is greater than a given limit.

Parameters:
maximum_distanceastropy.units.Quantity

A spatial maximum distance limit. The default is 1 degree.

Returns:
None
static get_rcp_header()[source]

Return the header for an RCP file.

Returns:
headerstr
static get_rcp_info(filename)[source]

Return the RCP file information as a pandas data frame.

If the RCP file contains 3 columns, x and y positions are returned. If there are 5 or more columns, the columns are considered to be [source gain, coupling, x, y]. The zeroth column gives the channel index.

Parameters:
filenamestr

Path to the RCP file.

Returns:
rcp_informationpandas.DataFrame or None

The RCP information. None will be returned on failure.

get_rotation_angle()[source]

Return the rotation angle.

Returns:
angleastropy.units.Quantity
init_modalities()[source]

Initializes channel modalities.

A modality is based of a channel division and contains a mode for each channel group in the channel division.

The Camera modalities adds an additional CorrelatedModality to the existing modalities based on sky gradient in the x and y directions, coupled to the observing channels.

Returns:
None
load_channel_data()[source]

Load the channel data.

The camera class implements rotation, which is performed before loading the standard channel data. Rotation specified in the configuration is applied to the calculated or default positions only. RCP rotation is handled separately via the ‘rcp.rotate’ configuration option. Instruments with a rotator should apply explicit rotation after pixel positions are finalized.

Returns:
None
print_pixel_rcp(header=None)[source]

Return string information of the pixel RCP info.

Parameters:
headerstr, optional

An optional header string.

Returns:
pixel_rcpstr
read_rcp(filename)[source]

Read and apply the RCP file information to channels (pixels).

The RCP information is read and applied from a given file. The RCP file should contain comma-separated values in one of following column formats:

CHANNEL_INDEX, X_POSITION(arcsec), Y_POSITION(arcsec) CHANNEL_INDEX, GAIN, X_POSITION(arcsec), Y_POSITION(arcsec) CHANNEL_INDEX, GAIN, COUPLING, X_POSITION(arcsec), Y_POSITION(arcsec)

All pixels not contained in the RCP file are flagged as BLIND, and will only be unflagged if a GAIN column is available in the file. The channel coupling will be set to GAIN/COUPLING or GAIN/channel.gain depending on the column format, or ignored if not available. X and Y positions are also set at this stage.

If no RCP information is available (no file), these attributes should be set via other methods.

Parameters:
filenamestr

Path to the RCP file.

Returns:
None
rotate(angle)[source]

Apply a rotation to channel (pixel) positions.

Parameters:
angleunits.Quantity

The rotation to apply.

Returns:
None
set_reference_position(reference)[source]

Subtract a reference position from pixel positions.

Parameters:
referenceCoordinate2D

The reference position containing (x, y) coordinates.

Returns:
None