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


Python ABCAdapter.prepare_adapter方法代码示例

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


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

示例1: get_logger

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import prepare_adapter [as 别名]

LOG = get_logger(__name__)


## Before starting this, we need to have TVB web interface launched at least once (to have a default project, user, etc)
if __name__ == "__main__":

    flow_service = FlowService()
    operation_service = OperationService()

    ## This ID of a project needs to exists in DB, and it can be taken from the WebInterface:
    project = dao.get_project_by_id(1)

    ## Prepare the Adapter
    adapter_instance = ABCAdapter.prepare_adapter(FourierAdapter)

    ## Prepare the input algorithms as if they were coming from web UI submit:
    time_series = dao.get_generic_entity(TimeSeriesRegion, DataTypeMetaData.DEFAULT_SUBJECT, "subject")
    if len(time_series) < 1:
        LOG.error("We could not find a compatible TimeSeries Datatype!")
    launch_args = {"time_series": time_series[0].gid}

    ## launch an operation and have the results stored both in DB and on disk
    launched_operation = flow_service.fire_operation(
        adapter_instance, project.administrator, project.id, **launch_args
    )[0]

    ## wait for the operation to finish
    while not launched_operation.has_finished:
        sleep(5)
开发者ID:lcosters,项目名称:tvb-framework,代码行数:32,代码来源:run_analyzer.py

示例2: get_logger

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import prepare_adapter [as 别名]

LOG = get_logger(__name__)


## Before starting this, we need to have TVB web interface launched at least once (to have a default project, user, etc)
if __name__ == "__main__":

    flow_service = FlowService()
    operation_service = OperationService()

    ## This ID of a project needs to exists in DB, and it can be taken from the WebInterface:
    project = dao.get_project_by_id(1)

    ## Prepare the Adapter
    adapter_instance = ABCAdapter.prepare_adapter(SimulatorAdapter)

    ## Prepare the input algorithms as if they were coming from web UI submit:
    ## TODO create helper methods for working with objects instead of strings.
    connectivity = dao.get_generic_entity(Connectivity, DataTypeMetaData.DEFAULT_SUBJECT, "subject")[0]
    launch_args = dict()
    for f in adapter_instance.flaten_input_interface():
        launch_args[f["name"]] = str(f["default"]) if 'default' in f else None
    launch_args["connectivity"] = connectivity.gid
    launch_args["model_parameters_option_Generic2dOscillator_variables_of_interest"] = 'V'

    if len(sys.argv) > 1:
        launch_args["model_parameters_option_Generic2dOscillator_tau"] = sys.argv[1]

    ## launch an operation and have the results stored both in DB and on disk
    launched_operation = flow_service.fire_operation(adapter_instance, project.administrator,
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:32,代码来源:run_simulation.py


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