Timeseries Interactive
An interactive time-series plot generated from a TVB TimeSeries datatype.
Usage
#Load the demo data
import numpy
data = numpy.load("demos/demo_data_region_16s_2048Hz.npy")
period = 0.00048828125 #NOTE: Providing period in seconds
#Create a tvb TimeSeries object
import tvb.datatypes.time_series
tsr = tvb.datatypes.time_series.TimeSeriesRegion()
tsr.data = data
tsr.sample_period = period
from tvb.datatypes.connectivity import Connectivity
tsr.connectivity = Connectivity.from_file()
#Create and launch the interactive visualiser
import tvb.simulator.plot.timeseries_interactive as ts_int
tsi = ts_int.TimeSeriesInteractive(time_series=tsr)
tsi.configure()
tsi.show()
-
class tvb.simulator.plot.timeseries_interactive.TimeSeriesInteractive(**kwargs)[source]
For generating an interactive time-series figure, given one of TVB’s
TimeSeries datatypes to initialise it. The graphical interface for
visualising a timeseries provides controls for setting:
- Window length
- Amplitude scaling
- Stepping forward/backward through time.
- time_series : tvb.simulator.plot.timeseries_interactive.TimeSeriesInteractive.time_series = Attr(field_type=<class ‘tvb.datatypes.time_series.TimeSeries’>, default=None, required=True)
- The TVB TimeSeries datatype to be displayed.
- first_n : tvb.simulator.plot.timeseries_interactive.TimeSeriesInteractive.first_n = Int(field_type=<class ‘int’>, default=-1, required=True)
- Primarily intended for displaying the first N components of a
surface PCA timeseries. Defaults to -1, meaning it’ll display all
of ‘space’ (ie, regions or vertices or channels). In other words,
for Region or M/EEG timeseries you can ignore this, but, for a
surface timeseries it really must be set.
gid : tvb.basic.neotraits._core.HasTraits.gid = Attr(field_type=<class ‘uuid.UUID’>, default=None, required=True)
-
add_big_step_back_button()[source]
Add a button to step back by 1/4 window_length.
-
add_big_step_forward_button()[source]
Add a button to step forward by 1/4 window_length.
-
add_end_button()[source]
Add a button to jump forward to the end of the timeseries.
-
add_scaling_slider()[source]
Add a slider to allow scaling of the offset of time-series.
-
add_start_button()[source]
Add a button to jump back to the start of the timeseries.
-
add_step_back_button()[source]
Add a button to step back by 4 view_steps.
-
add_step_forward_button()[source]
Add a button to step forward by 4 view_steps.
-
add_window_length_slider()[source]
Add a slider to allow the time-series window length to be adjusted.
-
bigstep_back(event=None)[source]
Step the timeview back by 1/4 window length.
-
bigstep_forward(event=None)[source]
Step the timeview forward by 1/4 window length.
-
configure()[source]
Seperate configure cause ttraits be busted...
-
create_figure()[source]
Create the figure and time-series axes.
-
ensure_list(arg)[source]
-
first_n
Declares an integer
This is different from Attr(field_type=int).
The former enforces int subtypes
This allows all integer types, including numpy ones that can be safely cast to the declared type
according to numpy rules
-
jump_to_end(event=None)[source]
Jump to the end of the timeseries.
-
jump_to_start(event=None)[source]
Jump to the start of the timeseries.
-
plot_time_series(**kwargs)[source]
Plot a view on the timeseries.
-
rotate_n_list_elements(lst, n)[source]
-
show(block=True, **kwargs)[source]
Generate the interactive time-series figure.
-
step_back(event=None)[source]
Step the timeview back by a single view step.
-
step_forward(event=None)[source]
Step the timeview forward by a single view step.
-
time_series
An Attr declares the following about the attribute it describes:
* the type
* a default value shared by all instances
* if the value might be missing
* documentation
It will resolve to attributes on the instance.
-
update_scaling(scaling)[source]
Update timeseries scaling based on the scaling slider value.
-
update_time_series()[source]
Clear the axes and redraw the time-series.
-
update_time_view()[source]
Update the time_view when window length is changed.
-
update_window_length(length)[source]
Update timeseries window length based on the time window slider value.
-
class tvb.simulator.plot.timeseries_interactive.TimeSeriesInteractivePlotter(**kwargs)[source]
- time_series : tvb.simulator.plot.timeseries_interactive.TimeSeriesInteractive.time_series = Attr(field_type=<class ‘tvb.datatypes.time_series.TimeSeries’>, default=None, required=True)
- The TVB TimeSeries datatype to be displayed.
- first_n : tvb.simulator.plot.timeseries_interactive.TimeSeriesInteractive.first_n = Int(field_type=<class ‘int’>, default=-1, required=True)
- Primarily intended for displaying the first N components of a
surface PCA timeseries. Defaults to -1, meaning it’ll display all
of ‘space’ (ie, regions or vertices or channels). In other words,
for Region or M/EEG timeseries you can ignore this, but, for a
surface timeseries it really must be set.
gid : tvb.basic.neotraits._core.HasTraits.gid = Attr(field_type=<class ‘uuid.UUID’>, default=None, required=True)
-
create_figure(**kwargs)[source]
Create the figure and time-series axes.
-
plot_time_series(**kwargs)[source]
Plot a view on the timeseries.
-
show(block=True, **kwargs)[source]
Generate the interactive time-series figure.