multi_time_series#
- class arte.time_series.multi_time_series.MultiTimeSeries(*args)#
Bases:
TimeSeriesJoin multiple TimeSeries objects with incompatible time sampling.
After being initialized with a list of
TimeSeriesobjects, which can have different ensemble sizes and length, it behaves as if all the data was part of a single ensemble.Time operations (like
time_mean,time_std) work in any case.Ensemble operations (like
ensemble_mean,ensemble_std) only work if all series have the same sampling rate (delta_time), and raise an Exception otherwise. Useis_homogeneous()to check compatibility before calling ensemble operations.Examples
>>> # Create multi-series with compatible sampling >>> multi = MultiTimeSeries(series1_1khz, series2_1khz) >>> multi.is_homogeneous() # True - same sampling rates True >>> mean = multi.ensemble_mean.value # Works! >>> >>> # Incompatible sampling raises exception >>> multi2 = MultiTimeSeries(series_1khz, series_500hz) >>> multi2.ensemble_mean # Raises Exception - incompatible rates >>> >>> # Time operations always work >>> time_avg = multi2.time_mean.value # Always works
Notes
Chainable API: ensemble operations return TimeSeries objects that can be chained with time operations and vice versa.
- 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).
shapeShape of the underlying 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
add_series(series)Adds a new series to this MultiTimeSeries instance
data_label()Override to return a string with a readable unit name
data_unit()Override to return a string with a compact unit notation
delta_times(*args, **kwargs)Returns a vector of delta times
Returns the total ensemble size
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_ensemble_average(*args[, times])Average across series at each sampling time (legacy method).
get_ensemble_median(*args[, times])Median across series at each sampling time (legacy method).
get_ensemble_ptp(*args[, times])Peak-to-peak (max - min) across series at each sampling time (legacy method).
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 (legacy method).
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
is_homogeneous(*args, **kwargs)Check if selected series have compatible sampling rates.
power(*args[, from_freq, to_freq, ...])Compute Power Spectral Density using Welch's method.
time_size()Number of time samples in this time ensemble
with_times(times)Filter to specific time interval (convenience alias for filter(times=...)).
frequency
get_index_of
last_cut_frequency
- add_series(series)#
Adds a new series to this MultiTimeSeries instance
- Parameters:
series (
TimeSeriesorTimeSeriesWithInterpolationinstance) – the series to be added
- delta_times(*args, **kwargs)#
Returns a vector of delta times
- property ensemble_mean#
Mean over ensemble dimensions (chainable property).
Computes the mean across all series at each time step. Requires all series to have compatible sampling rates.
- Returns:
Mean across ensemble at each time step (chainable)
- Return type:
- Raises:
Exception – If series have incompatible sampling rates. Use
is_homogeneous()to check compatibility first.
Examples
>>> # Check compatibility before using >>> if multi.is_homogeneous(): ... mean = multi.ensemble_mean.value >>> >>> # Chain with time operations >>> overall_mean = multi.ensemble_mean.time_mean.value
See also
is_homogeneousCheck if series have compatible sampling rates
ensemble_stdStandard deviation across ensemble
ensemble_medianMedian across ensemble
- property ensemble_median#
Median over ensemble dimensions (chainable property).
Computes the median across all series at each time step. Requires all series to have compatible sampling rates.
- Returns:
Median across ensemble at each time step (chainable)
- Return type:
- Raises:
Exception – If series have incompatible sampling rates. Use
is_homogeneous()to check compatibility first.
Examples
>>> if multi.is_homogeneous(): ... median = multi.ensemble_median.value >>> >>> # Chain with time operations >>> median_avg = multi.ensemble_median.time_mean.value
See also
is_homogeneousCheck if series have compatible sampling rates
ensemble_meanMean across ensemble
- property ensemble_ptp#
Peak-to-peak over ensemble dimensions (chainable property).
Computes the peak-to-peak range across all series at each time step. Requires all series to have compatible sampling rates.
- Returns:
Peak-to-peak across ensemble at each time step (chainable)
- Return type:
- Raises:
Exception – If series have incompatible sampling rates. Use
is_homogeneous()to check compatibility first.
Examples
>>> if multi.is_homogeneous(): ... ptp = multi.ensemble_ptp.value >>> >>> # Chain with time operations >>> mean_ptp = multi.ensemble_ptp.time_mean.value
See also
is_homogeneousCheck if series have compatible sampling rates
- property ensemble_rms#
RMS over ensemble dimensions (chainable property).
Computes the RMS across all series at each time step. Requires all series to have compatible sampling rates.
- Returns:
RMS across ensemble at each time step (chainable)
- Return type:
- Raises:
Exception – If series have incompatible sampling rates. Use
is_homogeneous()to check compatibility first.
Examples
>>> if multi.is_homogeneous(): ... rms = multi.ensemble_rms.value >>> >>> # Chain with time operations >>> mean_rms = multi.ensemble_rms.time_mean.value
See also
is_homogeneousCheck if series have compatible sampling rates
ensemble_meanMean across ensemble
- ensemble_size()#
Returns the total ensemble size
- property ensemble_std#
Standard deviation over ensemble dimensions (chainable property).
Computes the std across all series at each time step. Requires all series to have compatible sampling rates.
- Returns:
Std across ensemble at each time step (chainable)
- Return type:
- Raises:
Exception – If series have incompatible sampling rates. Use
is_homogeneous()to check compatibility first.
Examples
>>> if multi.is_homogeneous(): ... std = multi.ensemble_std.value >>> >>> # Chain with time operations >>> mean_std = multi.ensemble_std.time_mean.value
See also
is_homogeneousCheck if series have compatible sampling rates
ensemble_meanMean across ensemble
- get_ensemble_average(*args, times=None, **kwargs)#
Average across series at each sampling time (legacy method).
Deprecated since version Use: the
ensemble_meanproperty instead. This method will be removed in a future version.- Returns:
Mean values (not chainable)
- Return type:
ndarray
- Raises:
Exception – If series have incompatible sampling rates (not homogeneous)
- get_ensemble_median(*args, times=None, **kwargs)#
Median across series at each sampling time (legacy method).
Deprecated since version Use: the
ensemble_medianproperty instead. This method will be removed in a future version.- Returns:
Median values (not chainable)
- Return type:
ndarray
- Raises:
Exception – If series have incompatible sampling rates (not homogeneous)
- get_ensemble_ptp(*args, times=None, **kwargs)#
Peak-to-peak (max - min) across series at each sampling time (legacy method).
Deprecated since version Use: the
ensemble_ptpproperty instead. This method will be removed in a future version.- Returns:
Peak-to-peak values (not chainable)
- Return type:
ndarray
- Raises:
Exception – If series have incompatible sampling rates (not homogeneous)
- get_ensemble_rms(*args, times=None, **kwargs)#
Root-Mean-Square across series at each sampling time (legacy method).
Deprecated since version Use: the
ensemble_rmsproperty instead. This method will be removed in a future version.- Returns:
RMS values (not chainable)
- Return type:
ndarray
- Raises:
Exception – If series have incompatible sampling rates (not homogeneous)
- get_ensemble_std(*args, times=None, **kwargs)#
Standard deviation across series at each sampling time (legacy method).
Deprecated since version Use: the
ensemble_stdproperty instead. This method will be removed in a future version.- Returns:
Std values (not chainable)
- Return type:
ndarray
- Raises:
Exception – If series have incompatible sampling rates (not homogeneous)
- is_homogeneous(*args, **kwargs)#
Check if selected series have compatible sampling rates.
- Parameters:
*args – Passed to
get_index_of()for series selection.**kwargs – Passed to
get_index_of()for series selection.
- Returns:
True if all selected series have identical
delta_time, False otherwise.- Return type:
bool
Notes
This check is necessary before calling ensemble-wise operations like
ensemble_meanorensemble_std, which require uniform time sampling across all series.Examples
>>> multi = MultiTimeSeries(series_1khz, series_500hz) >>> multi.is_homogeneous() # False - different sampling rates False >>> >>> multi2 = MultiTimeSeries(series1_1khz, series2_1khz) >>> multi2.is_homogeneous() # True - same sampling True