The Virtual Brain Project

Previous topic

Phase-Plane Interactive

Next topic

Timeseries Interactive

This Page

Power-Spectra Interactive

Class diagram for tvb.simulator.power_spectra_interactive

An interactive power spectra 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

#Create and launch the interactive visualiser
import tvb.simulator.power_spectra_interactive as ps_int
psi = ps_int.PowerSpectraInteractive(time_series=tsr)
psi.show()
class tvb.simulator.plot.power_spectra_interactive.PowerSpectraInteractive(**kwargs)[source]

The graphical interface for visualising the power-spectra (FFT) of a timeseries provide controls for setting:

  • which state-variable and mode to display [sets]
  • log or linear scaling for the power or frequency axis [binary]
  • sementation lenth [set]
  • windowing function [set]
  • power normalisation [binary] (emphasise relative frequency contribution)
  • show std or sem [binary]
time_series : tvb.simulator.plot.power_spectra_interactive.PowerSpectraInteractive.time_series = Attr(field_type=<class ‘tvb.datatypes.time_series.TimeSeries’>, default=None, required=True)
The timeseries to which the FFT is to be applied.
first_n : tvb.simulator.plot.power_spectra_interactive.PowerSpectraInteractive.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_mode_selector()[source]

Add a radio button to the figure for selecting which mode of the model should be displayed.

add_normalise_power_selector()[source]

Add a radio button to chose whether or not the power of all spectra shouold be normalised to 1.

add_variable_selector()[source]

Generate radio selector buttons to set which state variable is displayed.

add_window_function_selector()[source]

Generate radio selector buttons to set the windowing function.

add_window_length_selector()[source]

Generate radio selector buttons to set the window length is seconds.

add_xscale_selector()[source]

Add a radio button to the figure for selecting which scaling the x-axes should use.

add_yscale_selector()[source]

Add a radio button to the figure for selecting which scaling the y-axes should use.

calc_fft()[source]

Calculate FFT using current state of the window_length, window_function,

configure()[source]

Seperate configure cause ttraits be busted...

create_figure()[source]

Create the figure and time-series axes.

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

plot_spectra()[source]

Plot the power spectra.

show()[source]

Generate the interactive power-spectra figure.

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_mode(mode)[source]

Update the visualised mode based on radio button selection.

update_normalise_power(normalise_power)[source]

Update whether to normalise based on radio button selection.

update_spectra()[source]

Clear the axes and redraw the power-spectra.

update_variable(variable)[source]

Update state variable being plotted based on radio buttton selection.

update_window_function(window_function)[source]

Update windowing function based on the radio button selection.

update_window_length(length)[source]

Update timeseries window length based on the selected value.

update_xscale(xscale)[source]

Update the FFT axes’ xscale to either log or linear based on radio button selection.

update_yscale(yscale)[source]

Update the FFT axes’ yscale to either log or linear based on radio button selection.