base_timeseries#
- class arte.dataelab.base_timeseries.BaseTimeSeries(data, time_vector=None, astropy_unit=None, data_label=None, axes=None)#
Bases:
TimeSeriesGeneric time series.
- A time series holds:
N samples of numeric data of arbitrary type and dimensions, with an optional astropy unit.
sampling time for each sample
optionally, a data label for plots and displays
Data is accessed with the get_data() method. Derived classes can define specialized arguments to return data subsets, e.g. get_data(quadrant=2) Basic arithmetic operations (sum, div, etc) are supported. Astropy units, if present, will be enforced.
- Parameters:
data_loader (instance of DataLoader or derived class, or numpy array, or filename (string or pathlib instance)) – time series data [time, data_d0 [, data_d1…]]
time_vector (instance of DataLoader or derived class, or numpy_array, or None) – time vector data. If None, a default counter from 0 to N-1 samples will be assigned
astropy_unit (astropy unit or None) – if possible, astropy unit to use with the data.
data_label (string or None) – human-readable label for plot (e.g.: “Surface modal coefficients” )
axes (sequence or None) – sequence of axes names, optional
- 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
Data unit as an astropy unit
Override to return a string with a readable unit name
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
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(*args[, cut_wings, title, xlabel, ylabel])Display a 2d image.
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
with_times(times)Filter to specific time interval (convenience alias for filter(times=...)).
frequency
last_cut_frequency
- 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)
- filename()#
Data filename (full path)
- get_display(*args, times=None, **kwargs)#
Display cube for the specified time interval
- get_display_axes()#
Display cube axes names as a list of 3 strings
- 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(*args, cut_wings=0, title='', xlabel='', ylabel='', **kwargs)#
Display a 2d image.
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.
- movie(*args, interval=0.1, **kwargs)#
Display data as a movie
- plot(*args, cut_wings=0, title='', xlabel='', ylabel='', **kwargs)#
Plot timeseries
- plot_cumulative_spectra(*args, from_freq=None, to_freq=None, segment_factor=None, label=None, plot_to=None, overplot=False, plot_rms=False, lineary=False, **kwargs)#
Plot cumulative PSD
- plot_hist(*args, from_t=None, to_t=None, overplot=None, plot_to=None, label=None, **kwargs)#
Plot histogram. TODO: does not work, rewrite
- plot_spectra(*args, from_freq=None, to_freq=None, segment_factor=None, overplot=False, label=None, plot_to=None, lineary=False, linearx=False, **kwargs)#
Plot PSD
- savegif(filename, *args, interval=0.1, loop=0, **kwargs)#
Save data as an animated GIF
- property shape#
Data series shape
TODO depending on the data loader, it could be found without loading the entire data array
- tile(*args, rowlength=10, **kwargs)#
Display data as a tiled 2d frame