Source code for tvb.adapters.visualizers.pse_discrete
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need to download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http://www.thevirtualbrain.org
#
# (c) 2012-2023, Baycrest Centre for Geriatric Care ("Baycrest") and others
#
# This program is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this
# program. If not, see <http://www.gnu.org/licenses/>.
#
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as explained here:
# https://www.thevirtualbrain.org/tvb/zwei/neuroscience-publications
#
#
"""
.. moduleauthor:: Lia Domide <lia.domide@codemart.ro>
.. moduleauthor:: Ionel Ortelecan <ionel.ortelecan@codemart.ro>
.. moduleauthor:: Bogdan Neacsa <bogdan.neacsa@codemart.ro>
"""
from tvb.adapters.visualizers.pse import PSEDiscreteGroupModel
from tvb.core.adapters.abcadapter import ABCAdapterForm
from tvb.core.adapters.abcdisplayer import ABCDisplayer
from tvb.core.entities.filters.chain import FilterChain
from tvb.core.entities.model.model_datatype import DataTypeGroup
from tvb.core.neotraits.forms import TraitDataTypeSelectField
from tvb.core.neotraits.view_model import ViewModel, DataTypeGidAttr
MAX_NUMBER_OF_POINT_TO_SUPPORT = 512
[docs]class DiscretePSEAdapterModel(ViewModel):
datatype_group = DataTypeGidAttr(
linked_datatype=DataTypeGroup,
label='Datatype Group'
)
[docs]class DiscretePSEAdapter(ABCDisplayer):
"""
Visualization adapter for Parameter Space Exploration.
Will be used as a generic visualizer, accessible when input entity is DataTypeGroup.
Will also be used in Burst as a supplementary navigation layer.
"""
_ui_name = "Discrete Parameter Space Exploration"
_ui_subsection = "pse"
[docs] def get_required_memory_size(self, view_model):
# type: (DiscretePSEAdapterModel) -> int
"""
Return the required memory to run this algorithm.
"""
# Don't know how much memory is needed.
return -1
[docs] def launch(self, view_model):
# type: (DiscretePSEAdapterModel) -> dict
"""
Launch the visualizer.
"""
pse_model = PSEDiscreteGroupModel(view_model.datatype_group.hex, None, None, '')
pse_context = pse_model.pse_context
pse_context.prepare_individual_jsons()
return self.build_display_result('pse_discrete/view', pse_context,
pages=dict(controlPage="pse_discrete/controls"))
[docs] @staticmethod
def prepare_parameters(datatype_group_gid, back_page, color_metric=None, size_metric=None):
pse_model = PSEDiscreteGroupModel(datatype_group_gid, color_metric, size_metric, back_page)
return pse_model.pse_context