コード例 #1
0
ファイル: flow_service.py プロジェクト: sraghuvanshi/tvb-root
    def get_analyze_groups(self):
        """
        :return: list of AlgorithmTransientGroup entities
        """
        categories = dao.get_launchable_categories(elimin_viewers=True)
        categories_ids = [categ.id for categ in categories]
        stored_adapters = dao.get_adapters_from_categories(categories_ids)

        groups_list = []
        for adapter in stored_adapters:
            # For empty groups, this time, we fill the actual adapter
            group = AlgorithmTransientGroup(adapter.group_name or adapter.displayname,
                                            adapter.group_description or adapter.description)
            group = self._find_group(groups_list, group)
            group.children.append(adapter)
        return categories[0], groups_list
コード例 #2
0
ファイル: flow_service.py プロジェクト: sraghuvanshi/tvb-root
 def _group_adapters_by_category(self, stored_adapters, categories):
     """
     :param stored_adapters: list StoredAdapter
     :return: dict(category_name: List AlgorithmTransientGroup), empty groups all in the same AlgorithmTransientGroup
     """
     categories_dict = dict()
     for adapter in stored_adapters:
         category_name = categories.get(adapter.fk_category)
         if category_name in categories_dict:
             groups_list = categories_dict.get(category_name)
         else:
             groups_list = []
             categories_dict[category_name] = groups_list
         group = AlgorithmTransientGroup(adapter.group_name, adapter.group_description)
         group = self._find_group(groups_list, group)
         group.children.append(adapter)
     return categories_dict
コード例 #3
0
ファイル: bct_adapters.py プロジェクト: VinczeRobert/tvb-root
from tvb.core.adapters.abcadapter import ABCAsynchronous, ABCAdapterForm
from tvb.core.entities.filters.chain import FilterChain
from tvb.adapters.datatypes.db.connectivity import ConnectivityIndex
from tvb.adapters.datatypes.db.graph import ConnectivityMeasureIndex
from tvb.adapters.datatypes.db.mapped_value import ValueWrapperIndex
from tvb.core.entities.load import load_entity_by_gid
from tvb.core.entities.model.model_operation import AlgorithmTransientGroup
from tvb.core.neocom import h5
from tvb.core.neotraits.forms import TraitDataTypeSelectField
from tvb.core.neotraits.view_model import ViewModel, DataTypeGidAttr
from tvb.core.utils import extract_matlab_doc_string
from tvb.datatypes.connectivity import Connectivity
from tvb.datatypes.graph import ConnectivityMeasure

BCT_GROUP_MODULARITY = AlgorithmTransientGroup("Modularity Algorithms",
                                               "Brain Connectivity Toolbox",
                                               "bct")
BCT_GROUP_DISTANCE = AlgorithmTransientGroup("Distance Algorithms",
                                             "Brain Connectivity Toolbox",
                                             "bctdistance")

BCT_PATH = os.path.join(TvbProfile.current.EXTERNALS_FOLDER_PARENT,
                        "externals/BCT")
BCT_PATH_ENV = 'BCT_PATH'
if BCT_PATH_ENV in os.environ and os.path.exists(
        os.environ[BCT_PATH_ENV]) and os.path.isdir(os.environ[BCT_PATH_ENV]):
    BCT_PATH = os.environ[BCT_PATH_ENV]

LABEL_CONNECTIVITY_BINARY = "Binary (directed/undirected) connection matrix"
LABEL_CONN_WEIGHTED_DIRECTED = "Weighted directed connection matrix"
LABEL_CONN_WEIGHTED_UNDIRECTED = "Weighted undirected connection matrix"
コード例 #4
0
#
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#
from tvb.core.entities.model.model_operation import AlgorithmTransientGroup
from tvb.adapters.analyzers.bct_adapters import BaseBCT, BaseUndirected, bct_description, \
    LABEL_CONN_WEIGHTED_UNDIRECTED, LABEL_CONN_WEIGHTED_DIRECTED

BCT_GROUP_CLUSTERING = AlgorithmTransientGroup("Clustering Algorithms", "Brain Connectivity Toolbox", "bctclustering")


class ClusteringCoefficient(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING

    _ui_name = "Clustering Coefficient BD: Binary directed connection matrix"
    _ui_description = bct_description("clustering_coef_bd.m")
    _matlab_code = "C = clustering_coef_bd(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.weights}
コード例 #5
0
#
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#
from tvb.core.entities.model.model_operation import AlgorithmTransientGroup
from tvb.adapters.analyzers.bct_adapters import BaseBCT, bct_description, BaseBCTForm

BCT_GROUP_DEGREE = AlgorithmTransientGroup("Degree and Similarity Algorithms",
                                           "Brain Connectivity Toolbox",
                                           "bctdegree")
BCT_GROUP_DENSITY = AlgorithmTransientGroup("Density Algorithms",
                                            "Brain Connectivity Toolbox",
                                            "bctdensity")


class Degree(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_DEGREE

    _ui_name = "Degree: Undirected (binary/weighted) connection matrix"
    _ui_description = bct_description("degrees_und.m")
    _matlab_code = "deg = degrees_und(CIJ);"
コード例 #6
0
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#

from tvb.adapters.analyzers.bct_adapters import BaseBCT, BaseUndirected, bct_description, LABEL_CONNECTIVITY_BINARY
from tvb.core.entities.model.model_operation import AlgorithmTransientGroup

BCT_GROUP_CENTRALITY = AlgorithmTransientGroup("Centrality Algorithms",
                                               "Brain Connectivity Toolbox",
                                               "bctcentrality")


class CentralityNodeBinary(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY
    _ui_connectivity_label = LABEL_CONNECTIVITY_BINARY

    _ui_name = "Node Betweenness Centrality Binary"
    _ui_description = bct_description("betweenness_bin.m")
    _matlab_code = "C = betweenness_bin(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.binarized_weights