base_2dmap#

class arte.dataelab.base_2dmap.Base2dMap(map2d)#

Bases: BaseData

Two-dimensional map for spatial data representation.

This class represents 2D spatial maps derived from time-series data, such as camera images, wavefront maps on telescope pupil, or deformable mirror shapes. It handles mapping between 1D data vectors and 2D spatial representations.

The map defines which elements are valid (value=1) and which are not used (value=0), enabling proper reshaping of vectorized data into 2D images.

Parameters:

map2d (ndarray) – 2D boolean or integer array where valid elements are 1 (or True) and unused elements are 0 (or False)

Examples

>>> # Create a circular pupil map
>>> pupil = np.zeros((100, 100))
>>> y, x = np.ogrid[-50:50, -50:50]
>>> mask = x**2 + y**2 <= 40**2
>>> pupil[mask] = 1
>>> map2d = Base2dMap(pupil)
>>> print(map2d.nvalid)  # Number of valid pixels
>>> # Remap 1D vector data to 2D image
>>> data_1d = np.random.randn(100, map2d.nvalid)  # 100 frames
>>> data_2d = map2d.remap_image(data_1d)  # Shape: (100, 100, 100)
Attributes:
nvalid

Number of valid elements

shape

Methods

as_mask()

astropy_unit()

Data unit as an astropy unit

data_label()

Long-form data label (for plots)

data_unit()

Data unit string (for plots)

filename()

Data filename (full path)

get_data(*args[, axes])

Raw data, selecting elements based on the indexer

get_display(*args, **kwargs)

Data mapped in 2d

get_index_of(*args, **kwargs)

Return data slice.

help([search, prefix])

Interactive help

imshow([cut_wings, title, xlabel, ylabel])

Display a 2d image.

remap_image(data)

Remap a 2d time series data into a 3d cube, where each cube slice is a 2d image.

from_idx1d

as_mask()#

‘ Return a mask suitable to be used in a masked array

static from_idx1d(shape, idx1d)#
property nvalid#

Number of valid elements

remap_image(data)#

Remap a 2d time series data into a 3d cube, where each cube slice is a 2d image. If a 1d array is passed, the resulting 3d array will have a first dimension with length 1.

Parameters:

data (ndarray) – 2d numpy array [time, values] or 1d numpy array [values]

Returns:

frame – 3d numpy array [time, x, y]

Return type:

ndarray