TimeSeries
- class TimeSeries(amplitude, dt_in_seconds)
- __init__(amplitude, dt_in_seconds)
Initialize a
TimeSeriesobject.- Parameters:
amplitude (iterable) – Amplitude of the time series at each time step.
dt_in_seconds (float) – Time step between samples in seconds.
- Returns:
TimeSeries – Instantiated with amplitude and time step information.
- Raises:
TypeError – If
amplitudeis not castable tondarray, refer to error message(s) for specific details.
- butterworth_filter(fcs_in_hz, order=5)
Apply Butterworth filter.
- Parameters:
fcs_in_hz (tuple) – Butterworth filter’s corner frequencies in Hz.
Nonecan be used to specify a one-sided filter. For example a high pass filter at 3 Hz would be specified asfcs_in_hz=(3, None).order (int, optional) – Butterworth filter order, default is
5.
- Returns:
None – Filters
amplitudeattribute in-place.
- detrend(type='linear')
Remove trend from
TimeSeries.- Parameters:
type = {“constant”, “linear”}, optional – Type of detrend. If
type == "linear"(default), the result of a linear least-squares fit to data is subtracted from data. Iftype == "constant", only the mean of data is subtracted.- Returns:
None – Performs inplace detrend on the
amplitudeattribute.
- classmethod from_timeseries(timeseries)
Copy constructor for
TimeSeriesobject.- Parameters:
timeseries (TimeSeries) –
TimeSeriesto be copied.- Returns:
TimeSeries – Copy of the provided
TimeSeriesobject.
- classmethod from_trace(trace)
Initialize a
TimeSeriesobject fromobspyTrace.
- is_similar(other)
Check if
otheris similar toself.
- split(window_length_in_seconds)
Split record into set of records.
- Parameters:
window_length_in_seconds (float) – Duration of each split in seconds.
- Returns:
list – List of
TimeSeriesobjects, one per split.
Notes
The last sample of each window is repeated as the first sample of the following time window to ensure an intuitive number of windows. Without this, for example, a 10-minute record could not be broken into 10, 1-minute records.
- trim(start_time, end_time)
Trim in the interval
[start_time, end_time].- Parameters:
start_time (float) – New time zero in seconds.
end_time (float) – New end time in seconds.
- Returns:
None – Updates the attributes
amplitudeandn_samples.- Raises:
IndexError – If the
start_timeand/orend_timeis illogical. Checks includestart_timeis less than zero,start_timeis afterend_time, orend_timeis after the end of the record.
- window(type='tukey', width=0.1)
Apply window to time series.
- Parameters:
width ({0.-1.}) – Fraction of the time series to be windowed.
type ({“tukey”}, optional) – If
type="tukey", a width of0is a rectangular window and1is a Hann window, default is0.1indicating a 5% taper off of both ends of the time series.
- Returns:
None – Applies window to the
amplitudeattribute in-place.