spatial Package

base_spatio_temporal_controller

class tvb.interfaces.web.controllers.spatial.base_spatio_temporal_controller.SpatioTemporalController[source]

Bases: BaseController

Base class which contains methods related to spatio-temporal actions.

MSG_MISSING_SURFACE = 'There is no surface in the current project. Please upload a CORTICAL one to continue!'
static display_surface(surface_gid, region_mapping_gid=None)[source]

Generates the HTML for displaying the surface with the given ID.

fill_default_attributes(template_dictionary, subsection='stimulus')[source]

Overwrite base controller to add required parameters for adapter templates.

static get_series_json(data, label)[source]

For each data point entry, build the FLOT specific JSON.

static get_ui_message(list_of_equation_names)[source]

The message returned by this method should be displayed if the equation with the given name couldn’t be evaluated in all points.

get_x_axis_range(min_x_str, max_x_str)[source]

Fill range for the X-axis displayed in 2D graph.

index(**data)[source]

Displays the main page for the spatio temporal section.

render_spatial_form(adapter_form)[source]

local_connectivity_controller

class tvb.interfaces.web.controllers.spatial.local_connectivity_controller.LocalConnectivityController[source]

Bases: SpatioTemporalController

Controller layer for displaying/creating a LocalConnectivity entity.

CUTOFF_FIELD = 'set_cutoff_value'
DISPLAY_NAME_FIELD = 'set_display_name'
EQUATION_FIELD = 'set_equation'
EQUATION_PARAMS_FIELD = 'set_equation_param'
SURFACE_FIELD = 'set_surface'
base_url = '/spatial/localconnectivity'
compute_data_for_gradient_view(local_connectivity_gid, selected_triangle)[source]

When the user loads an existent local connectivity and he picks a vertex from the used surface, this method computes the data needed for drawing a gradient view corresponding to that vertex.

Returns a json which contains the data needed for drawing a gradient view for the selected vertex.

create_local_connectivity(**kwargs)[source]

Used for creating and storing a local connectivity.

fill_default_attributes(template_dictionary)[source]

Overwrite base controller to add required parameters for adapter templates.

get_equation_chart()[source]

Returns the html which contains the plot with the equations specified into ‘plotted_equations_prefixes’ field.

static get_series_json(ideal_case, average_case, worst_case, best_case, vertical_line)[source]

Gather all the separate data arrays into a single flot series.

load_local_connectivity(local_connectivity_gid, from_step=None)[source]

Loads an existing local connectivity.

reset_local_connectivity(from_step)[source]

Reset the context and reset to the first step. This method is called when the None entry is selected from the select. :param from_step: is not used in local connectivity case since we don’t want to remain in step 2 in case none was selected. We are keeping it so far to remain compatible with the stimulus pages.

set_cutoff_value(**param)[source]
set_display_name(**param)[source]
set_equation_param(**param)[source]
set_surface(**param)[source]
step_1(do_reset=0, **kwargs)[source]

Generate the html for the first step of the local connectivity page. :param do_reset: Boolean telling to start from empty page or not :param kwargs: not actually used, but parameters are still submitted from UI since we just use the same js function for this.

step_2(**kwargs)[source]

Generate the html for the second step of the local connectivity page. :param kwargs: not actually used, but parameters are still submitted from UI since we just use the same js function for this.

region_stimulus_controller

class tvb.interfaces.web.controllers.spatial.region_stimulus_controller.RegionStimulusController[source]

Bases: SpatioTemporalController

Control layer for defining Stimulus entities on Regions.

CONNECTIVITY_FIELD = 'set_connectivity'
DISPLAY_NAME_FIELD = 'set_display_name'
MSG_MISSING_CONNECTIVITY = 'There is no structural Connectivity in the current project. Please upload one to continue!'
TEMPORAL_FIELD = 'set_temporal'
TEMPORAL_PARAMS_FIELD = 'set_temporal_param'
base_url = '/spatial/stimulus/region'
create_stimulus()[source]

Creates a stimulus from the given data.

static display_connectivity(connectivity_gid)[source]

Generates the html for displaying the connectivity matrix.

do_step(step_idx, from_step=None)[source]

Go to the step given by :param step_idx. In case the next step is the create one (3), we want to remain on the same step as before so that is handled differently depending on the :param from_step.

fill_default_attributes(template_dictionary)[source]

Overwrite base controller to add required parameters for adapter templates.

get_equation_chart(**form_data)[source]

Returns the html which contains the plot with the temporal equation.

load_region_stimulus(region_stimulus_gid, from_step=None)[source]

Loads the interface for the selected region stimulus.

reset_region_stimulus(from_step)[source]

Just reload default data as if stimulus is None.

from_step

not actually used here since when the user selects None from the stimulus entities select we want to take him back to step 1 always. Kept just for compatibility with the normal load entity of a stimulus where we want to stay in the same page.

set_connectivity(**param)[source]
set_display_name(**param)[source]
set_temporal_param(**param)[source]
step_1()[source]

Generate the required template dictionary for the first step.

step_1_submit(next_step, do_reset=0, **kwargs)[source]

Any submit from the first step should be handled here. Update the context then go to the next step as required. In case a reset is needed create a clear context.

step_2()[source]

Generate the required template dictionary for the second step.

step_2_submit(next_step, **kwargs)[source]

Any submit from the second step should be handled here. Update the context and then do the next step as required.

update_scaling(**kwargs)[source]

Update the scaling according to the UI.

surface_model_parameters_controller

class tvb.interfaces.web.controllers.spatial.surface_model_parameters_controller.SurfaceModelParametersController[source]

Bases: SpatioTemporalController

Control for defining parameters of a model in a visual manner. Here we focus on model-parameters spread over a brain surface.

EQUATION_FIELD = 'set_equation'
EQUATION_PARAMS_FIELD = 'set_equation_param'
MODEL_PARAM_FIELD = 'set_model_parameter'
apply_equation(**kwargs)[source]

Applies an equations for computing a model parameter.

apply_focal_point(model_param, triangle_index)[source]

Adds the given focal point to the list of focal points specified for the equation used for computing the values for the specified model param.

base_url = '/spatial/modelparameters/surface'
edit_model_parameters()[source]

Main method, to initialize Model-Parameter visual-set.

fill_default_attributes(template_dictionary)[source]

Overwrite base controller to add required parameters for adapter templates.

get_data_from_burst_configuration()[source]

Returns the model and surface instances from the burst configuration.

get_equation_chart(**form_data)[source]

Returns the html which contains the plot with the equation selected by the user for a certain model param.

get_focal_points(model_param)[source]

Returns the html which displays the list of focal points selected for the equation used for computing the values for the given model parameter.

remove_focal_point(model_param, vertex_index)[source]

Removes the given focal point from the list of focal points specified for the equation used for computing the values for the specified model param.

set_equation_param(**param)[source]
set_model_parameter(model_parameter)[source]
submit_model_parameters(submit_action='cancel_action')[source]

Collects the model parameters values from all the models used for the surface vertices. @:param submit_action: a post parameter. It distinguishes if this request is a cancel or a submit

surface_stimulus_controller

class tvb.interfaces.web.controllers.spatial.surface_stimulus_controller.SurfaceStimulusController[source]

Bases: SpatioTemporalController

Control layer for defining Stimulus entities on a cortical surface.

DISPLAY_NAME_FIELD = 'set_display_name'
SPATIAL_FIELD = 'set_spatial'
SPATIAL_PARAMS_FIELD = 'set_spatial_param'
SURFACE_FIELD = 'set_surface'
TEMPORAL_FIELD = 'set_temporal'
TEMPORAL_PARAMS_FIELD = 'set_temporal_param'
base_url = '/spatial/stimulus/surface'
create_stimulus()[source]

Creates a stimulus from the given data.

do_step(step_idx, from_step=None)[source]

Go to the step given by :param step_idx. In case the next step is the create one (3), we want to remain on the same step as before so that is handled differently depending on the :param from_step.

fill_default_attributes(template_specification)[source]

Add some entries that are used in both steps then fill the default required attributes.

get_spatial_equation_chart(**form_data)[source]

Returns the HTML which contains the chart in which is plotted the spatial equation.

get_stimulus_chunk(chunk_idx)[source]

Get the next chunk of the stimulus data.

get_temporal_equation_chart(**form_data)[source]

Returns the HTML which contains the chart in which is plotted the temporal equation.

load_surface_stimulus(surface_stimulus_gid, from_step)[source]

Loads the interface for the selected surface stimulus.

reload_default(from_step)[source]

Just reload default data as if stimulus is None.

from_step:

not actually used here since when the user selects None from the stimulus entities select we want to take him back to step 1 always. Kept just for compatibility with the normal load entity of a stimulus where we want to stay in the same page.

set_display_name(**param)[source]
set_spatial_param(**param)[source]
set_surface(**param)[source]
set_temporal_param(**param)[source]
step_1()[source]

Used for generating the interface which allows the user to define a stimulus.

step_1_submit(next_step, do_reset=0, **kwargs)[source]

Any submit from the first step should be handled here. Update the context then go to the next step as required. In case a reset is needed create a clear context.

step_2()[source]

Used for generating the interface which allows the user to define a stimulus.

step_2_submit(next_step, **kwargs)[source]

Any submit from the second step should be handled here. Update the context and then do the next step as required.

view_stimulus(focal_points)[source]

Just create the stimulus to view the actual data, don’t store to db. Hold the entity in session without the surface, so the next time you need data just get from that one.