当前位置: 首页>>代码示例>>Python>>正文


Python ABCAdapter.collapse_arrays方法代码示例

本文整理汇总了Python中tvb.core.adapters.abcadapter.ABCAdapter.collapse_arrays方法的典型用法代码示例。如果您正苦于以下问题:Python ABCAdapter.collapse_arrays方法的具体用法?Python ABCAdapter.collapse_arrays怎么用?Python ABCAdapter.collapse_arrays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tvb.core.adapters.abcadapter.ABCAdapter的用法示例。


在下文中一共展示了ABCAdapter.collapse_arrays方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: apply_equation

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import collapse_arrays [as 别名]
 def apply_equation(self, **kwargs):
     """
     Applies an equations for computing a model parameter.
     """
     submitted_data = ABCAdapter.collapse_arrays(kwargs, ['model_param'])
     model_param, equation = self._compute_equation(submitted_data)
     context_model_parameters = base.get_from_session(KEY_CONTEXT_MPS)
     context_model_parameters.apply_equation(model_param, equation)
     base.add2session(KEY_CONTEXT_MPS, context_model_parameters)
     template_specification = self.get_surface_model_parameters_data(model_param)
     template_specification = self._add_entra_equation_entries(template_specification,
                                                               kwargs['min_x'], kwargs['max_x'])
     template_specification['equationViewerUrl'] = '/spatial/modelparameters/surface/get_equation_chart'
     template_specification['equationsPrefixes'] = json.dumps(self.plotted_equations_prefixes)
     return self.fill_default_attributes(template_specification)
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:17,代码来源:surface_model_parameters_controller.py

示例2: _compute_equation

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import collapse_arrays [as 别名]
 def _compute_equation(parameters):
     """
     This method will return an equation and the model parameter on
     which should be applied the equation.
     The equation is constructed based on the parameters collected from the UI.
     """
     model_param = parameters[MODEL_PARAM]
     equation = parameters[MODEL_PARAM + PARAM_SUFFIX][MODEL_PARAM_EQUATION]
     equation_params = parameters[MODEL_PARAM + PARAM_SUFFIX][MODEL_PARAM_EQUATION + PARAM_SUFFIX][equation]
     equation_params = ABCAdapter.collapse_arrays(equation_params, [])
     if PARAMETERS + PARAM_SUFFIX in equation_params:
         equation_params = equation_params[PARAMETERS + PARAM_SUFFIX]
     else:
         equation_params = {}
     for param in equation_params:
         equation_params[param] = float(equation_params[param])
     selected_equation = get_traited_instance_for_name(equation, equations.Equation, {PARAMETERS: equation_params})
     return model_param, selected_equation
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:20,代码来源:surface_model_parameters_controller.py

示例3: get_equation_chart

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import collapse_arrays [as 别名]
    def get_equation_chart(self, **form_data):
        """
        Returns the html which contains the plot with the temporal equation.
        """
        try:
            form_data = ABCAdapter.collapse_arrays(form_data, ['temporal'])
            min_x, max_x, ui_message = self.get_x_axis_range(form_data['min_x'], form_data['max_x'])
            equation = Equation.build_equation_from_dict('temporal', form_data)
            series_data, display_ui_message = equation.get_series_data(min_range=min_x, max_range=max_x)
            json_data = self.get_series_json(series_data, 'Temporal')
            all_series = self.build_final_json([json_data])
            if display_ui_message:
                ui_message = self.get_ui_message(["temporal"])

            return {'allSeries': all_series, 'prefix': 'temporal', 'message': ui_message}
        except NameError, ex:
            self.logger.exception(ex)
            return {'allSeries': None, 'errorMsg': "Incorrect parameters for equation passed."}
开发者ID:unimauro,项目名称:tvb-framework,代码行数:20,代码来源:region_stimulus_controller.py

示例4: get_equation_chart

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import collapse_arrays [as 别名]
    def get_equation_chart(self, **form_data):
        """
        Returns the html which contains the plot with the equation selected by the user for a certain model param.
        """
        try:
            min_x, max_x, ui_message = self.get_x_axis_range(form_data['min_x'], form_data['max_x'])
            form_data = ABCAdapter.collapse_arrays(form_data, self.plotted_equations_prefixes)
            _, equation = self._compute_equation(form_data)
            series_data, display_ui_message = equation.get_series_data(min_range=min_x, max_range=max_x)
            json_data = self.get_series_json(series_data, "Spatial")
            all_series = self.build_final_json([json_data])
            ui_message = ''
            if display_ui_message:
                ui_message = self.get_ui_message(["spatial"])

            return {'allSeries': all_series, 'prefix': self.plotted_equations_prefixes[0], 'message': ui_message}
        except NameError, ex:
            self.logger.exception(ex)
            return {'allSeries': None, 'errorMsg': "Incorrect parameters for equation passed."}
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:21,代码来源:surface_model_parameters_controller.py


注:本文中的tvb.core.adapters.abcadapter.ABCAdapter.collapse_arrays方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。