The Virtual Brain Project

Table Of Contents

Previous topic

storage Package

Next topic

portlets Package

This Page

transient Package

Entities not persisted are to be defined here.

burst_configuration_entities

Entities transient and related to a Burst Configuration.

class tvb.core.entities.transient.burst_configuration_entities.AdapterConfiguration(interface, stored_adapter, ui_name=None)[source]

Helper entity that holds the configuration for an adapter from a Portlet-Chain. Keeps track of the adapter interface, the group and the UI name. In case of sub-algorithm also keep the prefix, and the pair {sub-algorithm : name}

ui_name[source]

UI title

class tvb.core.entities.transient.burst_configuration_entities.PortletConfiguration(portlet_id)[source]

Helper entity that hold the configuration of a portlet. Keeps track of the portlet id and the parameters for a given portlet.

clone()[source]

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

index_in_tab[source]

If it was a burst-launched portlet, it should have a visualizer and then the index in tab from that entity is considered the portlet configuration index in tab.

name[source]

The name of the portlet configuration is taken from the name of the workflow steps that were stored for it.

set_analyzers(analyzers)[source]

Selected analyzers

set_visualizer(visualizer)[source]

Called in case we are just viewing an old burst launch, where a the results of the analyzer part of a portlet are available, and a visualization could be launched.

class tvb.core.entities.transient.burst_configuration_entities.WorkflowStepConfiguration(algorithm_id, static_params=None, dynamic_params=None)[source]

Helper entity that holds the configuration needed to build a WorkflowStep. Holds the algorithm id for the corresponding adapter, plus the dynamic and static parameters that are required to launch this step.

DATATYPE_INDEX_KEY = 'datatype_idx'
STEP_INDEX_KEY = 'step_index'

burst_export_entities

Entities transient and related to a Burst Configuration.

class tvb.core.entities.transient.burst_export_entities.BaseExportHelp(input_data)[source]

Bases: object

Base class for all export helper entities. Wraps over a dictionary that is used to later convert entities to / from json.

KEY_EXPORT_DATE = 'export_date'
KEY_VERSION = 'code_version'
data[source]

Property so you can easily access the dictionary as if it was a public attribute.

class tvb.core.entities.transient.burst_export_entities.BurstInformation(data_dict)[source]

Bases: tvb.core.entities.transient.burst_export_entities.BaseExportHelp

Helper entity that hold all the information needed to build a complete burst entity with all workflows, and workflow steps.

KEY_BI_WORKFLOWS = '--BI_workflows--'
add_workflow(workflow)[source]

Append a WorkflowInformation entity to the list of workflows attached to this burst.

get_workflows()[source]

Return a list of WorkflowInformation entities.

static load_from_dict(input_dict)[source]

From a input dictionary try to rebuild a BurstInformation entity. The dictionary must have specific informations about the burst and it’s constituent workflows. Such a dictionary can be generated by calling ‘to_dict’ on existing BurstInformation.

set_workflows(wf_list)[source]

Set the entire list of workflows attached to this burst as WorkflowInformation entities.

to_dict()[source]

Convert this entities to python dictionary ready to be dumped to json. Also make sure to recursively go through all the WorkflowInformation entities. Can later be used to rebuild the BurstInformation entity.

class tvb.core.entities.transient.burst_export_entities.StepInfo(data_dict)[source]

Bases: tvb.core.entities.transient.burst_export_entities.BaseExportHelp

Base class for workflow steps.

ALGO_INFO = '--WVSI_algorighm_info--'
get_algorithm()[source]

Return the algorithm saved in this entity. Should be used only if previously an algorithm was saved on this entity by calling ‘set_algorithm’ method.

index()[source]

Returned a tuple of the form (tab_index, index_in_tab) that can uniquely identify a workflow step in the context of a given workflow. Used to remove the view step in case the algorithm for the workflow step no longer exists in project we are imported to.

set_algorithm(algorithm)[source]

Save required info about algorithm to quickly rebuild it. Recieves a model.Algorithm entity and makes sure to store just what is needed to later be able to re-create that entity (even if with different id).

to_dict()[source]

In case of workflow steps, the to_dict is simply returning it’s data dictionary, since no other complex entities should be present in dictionary at this point.

class tvb.core.entities.transient.burst_export_entities.WorkflowInformation(data_dict)[source]

Bases: tvb.core.entities.transient.burst_export_entities.BaseExportHelp

Helper entity that hold all the information needed to build a complete workflow entity with all it’s workflow steps.

KEY_VIEW_STEPS = '--WI_view_steps--'
KEY_WF_STEPS = '--WI_workflow_steps--'
add_view_step(view_step)[source]

Append a WorkflowViewStepInformation entity to the list of view steps for this workflow.

add_workflow_step(wf_step)[source]

Append a WorkflowStepInformation entity to the list of steps for this workflow.

get_view_steps()[source]

Return the list of view steps for this workflow as WorkflowViewStepInformation entities.

get_workflow_steps()[source]

Return the list of steps for this workflow as WorkflowStepInformation entities.

static load_from_dict(input_dict)[source]

From a input dictionary try to rebuild a WorkflowInformation entity. The dictionary must have specific informations about the workflow and it’s constituent workflow steps. Such a dictionary can be generated by calling ‘to_dict’ on existing WorkflowInformation.

set_view_steps(steps_list)[source]

Set the list of view steps for this workflow as WorkflowViewStepInformation entities.

set_workflow_steps(steps_list)[source]

Set the list of steps for this workflow as WorkflowStepInformation entities.

to_dict()[source]

Convert this entities to python dictionary ready to be dumped to json. Also make sure to recursively go through all the WorkflowStepInformation entities. Can later be used to rebuild the WorkflowInformation entity.

class tvb.core.entities.transient.burst_export_entities.WorkflowStepInformation(input_data)[source]

Bases: tvb.core.entities.transient.burst_export_entities.StepInfo

Helper entity that hold all the information needed to build a complete workflow view step entity

OP_GID = '--WVSI_operation_gid--'
get_operation_id()[source]

Return the operation that was saved on this entity. Should only be called if beforehand ‘set_operation’ was called on this entity.

static load_from_dict(input_dict)[source]

Just create a new WorkflowStepInformation entity with the given input dictionary.

set_operation(operation)[source]

Having a model.Operation entity as input, store it’s gid so we can later return it even if ‘id’ in db has changed.

class tvb.core.entities.transient.burst_export_entities.WorkflowViewStepInformation(input_data)[source]

Bases: tvb.core.entities.transient.burst_export_entities.StepInfo

Helper entity that hold all the information needed to build a complete workflow step entity

PORTLET_IDENT = '--WSI_portlet_id--'
get_portlet()[source]

Return the portlet that was saved on this entity. Should only be called if beforehand ‘set_portlet’ was called on this entity.

static load_from_dict(input_dict)[source]

Just create a new WorkflowViewStepInformation entity with the given input dictionary.

set_portlet(portlet)[source]

Having as input a model.Portlet entity, store what is required in order to later recreate that entity even in ‘id’ from database differs.

context_local_connectivity

class tvb.core.entities.transient.context_local_connectivity.ContextLocalConnectivity[source]

Keep the required data to redo the whole page. We don’t need to keep the kwargs since we never return to that page in ‘create mode’, so the local connectivity entity and the selected surface should suffice.

reset()[source]

context_overlay

Entities to be used with an overlay on Operation or DataType, are defined here.

class tvb.core.entities.transient.context_overlay.CommonDetails[source]

Bases: tvb.basic.config.utils.EnhancedDictionary

Enhanced dictionary holding details about an entity. It also contains metadata on how this details will be displayed in UI (disabled/readonly/hidden input field).

CODE_GID = 'gid'
CODE_OPERATION_GROUP_ID = 'operation_group_id'
CODE_OPERATION_GROUP_NAME = 'operation_group_name'
CODE_OPERATION_TAG = 'operation_label'
add_scientific_fields(extra_fields_dict)[source]

:param extra_fields_dict a dictionary of fields to be added in a distinct category.

static compute_operation_name(category_name, algorithm_name)[source]

Compute Operation display name, based on Operation Category and Algorithm.

get_ui_fields()[source]
Returns:list of dictionaries to be used for UI display. Each entry in the list will be displayed as a UI group of fields.
meta_attributes_list[source]

A list with all attributes for a DataType which are expected to be submitted from UI.

class tvb.core.entities.transient.context_overlay.DataTypeOverlayDetails[source]

Bases: tvb.core.entities.transient.context_overlay.CommonDetails

Entity used for displaying in an overlay details about a DataType.

DATA_STATE = 'data_state'
DATA_SUBJECT = 'subject'
DATA_TAG_1 = 'datatype_tag_1'
DATA_TAG_2 = 'datatype_tag_2'
DATA_TAG_3 = 'datatype_tag_3'
DATA_TAG_4 = 'datatype_tag_4'
DATA_TAG_5 = 'datatype_tag_5'
DATA_TITLE = 'datatype_title'
fill_from_datatype(datatype_result, parent_burst)[source]

Fill current dictionary with information from a loaded DB DataType. :param datatype_result DB loaded DataType :param parent_burst Burst entity in which current dataType was generated

class tvb.core.entities.transient.context_overlay.OperationOverlayDetails(operation, username, count_inputs, count_results, burst, no_of_op_in_group, op_pid)[source]

Bases: tvb.core.entities.transient.context_overlay.CommonDetails

Entity used for displaying in an overlay details about an operation.

context_stimulus

class tvb.core.entities.transient.context_stimulus.RegionStimulusContext[source]
get_session_connectivity()[source]
get_weights()[source]
reset()[source]
set_active_stimulus(stimulus_gid)[source]
set_weights(new_weights)[source]
update_from_interface(stimuli_interface)[source]

From a stimulus interface, update this context.

class tvb.core.entities.transient.context_stimulus.SurfaceStimulusContext[source]
get_selected_stimulus()[source]
get_session_surface()[source]
reset()[source]
set_active_stimulus(stimulus_gid)[source]
set_focal_points(focal_points_json)[source]
update_eq_kwargs(new_eq_kwargs)[source]

We need this since when you pass from step1 -> step2 you don’t want to remove the focal_points previously defined, so we can’t just reassign equation_kwargs = new_eq_kwargs but we can’t use update either since that would leave the collapsed dictionaries from a previosly loaded stimulus.

update_from_interface(stimuli_interface)[source]

From a stimulus interface, update this context.

filtering

class tvb.core.entities.transient.filtering.StaticFiltersFactory[source]

Factory class to build lists with static used filters through the application.

FULL_VIEW = 'Full view'
RELEVANT_VIEW = 'Relevant view'
static build_datatype_filters(selected='Relevant view', single_filter=None)[source]

Return all visibility filters for data structure page, or only one filter.

static build_operations_filters(simulation_algorithm, logged_user_id)[source]
Returns:list of filters that can be applied on Project View Operations page.

graph_structures

class tvb.core.entities.transient.graph_structures.FullGraphStructure(components)[source]

This class contains information for the entire graph to be displayed in UI. It holds a list of GraphComponent instances (e.g. multiple UPLOAD ops).

fill_all_graph_adjiacences()[source]
fill_shape_size()[source]

Sets the correct size for each node from this graph.

graph_components = []
prepare_for_json()[source]

Returns a list of NodeStructure instances to be serialized for browser-client rendering.

class tvb.core.entities.transient.graph_structures.GraphComponent(dt_inputs, parent_op, dt_outputs, op_inputs)[source]

Class used for representing a single component of the graph. One GraphComponent holds multiple lists of NodeStructure instances (for multiple layers).

A GraphComponent will have the following structure:

input_datatypes             operation_parent
    |                               |
    |                               |
    V                               V
[operation_parent]          [output_datatypes]             * Currently Selected node
    |                               |
    |                               |
    V                               V
output_datatypes            in_operations
in_operations = []
input_datatypes = []
operation_parent = []
output_datatypes = []
class tvb.core.entities.transient.graph_structures.NodeData(shape_size, shape_color, shape_type, node_type, node_entity_id, node_subtitle)[source]

Bases: object

Contains the meta-data that will be set on each GRAPH node.

static build_node_for_datatype(datatype_id, node_subtitle, shape_size=50, is_group=False)[source]
static build_node_for_operation(operation, group_id=None)[source]
node_entity_id = None
node_subtitle = None
node_type = None
shape_color = None
shape_size = None
shape_type = None
to_json()[source]

Returns the JSON-ready representation of this NodeData instance.

class tvb.core.entities.transient.graph_structures.NodeStructure(node_gid, node_name)[source]

Bases: object

Define the full structure of a graph NODE (including meta-data of type NodeData and node Adjiacences)

adjacencies = []
static build_artificial_root_structure(adjacencies_nodes)[source]
static build_structure_for_datatype(datatype_gid)[source]
static build_structure_for_operation(operation)[source]
static build_structure_for_operation_group(operation_group_gid)[source]
data = None
name = None
node_gid = None
selected = False
to_json()[source]

Returns the JSON-ready representation of this NodeStructure instance.

pse

Data for Parameter Space Exploration view will be defined here. The purpose of this entities is to be used in Genshi UI, or for populating visualizer.

class tvb.core.entities.transient.pse.ContextDiscretePSE(datatype_group_gid, color_metric, size_metric, back_page)[source]

Bases: tvb.basic.config.utils.EnhancedDictionary

Entity used for filling a PSE visualizer.

KEY_GID = 'Gid'
KEY_NODE_TYPE = 'dataType'
KEY_OPERATION_ID = 'operationId'
KEY_TOOLTIP = 'tooltip'
LINE_SEPARATOR = '<br/>'
build_node_info(operation, datatype)[source]

Build a dictionary with all the required information to be displayed for a given node.

fill_object(final_dict)[source]

Populate current entity with attributes required for visualizer

prepare_full_json()[source]

Apply JSON.dumps on full dictionary.

prepare_individual_jsons()[source]

Apply JSON.dumps on all attributes which can not be passes as they are towards UI.

prepare_metrics_datatype(measures, datatype)[source]

Update attribute self.datatypes_dict with metric values for this DataType.

setRanges(title_x, values_x, labels_x, title_y, values_y, labels_y, only_numbers)[source]

structure_entities

class tvb.core.entities.transient.structure_entities.DataTypeMetaData(data=None, invalid=False)[source]

Bases: tvb.core.entities.transient.structure_entities.GenericMetaData

This object will be populated from meta-data stored on a particular DataType/Operation. It should contain enough information, to restore a DataType entity, without DB previous data required.

DEFAULT_SUBJECT = 'John Doe'
KEY_AUTHOR = 'Source_Author'
KEY_BURST = 'Burst_Reference'
KEY_CLASS_NAME = 'Type'
KEY_COUNT = 'count'
KEY_CREATE_DATA_DAY = 'createDataDay'
KEY_CREATE_DATA_MONTH = 'createDataMonth'
KEY_DATATYPE_ID = 'Datatypeid'
KEY_DATE = 'Creation_Date'
KEY_FK_OPERATION_GROUP = 'fk_operation_group'
KEY_INVALID = 'datatype_invalid'
KEY_MODULE = 'Module'
KEY_NODE_TYPE = 'DataType'
KEY_OPERATION_ALGORITHM = 'Operation_Algorithm'
KEY_OPERATION_GROUP_NAME = 'op_group_name'
KEY_OPERATION_TAG = 'user_group'
KEY_OPERATION_TYPE = 'Source_Operation_Category'
KEY_OP_GROUP_ID = 'groupId'
KEY_RELEVANCY = 'Relevant'
KEY_STATE = 'Data_State'
KEY_SUBJECT = 'Data_Subject'
KEY_TAG_1 = 'User_Tag_1_Perpetuated'
KEY_TAG_2 = 'User_Tag_2'
KEY_TAG_3 = 'User_Tag_3'
KEY_TAG_4 = 'User_Tag_4'
KEY_TAG_5 = 'User_Tag_5'
KEY_TITLE = 'title'
STATES = {'RAW_DATA': 'Raw Data', 'INTERMEDIATE': 'Intermediate', 'FINAL': 'Final'}
create_date[source]

Return the create date of this entity, if stored, or None otherwise.

classmethod get_filterable_meta()[source]

Contains all the attributes by which the user can structure the tree of DataTypes.

All the returned attributes should exists into the ‘data’ field of its corresponding DataTypeMetaData object.

group[source]

Return the group tag in which the operation was launched

mark_invalid()[source]

Mark current meta-data as invalid. e.g. Because of a missing associated file.

merge_data(new_data)[source]

Update current state, from an external dictionary.

subject[source]

Return the name of the Subject if defined, or Default “John Doe”.

class tvb.core.entities.transient.structure_entities.GenericMetaData(data=None)[source]

Bases: tvb.basic.config.utils.EnhancedDictionary

Wrap a dictionary of meta-data for generic entities - Operations, Project, or DataType.

KEY_FILENAME = 'file_name'
KEY_GID = 'Gid'
file_name[source]
Returns:name of the file where to store current data, or None.
gid[source]
Returns:current Global Identifier or None.
class tvb.core.entities.transient.structure_entities.StructureNode(nid, node_name, ntype='Folder', meta=None, children=None)[source]

This entity represents a node in the Tree of a Project related Structure.

PREFIX_ID_LEAF = 'leaf_'
PREFIX_ID_NODE = 'node_'
PREFIX_ID_PROJECT = 'projectID'
SEP = '__'
TYPE_FILE = 'File'
TYPE_FOLDER = 'Folder'
TYPE_INVALID = 'Invalid'
has_children[source]

Return TRUE when current node is with Child nodes. Return FALSE when current node is a leaf in Tree.

is_group[source]

Check if meta_data has the transient is_link attribute set.

is_irelevant[source]

Check that current node is marked as not-relevant.

Check if meta_data has the transient is_link attribute set.

static metadata2tree(metadatas, first_level, second_level, project_id, project_name)[source]

Take a list of DataTypeMetaData entities as input. Create a tree of StructureNode entities, then convert it in JSON to display in UI.

first_level and second_level represents the fields by which should be structured the tree. Those fields should exists into the data dict of each DataTypeMetaData object.

type[source]

Type of a node it can be FOLDER, FILE or INVALID.