The Virtual Brain Project

Table Of Contents

Previous topic

filters Package

Next topic

db_update_scripts Package

This Page

model Package

Gather together all model classes, for easy import and usage.

model_burst

class tvb.core.entities.model.model_burst.BurstConfiguration(project_id, status='running', simulator_configuration=None, name=None)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.exportable.Exportable

Contains information required to rebuild the interface of a burst that was already launched.

  • simulator_configuration - hold a dictionary with what entries were displayed in the simulator part
  • dynamic_ids - A list of dynamic id’s associated with the connectivity nodes. Used by the region parameters page
BURST_CANCELED = 'canceled'
BURST_ERROR = 'error'
BURST_FINISHED = 'finished'
BURST_RUNNING = 'running'
DEFAULT_PORTLET_CONFIGURATION = [[[-1, 'None'], [-1, 'None'], [-1, 'None'], [-1, 'None']], [[-1, 'None'], [-1, 'None'], [-1, 'None'], [-1, 'None']], [[-1, 'None'], [-1, 'None'], [-1, 'None'], [-1, 'None']]]
clone()[source]

Return an exact copy of the entity with the exception than none of it’s sub-entities (tabs, portlets, workflow steps) are persisted in db.

datatypes_number
error_message
finish_time
fk_project
from_dict(dictionary)[source]
get_all_simulator_values()[source]
Returns:dictionary {simulator_attribute_name: value}
get_simulation_parameter_value(param_name)[source]

Read value set for simulation parameter. Return None, when no previous value was set.

id
is_group[source]
Returns:True, when current burst configuration will generate a group.
name
nr_of_tabs = 3
parent
prepare_after_load()[source]

Load Simulator configuration from JSON string, as it was stored in DB.

prepare_before_save()[source]

From dictionary, compose JSON string for DB storage of burst configuration parameters.

process_time[source]
reset_tabs()[source]

Set all tabs to default configuration (empty constructor).

selected_tab = 0
set_portlet(tab_index, index_in_tab, portlet_configuration)[source]

Set in the select with index ‘index_in_tab’ from the tab with index ‘tab_index’ the given ‘portlet_configuration’.

simulator_configuration = {}
start_time
status
update_selected_portlets()[source]

Update the DEFAULT_PORTLET_CONFIGURATION with the selected entries from the current burst config.

update_simulation_parameter(param_name, param_value, specific_key='value')[source]

Update single simulator parameter value or checked state.

update_simulator_configuration(new_values)[source]

Update the stored simulator configuration given the input dictionary :param new_values: new values

workflows_number
class tvb.core.entities.model.model_burst.Dynamic(name, user_id, model_class, model_parameters, integrator_class, integrator_parameters)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

code_version
fk_user
id
integrator_class
integrator_parameters
model_class
model_parameters
name
class tvb.core.entities.model.model_burst.TabConfiguration[source]

Bases: builtins.object

Helper entity to hold data that is currently being configured in a new burst page.

clone()[source]

Return an exact copy of the entity with the exception than none of it’s sub-entities (portlets, workflow steps) are persisted in db.

get_portlet(portlet_id)[source]
Returns:a PortletConfiguration entity.
reset()[source]

Set to None all portlets in current TAB.

model_datatype

Entities for Generic DataTypes, Links and Groups of DataTypes are defined here.

class tvb.core.entities.model.model_datatype.DataType(gid=None, **kwargs)[source]

Bases: tvb.core.neotraits.db.HasTraitsIndex

Base class for DB storage of Types. DataTypes, are the common language between Visualizers, Simulator and Analyzers.

static accepted_filters()[source]

Return accepted UI filters for current DataType.

create_date
disk_size
display_name[source]

To be implemented in each sub-class which is about to be displayed in UI, and return the text to appear.

display_type[source]
fill_from_generic_attributes(attrs)[source]
fill_from_has_traits(has_traits)[source]
fk_datatype_group
fk_from_operation
fk_parent_burst
gid
id
invalid
is_nan
module
parent_operation
persist_full_metadata()[source]

Do nothing here. We will implement this only in MappedType.

state
subject
title
type
type_
user_tag_1
user_tag_2
user_tag_3
user_tag_4
user_tag_5
visible
class tvb.core.entities.model.model_datatype.DataTypeGroup(operation_group, **kwargs)[source]

Bases: tvb.core.entities.model.model_datatype.DataType

All the DataTypes resulted from an operation group will be part from a DataType group.

count_results
create_date
disk_size
fk_datatype_group
fk_from_operation
fk_operation_group
fk_parent_burst
gid
id
invalid
is_nan
module
no_of_ranges
parent_operation
parent_operation_group
state
subject
title
type
type_
user_tag_1
user_tag_2
user_tag_3
user_tag_4
user_tag_5
visible
class tvb.core.entities.model.model_datatype.DataTypeMatrix(gid=None, **kwargs)[source]

Bases: tvb.core.entities.model.model_datatype.DataType

create_date
disk_size
fk_datatype_group
fk_from_operation
fk_parent_burst
gid
id
invalid
is_nan
module
ndim
parent_operation
state
subject
title
type
type_
user_tag_1
user_tag_2
user_tag_3
user_tag_4
user_tag_5
visible

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Class used to handle shortcuts from one DataType to another project.

fk_from_datatype
fk_to_project
id
referenced_datatype
referenced_project
class tvb.core.entities.model.model_datatype.MeasurePointsSelection(ui_name, selected_nodes, datatype_gid, project_id)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Interest area. A subset of nodes from a Connectivity or Sensors.

fk_datatype_gid
fk_in_project
id
selected_nodes
ui_name
class tvb.core.entities.model.model_datatype.StoredPSEFilter(ui_name, datatype_gid, threshold_value, applied_on)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Interest Area PSE Viewer Filter tool, specific filter configuration user inputs to be stored from multiple elements

applied_on
fk_datatype_gid
id
threshold_value
ui_name

model_operation

Here we define entities for Operations and Algorithms.

class tvb.core.entities.model.model_operation.Algorithm(module, classname, category_key, group_name=None, group_description=None, display_name='', description='', subsection_name=None, last_introspection_check=None)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

algorithm_category
classname
datatype_filter
description
displayname
fk_category
group_description
group_name
id
last_introspection_check
module
outputlist
parameter_name
removed
required_datatype
subsection_name
class tvb.core.entities.model.model_operation.AlgorithmCategory(displayname, launchable=False, rawinput=False, display=False, defaultdatastate='', order_nr='999', last_introspection_check=None)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

A category that will have different boolean attributes e.g.: launchable|rawinput| display, a displayName and a default state for data.

defaultdatastate
display
displayname
id
last_introspection_check
launchable
order_nr
rawinput
removed
class tvb.core.entities.model.model_operation.AlgorithmTransientGroup(name, description, subsection=None)[source]

Bases: builtins.object

class tvb.core.entities.model.model_operation.Operation(fk_launched_by, fk_launched_in, fk_from_algo, parameters, meta='', status='4-PENDING', start_date=None, completion_date=None, op_group_id=None, additional_info='', user_group=None, range_values=None, estimated_disk_size=0)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.exportable.Exportable

The class used to log any action executed in Projects.

additional_info
algorithm
completion_date
create_date
estimated_disk_size
fk_from_algo
fk_launched_by
fk_launched_in
fk_operation_group
from_dict(dictionary, dao, user_id=None, project_gid=None)[source]

Add specific attributes from a input dictionary.

gid
has_finished[source]
id
mark_complete(status, additional_info=None)[source]

Update Operation fields on completion: Status and Date

meta_data
operation_group
parameters
project
range_values
start_date
start_now()[source]

Update Operation fields at startup: Status and Date

status
to_dict()[source]

Overwrite superclass method to add required changes.

user
user_group
visible
class tvb.core.entities.model.model_operation.OperationGroup(project_id, name='incomplete', ranges=None)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.exportable.Exportable

We use this group entity, to map in DB a group of operations started in the same time by the user

fill_operationgroup_name(entities_in_group)[source]

Display name for UI.

fk_launched_in
gid
id
static load_range_numbers(range_value)[source]

Parse the range values for a given json-like string.

Returns:Boolean_are_all_numbers, range_field_name, array_range_values)
name
project
range1
range2
range3
range_references[source]

Memorized range starter

class tvb.core.entities.model.model_operation.OperationProcessIdentifier(operation_id, pid=None, job_id=None)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Class for storing for each operation the process identifier under which it was launched so any operation can be stopped from tvb.

fk_from_operation
id
job_id
operation
pid
class tvb.core.entities.model.model_operation.ResultFigure(operation_id, user_id, project_id, session_name, name, path, file_format='PNG')[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.exportable.Exportable

Class for storing figures from results, visualize them eventually next to each other. A group of results, with the same session_name will be displayed

file_format
file_path
fk_for_user
fk_from_operation
fk_in_project
from_dict(dictionary)[source]

Add specific attributes from a input dictionary.

id
name
operation
project
session_name
to_dict()[source]

Overwrite superclass method with required additional data.

tvb.core.entities.model.model_operation.has_finished(status)[source]

Is the given status indicating a finished operation?

model_project

Here we define entities related to user and project.

class tvb.core.entities.model.model_project.Project(name, fk_admin, description='')[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.exportable.Exportable

Contains the Projects informations and who is the administrator.

administrator
description
fk_admin
from_dict(dictionary, user_id)[source]

Add specific attributes from a input dictionary.

gid
id
last_updated
members = []
name
operations_canceled = 0
operations_error = 0
operations_finished = 0
operations_pending = 0
operations_started = 0
refresh_update_date()[source]

Mark entity as being changed NOW. (last_update field)

to_dict()[source]

Overwrite superclass method to add required changes.

version
class tvb.core.entities.model.model_project.User(login, password, email=None, validated=True, role='RESEARCHER')[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Contains the users informations.

email
get_project_structure_grouping()[source]
get_viewers_color_scheme()[source]
id
is_administrator()[source]

Return a boolean, saying if current user has role Administrator

is_online_help_active()[source]

This method returns True if this user should see online help.

password
preferences

A descriptor that presents a read/write view of an object attribute.

role
selected_project
set_project_structure_grouping(first, second)[source]
set_viewers_color_scheme(color_scheme)[source]
switch_online_help_state()[source]

This method changes the state of the OnlineHelp Active flag.

username
validated
class tvb.core.entities.model.model_project.UserPreferences(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Contains the user preferences data.

ONLINE_HELP_ACTIVE = 'online_help_active'
PROJECT_STRUCTURE_GROUPING = 'project_structure_grouping'
VIEWERS_COLOR_SCHEME = 'viewers_color_scheme'
fk_user
key
user
value
class tvb.core.entities.model.model_project.User_to_Project(user, case)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Multiple Users can be members of a given Project.

fk_project
fk_user
id

model_workflow

Here we define entities related to workflows and portlets.

class tvb.core.entities.model.model_workflow.Portlet(algorithm_identifier, xml_path, name='TVB Portlet')[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase

Store the Portlet entities. One entity will hold: - portlet id; - path to the XML file that declares it; - a name given in the XML - an unique identifier (also from XML) - last date of introspection.

algorithm_identifier
id
last_introspection_check
name
xml_path
class tvb.core.entities.model.model_workflow.Workflow(project_id, burst_id, status='started')[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.exportable.Exportable

Main Workflow class. One Burst can have multiple Workflow entities associated (when launching a range).

STATUS_FINISHED = 'finished'
STATUS_STARTED = 'started'
burst
fk_burst
fk_project
from_dict(info_dict)[source]
id
project
status
class tvb.core.entities.model.model_workflow.WorkflowStep(algorithm_id, static_param=None, dynamic_param=None, user_dynamic_param=None, workflow_id=None, step_index=None, tab_index=None, index_in_tab=None)[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.model.model_workflow._BaseWorkflowStep

Analyze/Simulate step inside a workflow. This type of step will generate an operation to be scheduled for execution.

  • step_index - the index of the step into the workflow;
  • fk_operation - the operation that resulted from this workflow step.
algorithm
clone()[source]

Return clone - not linked to any DB session or Operation.

fk_algorithm

Column attributes with Foreign Keys can not be declared directly in SqlAlchemy

fk_operation
fk_workflow

Column attributes with Foreign Keys can not be declared directly in SqlAlchemy

from_dict(data)[source]
id
index_in_tab
step_index
tab_index
user_dynamic_param
workflow
class tvb.core.entities.model.model_workflow.WorkflowStepView(algorithm_id, static_param=None, dynamic_param=None, user_dynamic_param=None, workflow_id=None, portlet_id=-1, tab_index=None, index_in_tab=None, ui_name='Default')[source]

Bases: sqlalchemy.ext.declarative.api.DeclarativeBase, tvb.core.entities.model.model_workflow._BaseWorkflowStep

View Step inside a workflow.

  • portlet_id - the id of the portlet (or -1 if simulator or result measure);
  • ui_name - custom title given by the user when selecting a portlet.
algorithm
clone()[source]

Return clone - not linked to any DB session or Operation.

fk_algorithm

Column attributes with Foreign Keys can not be declared directly in SqlAlchemy

fk_portlet
fk_workflow

Column attributes with Foreign Keys can not be declared directly in SqlAlchemy

from_dict(data)[source]
id
index_in_tab
portlet
tab_index
ui_name
user_dynamic_param
workflow