Inheritance diagram for nitime.timeseries:
Base classes for generic time series analysis.
The classes implemented here are meant to provide fairly basic objects for managing time series data. They should serve mainly as data containers, with only minimal algorithmic functionality.
In the timeseries subpackage, there is a separate library of algorithms, and the classes defined here mostly delegate any computational facilities they may have to that library.
Over time, it is OK to add increasingly functionally rich classes, but only after their design is well proven in real-world use.
Bases: nitime.descriptors.ResetMixin
Represents a time interval
Parameters : | t0 : 1-d array or TimeArray
stop : 1-d array or TimeArray
offset : float, int or singleton TimeArray
start : 1-d array or TimeArray
duration : 1-d array or TimeArray
time_unit : str, optional
static : dict, optional
|
---|
Duration array for the epoch
Bases: nitime.timeseries.TimeInterface
Represents timestamps and associated data
Parameters : | time : array or TimeArray
labels : array, optional indices : int array, optional |
---|
Bases: float
A class for representation of the frequency (in Hz)
x.__init__(...) initializes x; see help(type(x)) for signature
Convert the value of a frequency to the corresponding period (defaulting to a representation in the base_unit)
Bases: numpy.ndarray, nitime.timeseries.TimeInterface
Base-class for time representations, implementing the TimeInterface
x.__init__(...) initializes x; see help(type(x)) for signature
Returns the values of the TimeArray object at time t
Convert from one time unit to another in place
Returns the values of the TimeArray object during Epoch e
Returns the integer indices that corresponds to the time t
The returned indices depend on both tol and mode. The tol parameter specifies how close the given time must be to those present in the array to give a match, when mode is closest. The default tolerance is 1 base_unit (by default, picoseconds). If you specify the tolerance as 0, then only exact matches are allowed, be careful in this case of possible problems due to floating point roundoff error in your time specification.
When mode is before or after, the tolerance is completely ignored. In this case, either the largest time equal or before the given t or the earliest time equal or after the given t is returned.
Parameters : | t : time-like
tol : time-like, optional
mode : string
|
---|---|
Returns : | idx : The array with all the indices where the condition is met. |
Returns the maximal time
Returns the slice that corresponds to Epoch e
Returns the standard deviation of this TimeArray (with time units)
for detailed information, see numpy.std()
Bases: nitime.timeseries.TimeSeriesBase
Represent data collected at uniform intervals.
Create a new TimeSeries.
This class assumes that data is uniformly sampled, but you can specify the sampling in one of three (mutually exclusive) ways:
Parameters : | data : array_like
sampling_interval : float
sampling_rate : float
t0 : float
time :
time_unit : string
|
---|
Examples
The minimal specification of data and sampling interval:
>>> ts = TimeSeries([1,2,3],sampling_interval=0.25)
>>> ts.time
UniformTime([ 0. , 0.25, 0.5 ], time_unit='s')
>>> ts.t0
0.0 s
>>> ts.sampling_rate
4.0 Hz
Or data and sampling rate:
>>> ts = TimeSeries([1,2,3],sampling_rate=2)
>>> ts.time
UniformTime([ 0. , 0.5, 1. ], time_unit='s')
>>> ts.t0
0.0 s
>>> ts.sampling_interval
0.5 s
A time series where we specify the start time and sampling interval:
>>> ts = TimeSeries([1,2,3],t0=4.25,sampling_interval=0.5)
>>> ts.data
array([1, 2, 3])
>>> ts.time
UniformTime([ 4.25, 4.75, 5.25], time_unit='s')
>>> ts.t0
4.25 s
>>> ts.sampling_interval
0.5 s
>>> ts.sampling_rate
2.0 Hz
>>> ts = TimeSeries([1,2,3],t0=4.25,sampling_rate=2.0)
>>> ts.data
array([1, 2, 3])
>>> ts.time
UniformTime([ 4.25, 4.75, 5.25], time_unit='s')
>>> ts.t0
4.25 s
>>> ts.sampling_interval
0.5 s
>>> ts.sampling_rate
2.0 Hz
Returns the values of the TimeArray object at time t
Returns the TimeSeries slice corresponding to epoch e
Construct time array for the time-series object. This holds a UniformTime object, with properties derived from the TimeSeries object
Bases: nitime.timeseries.TimeInterface
The minimally agreed upon interface for all time series.
This should be thought of as an abstract base class.
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: numpy.ndarray, nitime.timeseries.TimeInterface
A representation of time sampled uniformly
x.__init__(...) initializes x; see help(type(x)) for signature
Returns the values of the UniformTime object at time t
Returns the values of the UniformTime object during Epoch e
Find the index that corresponds to the time bin containing t
Returns boolean mask if boolean=True and integer indices otherwise.
Returns the maximal time
Returns the minimal time
Returns the slice that corresponds to Epoch e
Concatenates a sequence of time-series objects in time.
The input can be any iterable of time-series objects; metadata, sampling rates and other attributes are kept from the last one in the sequence.
This one requires that all the time-series in the list have the same sampling rate and that all the data have the same number of items in all dimensions, except the time dimension
Extract the time unit of the object. If it is an iterable, get the time unit of the first element.
Turn a single tspec into human readable form
Given a set of valid_tspecs, return a string that turns them into human-readable form