Package topo :: Package misc :: Module trace :: Class DataRecorder
[hide private]
[frames] | no frames]

Class DataRecorder

source code


Record time-series data from a simulation.

A DataRecorder instance stores a set of named time-series variables, consisting of a sequence of recorded data items of any type, along with the times at which they were recorded.

DataRecorder is an abstract class for which different implementations may exist for different means of storing recorded data. For example, the subclass InMemoryRecorder stores all the data in memory.

A DataRecorder instance can operate either as an event processor, or in a stand-alone mode. Both usage modes can be used on the same instance in the same simulation.

STAND-ALONE USAGE:

A DataRecorder instance is used as follows:

EVENTPROCESSOR USAGE:

A DataRecorder can also be connected to a simulation as an event processor, forming a kind of virtual recording equipment. An output port from any event processor in a simulation can be connected to a DataRecorder; the recorder will automaticall create a variable with the same name as the connection, and record any incoming data on that variable with the time it was received. For example:

topo.sim['Recorder'] =  InMemoryRecorder()
topo.sim.connect('V1','Recorder',name='V1 Activity')

This script snippet will create a new DataRecorder and automatically record all activity sent from the sheet 'V1'.

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
__init__(self, **params)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_src_connect(self, conn)
Add the specified connection to the list of outgoing connections.
source code
 
_dest_connect(self, conn)
Add the specified connection to the list of incoming connections.
source code
 
input_event(self, conn, data)
Called by the simulation when an EPConnectionEvent is delivered; the EventProcessor should process the data somehow.
source code
 
add_variable(self, name)
Create a new time-series variable with the given name.
source code
 
record_data(self, varname, time, data)
Record the given data item with the given timestamp in the named timeseries.
source code
 
get_data(self, varname, times=(None, None), fill_range=False)
Get the named timeseries between the given times (inclusive).
source code
 
get_times(self, var)
Get all the timestamps for a given variable.
source code
 
get_time_indices(self, varname, start_time, end_time)
For the named variable, get the start and end indices suitable for slicing the data to include all times t::
source code

Inherited from base.simulation.EventProcessor: process_current_time, script_repr, send_output, start

Inherited from base.simulation.EventProcessor (private): _port_match

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, set_default, set_dynamic_time_fn, set_param, state_pop, state_push, verbose, warning

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  __abstract = True
bool(x) -> bool
  name = <param.parameterized.String object at 0xc0dfdec>
String identifier for this object.

Inherited from base.simulation.EventProcessor: dest_ports, src_ports

Inherited from param.parameterized.Parameterized: print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **params)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

_src_connect(self, conn)

source code 
Add the specified connection to the list of outgoing connections. Should only be called from Simulation.connect().
Overrides: base.simulation.EventProcessor._src_connect
(inherited documentation)

_dest_connect(self, conn)

source code 
Add the specified connection to the list of incoming connections. Should only be called from Simulation.connect().
Overrides: base.simulation.EventProcessor._dest_connect
(inherited documentation)

input_event(self, conn, data)

source code 
Called by the simulation when an EPConnectionEvent is delivered; the EventProcessor should process the data somehow.
Overrides: base.simulation.EventProcessor.input_event
(inherited documentation)

get_data(self, varname, times=(None, None), fill_range=False)

source code 

Get the named timeseries between the given times (inclusive). If fill_range is true, the returned data will have timepoints exactly at the start and end of the given timerange. The data values at these timepoints will be those of the next-earlier datapoint in the series.

(NOTE: fill_range can fail to create a beginning timepoint if the start of the time range is earlier than the first recorded datapoint.]

get_time_indices(self, varname, start_time, end_time)

source code 

For the named variable, get the start and end indices suitable
for slicing the data to include all times t::

  start_time <= t <= end_time.

A start_ or end_time of None is interpreted to mean the
earliest or latest available time, respectively.


Class Variable Details [hide private]

__abstract

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

Value:
True