base_slopes#
- class arte.dataelab.base_slopes.BaseSlopes(data, time_vector=None, astropy_unit=Unit('signal'), data_label='slopes', axes=None)#
Bases:
BaseTimeSeriesWavefront sensor slopes time series.
This class handles slopes (wavefront gradients) recorded from wavefront sensors. Slopes are stored as vectors where typically half the elements are x-slopes and half are y-slopes.
By default, slopes are in xxxxyyyy order (all X slopes followed by all Y slopes). Individual slope components can be accessed using ‘x’ and ‘y’ selectors.
Slopes can be remapped into 2D arrays representing the telescope pupil, where each subaperture position shows its measured slope value.
- Parameters:
data (array_like or DataLoader) – Slope data with shape (nframes, nslopes) or (nslopes,)
time_vector (array_like or DataLoader, optional) – Time vector for each frame
astropy_unit (astropy.units.Unit, optional) – Physical unit for slope values (default: signal_unit)
data_label (str, optional) – Label for plots (default: ‘slopes’)
axes (sequence, optional) – Names for data axes
Examples
>>> slopes = BaseSlopes('slopes.fits') >>> sx = slopes.get_data('x') # Get x-slopes only >>> sy = slopes.get_data('y') # Get y-slopes only >>> slopes.imshow() # Display as 2D pupil maps >>> slopes.vecshow() # Display as vector field
Notes
Derived classes can customize the slope order by providing a different indexer implementation.
- Attributes:
axesData series shape
- delta_time
Property with the interval between samples.
If no interval can be determined (time vector too short), returns 1 with the correct unit if applicable.
ensemble_meanMean over ensemble dimensions (chainable property).
ensemble_medianMedian over ensemble dimensions (chainable property).
ensemble_ptpPeak-to-peak over ensemble dimensions (chainable property).
ensemble_rmsRMS over ensemble dimensions (chainable property).
ensemble_stdStandard deviation over ensemble dimensions (chainable property).
- shape
Data series shape
TODO depending on the data loader, it could be found without loading the entire data array
time_meanMean over time dimension (chainable property).
time_medianMedian over time dimension (chainable property).
time_ptpPeak-to-peak over time dimension (chainable property).
time_rmsRMS over time dimension (chainable property).
time_stdStandard deviation over time dimension (chainable property).
valueExtract final value(s) from TimeSeries (convenience accessor).
Methods
astropy_unit()Data unit as an astropy unit
data_label()Override to return a string with a readable unit name
data_unit()Data unit string (for plots)
ensemble_size()Number of distinct series in this time ensemble
filename()Data filename (full path)
filter(*args, **kwargs)Create filtered TimeSeries by applying ensemble and/or time selection.
get_data(*args[, times, axes])Retrieve time series data with optional filtering and indexing.
get_display(*args[, times])Display cube for the specified time interval
get_display_axes()Display cube axes names as a list of 3 strings
get_ensemble_average(*args[, times])Average across series at each sampling time
get_ensemble_median(*args[, times])Median across series at each sampling time
get_ensemble_ptp(*args[, times])Peak-to-peak (max - min) across series at each sampling time
get_ensemble_rms(*args[, times])Root-Mean-Square across series at each sampling time (legacy method).
get_ensemble_std(*args[, times])Standard deviation across series at each sampling time
get_index_of(*args, **kwargs)Return a selection index
get_time_average(*args[, times])Average value over time for each series
get_time_median(*args[, times])Median over time for each series
get_time_ptp(*args[, times])Peak-to-peak (max - min) over time for each series
get_time_rms(*args[, times])Root-Mean-Square value over time for each series
get_time_std(*args[, times])Standard deviation over time for each series
get_time_vector()Return the series time vector
help([search, prefix])Interactive help
imshow([cut_wings])Display X and Y slope 2d images cut_wings=x means that colorbar is saturated for array values below x percentile and above 100-x percentile.
movie(*args[, interval])Display data as a movie
plot(*args[, cut_wings, title, xlabel, ylabel])Plot timeseries
plot_cumulative_spectra(*args[, from_freq, ...])Plot cumulative PSD
plot_hist(*args[, from_t, to_t, overplot, ...])Plot histogram.
plot_spectra(*args[, from_freq, to_freq, ...])Plot PSD
power(*args[, from_freq, to_freq, ...])Compute Power Spectral Density using Welch's method.
savegif(filename, *args[, interval, loop])Save data as an animated GIF
tile(*args[, rowlength])Display data as a tiled 2d frame
time_size()Number of time samples in this time ensemble
vecshow()Display slopes as vector field
with_times(times)Filter to specific time interval (convenience alias for filter(times=...)).
frequency
last_cut_frequency
- get_index_of(*args, **kwargs)#
Return a selection index
- Parameters:
*args (tuple) – user-defined arguments for data selection
**kwargs (dict, optional) – extra user-defined arguments for data selection
- Returns:
index – indexes to select a data subset. If None, all data is selected. An integer, a list of integers or a slice will select those rows. If the data is multidimensional, a tuple can be returned where each element will select data across a single dimension. For a detailed explanation, see the “Advanced indexing” topic at https://numpy.org/doc/stable/user/basics.indexing.html#advanced-indexing
- Return type:
None, integer, list of integers, slice objects, or a tuple of the previous possibilities.
- imshow(cut_wings=0)#
Display X and Y slope 2d images cut_wings=x means that colorbar is saturated for array values below x percentile and above 100-x percentile. Default is 0, i.e. all data are displayed; values below 0 are forced to 0, values above 50 are set to 50.
- vecshow()#
Display slopes as vector field