時系列 (Time Series)

gwexpy.timeseries - Time series data containers and operations.

class gwexpy.timeseries.TimeSeries(data: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], *args: Any, **kwargs: Any)[source]

Bases: PlotMixin, TimeSeriesInteropMixin, TimeSeriesAnalysisMixin, TimeSeriesResamplingMixin, TimeSeriesSignalMixin, SignalAnalysisMixin, TimeSeriesSpectralMixin, StatisticsMixin, FittingMixin, PhaseMethodsMixin, TimeSeriesCore

Extended TimeSeries with all gwexpy functionality.

This class combines functionality from multiple modules: - Core operations: is_regular, _check_regular, tail, crop, append, find_peaks - Spectral transforms: fft, psd, cwt, laplace, etc. - Signal processing: hilbert, mix_down, xcorr, etc. - Analysis: impute, standardize, rolling_*, etc. - Interoperability: to_pandas, to_torch, to_xarray, etc.

Inherits from gwpy.timeseries.TimeSeries for full compatibility.

ar(p: int = 1, **kwargs: Any) Any[source]

Fit an AutoRegressive AR(p) model. Shortcut for .arima(order=(p, 0, 0)).

arima(order: tuple[int, int, int] = (1, 0, 0), *, seasonal_order: tuple[int, int, int, int] | None = None, auto: bool = False, **kwargs: Any) Any[source]

Fit an ARIMA or SARIMAX model to this TimeSeries.

This method wraps statsmodels.tsa.arima.model.ARIMA (or SARIMAX). If auto=True, it uses pmdarima to automatically find the best parameters.

Parameters:
  • order (tuple, default=(1, 0, 0)) – The (p,d,q) order of the model.

  • seasonal_order (tuple, optional) – The (P,D,Q,s) seasonal order.

  • auto (bool, default=False) – If True, perform Auto-ARIMA search (requires pmdarima).

  • **kwargs – Additional arguments passed to fit_arima.

Returns:

Object containing the fitted model, with methods .predict(), .forecast(), .plot().

Return type:

ArimaResult

arma(p: int = 1, q: int = 1, **kwargs: Any) Any[source]

Fit an ARMA(p, q) model. Shortcut for .arima(order=(p, 0, q)).

classmethod from_control(response: Any, **kwargs: Any) TimeSeries | TimeSeriesDict[source]

Create TimeSeries from python-control TimeResponseData.

Parameters:
  • response (control.TimeResponseData) – The simulation result from python-control.

  • **kwargs (dict) – Additional arguments passed to the constructor.

Returns:

The converted time-domain data.

Return type:

TimeSeries or TimeSeriesDict

classmethod from_simpeg(data_obj: Any, **kwargs: Any) TimeSeries[source]

Create TimeSeries from SimPEG Data object.

Parameters:

data_obj (simpeg.data.Data) – Input SimPEG Data.

Return type:

TimeSeries

ma(q: int = 1, **kwargs: Any) Any[source]

Fit a Moving Average MA(q) model. Shortcut for .arima(order=(0, 0, q)).

to_simpeg(location: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, rx_type: str = 'PointElectricField', orientation: str = 'x', **kwargs: Any) Any[source]

Convert to SimPEG Data object.

Parameters:
  • location (array_like, optional) – Rx location (x, y, z). Default is [0, 0, 0].

  • rx_type (str, optional) – Receiver class name. Default “PointElectricField”.

  • orientation (str, optional) – Receiver orientation (‘x’, ‘y’, ‘z’). Default ‘x’.

Return type:

simpeg.data.Data

df: Any
channel_names: Any
class gwexpy.timeseries.TimeSeriesDict[source]

Bases: PlotMixin, DictMapMixin, PhaseMethodsMixin, TimeSeriesDict

Dictionary of TimeSeries objects.

append(other, copy=True, **kwargs) TimeSeriesDict[source]

Append another mapping of TimeSeries or a single TimeSeries to each item.

asd(*args, **kwargs)

Compute ASD for each TimeSeries. Returns a FrequencySeriesDict.

asfreq(*args, **kwargs)

Apply asfreq to each TimeSeries in the dict.

average_fft(*args, **kwargs)

Apply average_fft to each TimeSeries. Returns a FrequencySeriesDict.

baseband(*args, **kwargs)

Apply baseband to each item.

coherence(other=None, *args, fftlength=None, overlap=None, window='hann', symmetric=True, include_diagonal=True, diagonal_value=1.0, **kwargs)[source]

Compute coherence for each element or as a matrix depending on other.

coherence_matrix(other=None, *args, fftlength=None, overlap=None, window='hann', symmetric=True, include_diagonal=True, diagonal_value=1.0, **kwargs)[source]

Compute coherence matrix for all pairs.

Parameters:
  • other (TimeSeriesDict or TimeSeriesList, optional) – Another collection for cross-coherence.

  • fftlength (float, optional) – FFT length in seconds.

  • overlap (float, optional) – Overlap between segments in seconds.

  • window (str, optional) – Window function name (default ‘hann’).

  • symmetric (bool, optional) – If True, exploit symmetry (default True).

  • include_diagonal (bool, optional) – Whether to include diagonal elements (default True).

  • diagonal_value (float, optional) – Value for diagonal elements (default 1.0).

Returns:

The coherence matrix.

Return type:

FrequencySeriesMatrix

Notes

If include_diagonal is True and diagonal_value is not None, the diagonal is filled with that value without computation. If diagonal_value is None, the diagonal coherence is computed. Uncomputed elements are represented as NaN. The frequency axis is taken from the first computed element without alignment/truncation; dt and fftlength consistency is enforced before computation.

correlation(other=None, **kwargs)[source]

Compute correlation. Vectorized via TimeSeriesMatrix.

crop(start=None, end=None, copy=False) TimeSeriesDict[source]

Crop each TimeSeries in the dict. Accepts any time format supported by gwexpy.time.to_gps (str, datetime, pandas, obspy, etc). Returns a new TimeSeriesDict.

csd(other=None, *args, fftlength=None, overlap=None, window='hann', hermitian=True, include_diagonal=True, **kwargs)[source]

Compute CSD for each element or as a matrix depending on other.

csd_matrix(other=None, *args, fftlength=None, overlap=None, window='hann', hermitian=True, include_diagonal=True, **kwargs)[source]

Compute Cross-Spectral Density matrix for all pairs.

Parameters:
  • other (TimeSeriesDict or TimeSeriesList, optional) – Another collection for cross-CSD. If None, compute self-CSD matrix.

  • fftlength (float, optional) – FFT length in seconds.

  • overlap (float, optional) – Overlap between segments in seconds.

  • window (str, optional) – Window function name (default ‘hann’).

  • hermitian (bool, optional) – If True, exploit Hermitian symmetry (default True).

  • include_diagonal (bool, optional) – Must be True for CSD matrices; False raises ValueError because the diagonal is always the PSD.

Returns:

The CSD matrix.

Return type:

FrequencySeriesMatrix

Notes

The diagonal of a self-CSD matrix is always computed as the PSD. Any uncomputed elements are represented as complex NaN. The frequency axis is taken from the first computed element without alignment/truncation; dt and fftlength consistency is enforced before computation.

decimate(*args, **kwargs)

Decimate each TimeSeries in the dict.

degree(*args, **kwargs)

Compute instantaneous phase (in degrees) of each item.

detrend(*args, **kwargs)

Detrend each TimeSeries in the dict.

distance_correlation(other, **kwargs)[source]

Compute distance correlation. Vectorized via TimeSeriesMatrix.

envelope(*args, **kwargs)

Apply envelope to each item.

fft(*args, **kwargs)

Apply FFT to each TimeSeries. Returns a FrequencySeriesDict.

filter(*args, **kwargs)

Filter each TimeSeries in the dict.

classmethod from_control(response: Any, **kwargs) TimeSeriesDict[source]

Create TimeSeriesDict from python-control TimeResponseData.

Parameters:
  • response (control.TimeResponseData) – The simulation result from python-control.

  • **kwargs (dict) – Additional arguments passed to the TimeSeries constructor.

Returns:

The converted time-domain data.

Return type:

TimeSeriesDict

classmethod from_mne(raw, *, unit_map=None)[source]

Create from mne.io.Raw.

classmethod from_pandas(df, *, unit_map=None, t0=None, dt=None)[source]

Create TimeSeriesDict from pandas.DataFrame.

classmethod from_polars(df, *, time_column='time', unit_map=None)[source]

Create TimeSeriesDict from polars.DataFrame.

gate(*args, **kwargs)

Gate each TimeSeries in the dict.

heterodyne(*args, **kwargs)

Apply heterodyne to each item.

hilbert(*args, **kwargs)

Apply Hilbert transform to each item.

histogram(*args, **kwargs)

Compute Histogram for each TimeSeries. Returns a HistogramDict.

ica(*args, **kwargs)[source]

Perform ICA decomposition across channels.

impute(*args, **kwargs)

Apply impute to each item.

instantaneous_frequency(*args, **kwargs)

Apply instantaneous_frequency to each item.

instantaneous_phase(*args, **kwargs)

Apply instantaneous_phase to each item.

is_contiguous(*args, **kwargs)[source]

Check contiguity with another object for each TimeSeries.

ktau(other, **kwargs)[source]

Compute Kendall’s tau. Vectorized via TimeSeriesMatrix.

kurtosis(**kwargs)[source]

Compute kurtosis. Vectorized via TimeSeriesMatrix.

lock_in(*args, **kwargs)[source]

Apply lock_in to each item. Returns TimeSeriesDict (if output=’complex’) or tuple of TimeSeriesDicts.

mask(*args, **kwargs)

Mask each TimeSeries in the dict.

max(**kwargs)[source]

Compute maximum. Vectorized via TimeSeriesMatrix.

mean(**kwargs)[source]

Compute mean. Vectorized via TimeSeriesMatrix.

mic(other, **kwargs)[source]

Compute MIC. Vectorized via TimeSeriesMatrix.

min(**kwargs)[source]

Compute minimum. Vectorized via TimeSeriesMatrix.

mix_down(*args, **kwargs)

Apply mix_down to each item.

notch(*args, **kwargs)

Notch filter each TimeSeries in the dict.

pca(*args, **kwargs)[source]

Perform PCA decomposition across channels.

pcc(other, **kwargs)[source]

Compute Pearson correlation. Vectorized via TimeSeriesMatrix.

plot_all(*args: Any, **kwargs: Any)[source]

Alias for plot(). Plots all series.

prepend(*args, **kwargs) TimeSeriesDict[source]

Prepend to each TimeSeries in the dict (in-place). Returns self.

psd(*args, **kwargs)

Compute PSD for each TimeSeries. Returns a FrequencySeriesDict.

q_transform(*args, **kwargs)

Compute Q-transform for each TimeSeries. Returns a SpectrogramDict.

radian(*args, **kwargs)

Compute instantaneous phase (in radians) of each item.

classmethod read(source, *args: Any, **kwargs: Any)[source]
resample(rate, **kwargs)[source]

Resample items in the TimeSeriesDict. In-place operation (updates the dict contents).

If rate is time-like, performs time-bin resampling. Otherwise performs signal processing resampling (gwpy’s native behavior).

rms(**kwargs)[source]

Compute root-mean-square. Vectorized via TimeSeriesMatrix.

rolling_max(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling max to each item.

rolling_mean(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling mean to each item.

rolling_median(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling median to each item.

rolling_min(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling min to each item.

rolling_std(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ddof=0, ignore_nan=None)[source]

Apply rolling std to each item.

shift(*args, **kwargs)

Shift each TimeSeries in the dict.

skewness(**kwargs)[source]

Compute skewness. Vectorized via TimeSeriesMatrix.

spectrogram(*args, **kwargs)

Compute spectrogram for each TimeSeries. Returns a SpectrogramDict.

spectrogram2(*args, **kwargs)

Compute spectrogram2 for each TimeSeries. Returns a SpectrogramDict.

state_segments(*args, **kwargs)[source]

Run state_segments on each item (returns Series of SegmentLists).

std(**kwargs)[source]

Compute standard deviation. Vectorized via TimeSeriesMatrix.

taper(*args, **kwargs)

Taper each TimeSeries in the dict.

to_matrix(*, align='intersection', **kwargs)[source]

Convert dictionary to TimeSeriesMatrix with alignment.

to_mne(info=None, picks=None)[source]

Convert to mne.io.RawArray.

to_pandas(index='datetime', *, copy=False)[source]

Convert to pandas.DataFrame.

to_polars(time_column='time', time_unit='datetime')[source]

Convert to polars.DataFrame.

to_tmultigraph(name: str | None = None) Any[source]

Convert to ROOT TMultiGraph.

unwrap_phase(*args, **kwargs)

Apply unwrap_phase to each item.

value_at(*args, **kwargs)[source]

Get value at a specific time for each TimeSeries.

whiten(*args, **kwargs)

Whiten each TimeSeries in the dict.

write(target: str, *args: Any, **kwargs: Any) Any[source]
zpk(*args, **kwargs)

Apply ZPK filter to each TimeSeries in the dict.

class gwexpy.timeseries.TimeSeriesList(*items: _T)[source]

Bases: PlotMixin, ListMapMixin, PhaseMethodsMixin, TimeSeriesList

List of TimeSeries objects.

asd(*args, **kwargs)

Compute ASD for each TimeSeries. Returns a FrequencySeriesList.

average_fft(*args, **kwargs)

Apply average_fft to each TimeSeries. Returns a FrequencySeriesList.

baseband(*args, **kwargs)

Apply baseband to each item.

coherence(other=None, *args, fftlength=None, overlap=None, window='hann', symmetric=True, include_diagonal=True, diagonal_value=1.0, **kwargs)[source]

Compute coherence for each element or as a matrix depending on other.

coherence_matrix(other=None, *args, fftlength=None, overlap=None, window='hann', symmetric=True, include_diagonal=True, diagonal_value=1.0, **kwargs)[source]

Compute Coherence Matrix.

Parameters:
  • other (TimeSeriesDict or TimeSeriesList, optional) – Other collection.

  • fftlength – See TimeSeries.coherence().

  • overlap – See TimeSeries.coherence().

  • window – See TimeSeries.coherence().

  • symmetric (bool, default=True) – If True and other is None, compute only upper triangle and copy to lower.

  • include_diagonal (bool, default=True) – Include diagonal.

  • diagonal_value (float or None, default=1.0) – Value to fill diagonal if include_diagonal is True. If None, compute diagonal coherence.

Return type:

FrequencySeriesMatrix

Notes

If include_diagonal is True and diagonal_value is not None, the diagonal is filled with that value without computation. If diagonal_value is None, the diagonal coherence is computed. Uncomputed elements are represented as NaN. The frequency axis is taken from the first computed element without alignment/truncation; dt and fftlength consistency is enforced before computation.

correlation(other=None, **kwargs)[source]

Compute correlation. Vectorized via TimeSeriesMatrix.

crop(start=None, end=None, copy=False) TimeSeriesList[source]

Crop each TimeSeries in the list. Accepts any time format supported by gwexpy.time.to_gps (str, datetime, pandas, obspy, etc). Returns a new TimeSeriesList.

csd(other=None, *args, fftlength=None, overlap=None, window='hann', hermitian=True, include_diagonal=True, **kwargs)[source]

Compute CSD for each element or as a matrix depending on other.

csd_matrix(other=None, *args, fftlength=None, overlap=None, window='hann', hermitian=True, include_diagonal=True, **kwargs)[source]

Compute Cross Spectral Density Matrix.

Parameters:
  • other (TimeSeriesDict or TimeSeriesList, optional) – Other collection for cross-CSD.

  • fftlength – See TimeSeries.csd() arguments.

  • overlap – See TimeSeries.csd() arguments.

  • window – See TimeSeries.csd() arguments.

  • hermitian (bool, default=True) – If True and other is None, compute only upper triangle and conjugate fill lower.

  • include_diagonal (bool, default=True) – Must be True for CSD matrices; False raises ValueError because the diagonal is always the PSD.

Return type:

FrequencySeriesMatrix

Notes

The diagonal of a self-CSD matrix is always computed as the PSD. Any uncomputed elements are represented as complex NaN. The frequency axis is taken from the first computed element without alignment/truncation; dt and fftlength consistency is enforced before computation.

decimate(*args, **kwargs)

Decimate each TimeSeries in the list.

degree(*args, **kwargs)

Compute instantaneous phase (in degrees) of each item.

detrend(*args, **kwargs)

Detrend each TimeSeries in the list.

envelope(*args, **kwargs)

Apply envelope to each item.

fft(*args, **kwargs)

Apply FFT to each TimeSeries. Returns a FrequencySeriesList.

filter(*args, **kwargs)

Filter each TimeSeries in the list.

gate(*args, **kwargs)

Gate each TimeSeries in the list.

heterodyne(*args, **kwargs)

Apply heterodyne to each item.

hilbert(*args, **kwargs)

Apply Hilbert transform to each item.

histogram(*args, **kwargs)

Compute Histogram for each TimeSeries. Returns a HistogramList.

ica(*args, **kwargs)[source]

Perform ICA decomposition across channels.

impute(*, method='interpolate', limit=None, axis='time', max_gap=None, **kwargs)[source]

Impute missing data (NaNs) in each TimeSeries.

Parameters:
  • method (str, optional) – Imputation method (‘interpolate’, ‘fill’, etc.).

  • limit (int, optional) – Maximum number of consecutive NaNs to fill.

  • axis (str, optional) – Axis to impute along.

  • max_gap (float, optional) – Maximum gap size to fill (in seconds).

  • **kwargs – Passed to TimeSeries.impute().

Return type:

TimeSeriesList

instantaneous_frequency(*args, **kwargs)

Apply instantaneous_frequency to each item.

instantaneous_phase(*args, **kwargs)

Apply instantaneous_phase to each item.

is_contiguous(*args, **kwargs)[source]

Check contiguity with another object for each TimeSeries.

kurtosis(**kwargs)[source]

Compute kurtosis. Vectorized via TimeSeriesMatrix.

lock_in(*args, **kwargs)[source]

Apply lock_in to each item.

mask(*args, **kwargs)

Mask each TimeSeries in the list.

max(**kwargs)[source]

Compute maximum. Vectorized via TimeSeriesMatrix.

mean(**kwargs)[source]

Compute mean. Vectorized via TimeSeriesMatrix.

mic(other, **kwargs)[source]

Compute MIC. Vectorized via TimeSeriesMatrix.

min(**kwargs)[source]

Compute minimum. Vectorized via TimeSeriesMatrix.

mix_down(*args, **kwargs)

Apply mix_down to each item.

notch(*args, **kwargs)

Notch filter each TimeSeries in the list.

pca(*args, **kwargs)[source]

Perform PCA decomposition across channels.

plot_all(*args: Any, **kwargs: Any)[source]

Alias for plot(). Plots all series.

psd(*args, **kwargs)

Compute PSD for each TimeSeries. Returns a FrequencySeriesList.

q_transform(*args, **kwargs)

Compute Q-transform for each TimeSeries. Returns a SpectrogramList.

radian(*args, **kwargs)

Compute instantaneous phase (in radians) of each item.

classmethod read(source, *args: Any, **kwargs: Any)[source]
resample(*args, **kwargs)

Resample each TimeSeries in the list.

rms(**kwargs)[source]

Compute root-mean-square. Vectorized via TimeSeriesMatrix.

rolling_max(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling max to each element.

rolling_mean(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling mean to each element.

rolling_median(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling median to each element.

rolling_min(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ignore_nan=None)[source]

Apply rolling min to each element.

rolling_std(window, *, center=False, min_count=1, nan_policy='omit', backend='auto', ddof=0, ignore_nan=None)[source]

Apply rolling std to each element.

shift(*args, **kwargs)

Shift each TimeSeries in the list.

skewness(**kwargs)[source]

Compute skewness. Vectorized via TimeSeriesMatrix.

spectrogram(*args, **kwargs)

Compute spectrogram for each TimeSeries. Returns a SpectrogramList.

spectrogram2(*args, **kwargs)

Compute spectrogram2 for each TimeSeries. Returns a SpectrogramList.

std(**kwargs)[source]

Compute standard deviation. Vectorized via TimeSeriesMatrix.

taper(*args, **kwargs)

Taper each TimeSeries in the list.

to_matrix(*, align='intersection', **kwargs)[source]

Convert list to TimeSeriesMatrix with alignment.

Parameters:
  • align (str, optional) – Alignment strategy (‘intersection’, ‘union’, etc.). Default ‘intersection’.

  • **kwargs – Additional arguments passed to alignment function.

Returns:

Matrix with all series aligned to common time axis.

Return type:

TimeSeriesMatrix

to_pandas(**kwargs)[source]

Convert TimeSeriesList to pandas DataFrame. Each element becomes a column. ASSUMES common time axis.

to_tmultigraph(name: str | None = None) Any[source]

Convert to ROOT TMultiGraph.

unwrap_phase(*args, **kwargs)

Apply unwrap_phase to each item.

value_at(*args, **kwargs)[source]

Get value at a specific time for each TimeSeries.

whiten(*args, **kwargs)

Whiten each TimeSeries in the list.

write(target: str, *args: Any, **kwargs: Any) Any[source]

Write TimeSeriesList to file (HDF5, ROOT, etc.).

zpk(*args, **kwargs)

ZPK filter each TimeSeries in the list.

class gwexpy.timeseries.TimeSeriesMatrix(data: Any = None, times: Any = None, dt: Any = None, t0: Any = None, sample_rate: Any = None, epoch: Any = None, **kwargs: Any)[source]

Bases: PhaseMethodsMixin, TimeSeriesMatrixCoreMixin, TimeSeriesMatrixAnalysisMixin, TimeSeriesMatrixSpectralMixin, TimeSeriesMatrixInteropMixin, SeriesMatrix

2D Matrix container for multiple TimeSeries objects sharing a common time axis.

This class represents a 2-dimensional array (rows x columns) where each element corresponds to a TimeSeries data stream. Crucially, all elements in the matrix share the same time array (same t0, dt, and number of samples). It behaves like a multivariate time series organized in a grid structure.

Provides dt, t0, times aliases and constructs FrequencySeriesMatrix via FFT.

auto_coherence(*args, **kwargs)

Apply univariate spectral method TimeSeries.auto_coherence element-wise.

Computes the auto_coherence for each entry in the matrix, returning a FrequencySeriesMatrix containing the results.

bandpass(*args, **kwargs)

Apply TimeSeries.bandpass element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

coherence(other, *args, **kwargs)

Apply TimeSeries.coherence element-wise with another TimeSeries object.

This method delegates the bivariate call to each TimeSeries in the matrix, using the provided other object as the second operand.

csd(other, *args, **kwargs)

Apply TimeSeries.csd element-wise with another TimeSeries object.

This method delegates the bivariate call to each TimeSeries in the matrix, using the provided other object as the second operand.

default_xunit = 's'
default_yunit: str | u.Unit | None = None
detrend(*args, **kwargs)

Apply TimeSeries.detrend element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

dict_class

alias of TimeSeriesDict

filter(*args, **kwargs)

Apply TimeSeries.filter element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

highpass(*args, **kwargs)

Apply TimeSeries.highpass element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

list_class

alias of TimeSeriesList

lowpass(*args, **kwargs)

Apply TimeSeries.lowpass element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

notch(*args, **kwargs)

Apply TimeSeries.notch element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

resample(*args, **kwargs)

Apply TimeSeries.resample element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

series_class

alias of TimeSeries

series_type = 'time'
taper(*args, **kwargs)

Apply TimeSeries.taper element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

transfer_function(other, *args, **kwargs)

Apply TimeSeries.transfer_function element-wise with another TimeSeries object.

This method delegates the bivariate call to each TimeSeries in the matrix, using the provided other object as the second operand.

whiten(*args, **kwargs)

Apply TimeSeries.whiten element-wise to all entries in the matrix.

This method delegates the call to the underlying TimeSeries objects, preserving the matrix structure and per-element metadata while updating the data values and time axis according to the operation.

meta: MetaDataMatrix
rows: MetaDataDict
cols: MetaDataDict
name: str | None
epoch: float | int | None
attrs: dict[str, Any] | None
unit: u.Unit | None
class gwexpy.timeseries.Transform[source]

Bases: object

Minimal transform interface for TimeSeries-like objects.

fit(x)[source]

Fit the transform to the data. Returns self.

fit_transform(x)[source]

Fit and transform in one step.

inverse_transform(y)[source]

Reverse the transform. Not all transforms support this.

supports_inverse = False
transform(x)[source]

Apply the transform to data. Must be implemented by subclasses.

class gwexpy.timeseries.Pipeline(steps: Sequence[tuple[str, Transform]])[source]

Bases: object

Sequentially apply a list of transforms.

fit(x)[source]

Fit all transforms in sequence.

fit_transform(x)[source]

Fit and transform in one step.

inverse_transform(y, *, strict: bool = True)[source]

Apply inverse transforms in reverse order.

Parameters:
  • y (data) – Transformed data.

  • strict (bool, optional) – If True, raise error if any step doesn’t support inverse.

transform(x)[source]

Apply all transforms in sequence.

class gwexpy.timeseries.ImputeTransform(method: str = 'interpolate', **kwargs)[source]

Bases: Transform

Impute missing values using existing lower-level helpers.

transform(x)[source]

Apply imputation to TimeSeries, Matrix, or Collections.

class gwexpy.timeseries.StandardizeTransform(method: str = 'zscore', ddof: int = 0, robust: bool = False, axis: str = 'time', *, multivariate: bool = False, align: str = 'intersection')[source]

Bases: Transform

Standardize TimeSeries/Matrix objects with optional robust scaling.

fit(x)[source]

Fit standardization parameters (center, scale) for the input data.

inverse_transform(y)[source]

Reverse standardization transformation.

supports_inverse = True
transform(x)[source]

Apply standardization using fitted parameters.

params: dict[str, Any] | None
class gwexpy.timeseries.WhitenTransform(method: Literal['pca', 'zca'] = 'pca', eps: float = 1e-12, n_components: int | None = None, *, multivariate: bool = True, align: str = 'intersection')[source]

Bases: Transform

Whitening using PCA or ZCA on TimeSeriesMatrix-like data.

fit(x)[source]

Fit whitening parameters for the input data.

inverse_transform(y)[source]

Reverse whitening transformation.

supports_inverse = True
transform(x)[source]

Apply whitening transform.

model: WhiteningModel | None
class gwexpy.timeseries.PCATransform(n_components: int | None = None, *, multivariate: bool = True, align: str = 'intersection', **kwargs)[source]

Bases: Transform

PCA wrapper using existing decomposition helpers.

fit(x)[source]

Fit PCA model for the input data.

inverse_transform(y)[source]

Reverse PCA transformation (reconstruct from scores).

supports_inverse = True
transform(x)[source]

Apply PCA transformation (project to scores).

class gwexpy.timeseries.ICATransform(n_components: int | None = None, *, multivariate: bool = True, align: str = 'intersection', **kwargs)[source]

Bases: Transform

ICA wrapper using existing decomposition helpers.

fit(x)[source]

Fit ICA model for the input data.

inverse_transform(y)[source]

Reverse ICA transformation (reconstruct from sources).

supports_inverse = True
transform(x)[source]

Apply ICA transformation (project to sources).