time_series¶
Module: resources.data_types.time_series
¶
2d array of channels x time series for windowed time series
Inheritance diagram for pySPACE.resources.data_types.time_series
:
TimeSeries
¶
-
class
pySPACE.resources.data_types.time_series.
TimeSeries
[source]¶ Bases:
pySPACE.resources.data_types.base.BaseData
Time Series object
Represents a finite length time series consisting (potentially) of several channels. Objects of this type are called “windows”, “epochs”, or “trials” in other contexts. Normally one channel corresponds to one sensor.
The time series object is a 2d array of channels times time series amplitudes (mandatory first argument in constructor) with some additional properties. The additional properties are:
- channel_names (mandatory second argument in constructor,
- list of stings without underscores)
- sampling_frequency (mandatory third argument in constructor,
- e.g., 5000.0 for 5kHz)
- start_time (optional)
- end_time (optional)
- marker_name (the name of the marker used to create this object,
- dictionary of included marker names and time stamps, optional)
- name & tag (text format of object meta info, optional)
Channels can also be pseudo channels after spatial filtering.
When creating a TimSeries object, first the array has to be given to the init function and then the other parameters/properties as keyword arguments. The array can be specified as two dimensional numpy array or in list notation. The channels are on the second axes. For example using the list
[[1,2,3],[4,5,6]]
would result in three channels and two time points.For accessing the array only without the meta information, please use the command
x = data.view(numpy.ndarray)
which hides this information.
TimeSeries objects are normally organized/collected in a
TimeSeriesDataset
. This type of dataset can be also used to generate the objects, e.g., from csv files. For data access in a node chain, data is loaded with a node from thetime_series_source
module as first node and saved with theTimeSeriesSinkNode
as the last node. It is also possible to create time series data from not segmented data streams as described in theStreamDataset
.Author: Jan Hendrik Metzen (jhm@informatik.uni-bremen.de) Created: 2008/03/05 Completely Refactored: 2008/08/18 BaseData compatibility: David Feess, 2010/09/27 Class Components Summary
__array_finalize__
(obj)__eq__
(other)Same channels (names) and values __new__
(subtype, input_array, channel_names, ...)__reduce__
()__setstate__
(state)__str__
()_generate_tag
(obj)generate new tag based on time series attributes start_time, _ms_to_samples
(ms)_samples_to_ms
(samples)channel_names
The channel_names property. channel_names_dict
del_channel_names
()get_channel
(channel_name)Return the values of the channel with name channel_name get_channel_names
()reorder
(ordered_channel_list)Reorder TimeSeries according to ordered_channel_list replace_data
(old, data, \*\*kwargs)Create a new time series with the given data but the old metadata. set_channel_names
(channel_names)-
static
__new__
(subtype, input_array, channel_names, sampling_frequency, start_time=None, end_time=None, name=None, marker_name=None, tag=None)[source]¶
-
static
_generate_tag
(obj)[source]¶ generate new tag based on time series attributes start_time, end_time and name. The name is usually a sentence, with the last word indicating the class.
-
channel_names_dict
= {-1684757122889711625: ['C3', 'C4']}¶
-
channel_names
¶ The channel_names property.
-
static
replace_data
(old, data, **kwargs)[source]¶ Create a new time series with the given data but the old metadata.
A factory method which creates a time series object with the given data and the metadata from the old time_series