Overlay

class sofia_redux.scan.source_models.maps.overlay.Overlay(data=None, blanking_value=None, dtype=None, shape=None, unit=None)[source]

Bases: Image

Create an overlay of an underlying image.

The overlay object is an interface to a basis image. Multiple overlays can be applied to a single image allowing the data to be accessed and set as desired.

Parameters:
datanumpy.ndarray or FlaggedArray or Image or Overlay, optional

The image to overlay.

blanking_valueint or float, optional

The value indicating that a data value is invalid.

dtypetype, optional

The data type.

shapetuple of int, optional

The shape of the data.

unitastropy.units.Quantity, optional

The data unit.

Attributes Summary

blanking_value

Return the blanking value for the basis image.

data

Return the basis image data array.

dtype

Return the data type for the basis image data array.

fixed_index

Return the fixed indices of the basis image elements.

flag

Return the associated data flags of the basis image.

ndim

Return the number of dimensions in the basis image.

shape

Return the shape of the basis image data array.

size

Return the size of the basis image data array.

valid

Return a boolean mask array of valid data elements in the basis image.

Methods Summary

copy([with_contents])

Return a copy of the overlay.

crop(ranges)

Crop the overlay to the required dimensions.

destroy()

Destroy the basis image.

set_basis(basis)

Set the basis image.

set_data(data[, change_type])

Set the data of the flagged array.

set_data_shape(shape)

Set the shape of the data array.

Attributes Documentation

blanking_value

Return the blanking value for the basis image.

The blanking value is that which defines an invalid value.

Returns:
blanking_valueint or float or None
data

Return the basis image data array.

Returns:
datanp.ndarray or None
dtype

Return the data type for the basis image data array.

Returns:
dtypetype
fixed_index

Return the fixed indices of the basis image elements.

The fixed indices are designed to be constant irrespective of any operations, deletions, etc and provide a reverse lookup onto the original data set.

Returns:
fixed_indexnumpy.ndarray (int)
flag

Return the associated data flags of the basis image.

Returns:
flagsnumpy.ndarray (int)
ndim

Return the number of dimensions in the basis image.

Returns:
int
shape

Return the shape of the basis image data array.

Returns:
tuple (int)
size

Return the size of the basis image data array.

Returns:
int
valid

Return a boolean mask array of valid data elements in the basis image.

Valid elements are neither NaN, set to the blanking value, or flagged as the validating_flags.

Returns:
numpy.ndarray (bool)

A boolean mask where True indicates a valid element.

Methods Documentation

copy(with_contents=True)[source]

Return a copy of the overlay.

Parameters:
with_contentsbool, optional

If True, paste the contents of this image onto the new one.

Returns:
Overlay
crop(ranges)[source]

Crop the overlay to the required dimensions.

Parameters:
rangesnumpy.ndarray (int,)

The ranges to set crop the data to. Should be of shape (n_dimensions, 2) where ranges[0, 0] would give the minimum crop limit for the first dimension and ranges[0, 1] would give the maximum crop limit for the first dimension. In this case, the ‘first’ dimension is in numpy format. i.e., (y, x) for a 2-D array. Also note that the upper crop limit is not inclusive so a range of (0, 3) includes indices [0, 1, 2] but not 3.

Returns:
None
destroy()[source]

Destroy the basis image.

Returns:
None
set_basis(basis)[source]

Set the basis image.

Parameters:
basisImage or FitsData or FlaggedArray
Returns:
None
set_data(data, change_type=False)[source]

Set the data of the flagged array.

All flags are set to zero.

Parameters:
datanumpy.ndarray or FlaggedArray
change_typebool, optional

If True, change the data type to that of the data.

Returns:
None
set_data_shape(shape)[source]

Set the shape of the data array.

Parameters:
shapetuple (int)
Returns:
None