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:

Inheritance diagram of pySPACE.resources.data_types.time_series


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 the time_series_source module as first node and saved with the TimeSeriesSinkNode as the last node. It is also possible to create time series data from not segmented data streams as described in the StreamDataset.

Author:Jan Hendrik Metzen (jhm@informatik.uni-bremen.de)
Completely Refactored:
BaseData compatibility:
 David Feess, 2010/09/27

Class Components Summary

__eq__(other) Same channels (names) and values
__new__(subtype, input_array, channel_names, ...)
_generate_tag(obj) generate new tag based on time series attributes start_time,
channel_names The channel_names property.
get_channel(channel_name) Return the values of the channel with name channel_name
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.
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']}

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


Return the values of the channel with name channel_name


Reorder TimeSeries according to ordered_channel_list

This function takes the list given as argument as list of channel names, orders the given TimeSeries object according to this list and returns a reordered TimeSeries object.


Same channels (names) and values