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


Python ABCAdapter.build_adapter_from_class方法代码示例

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


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

示例1: import_h5

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import build_adapter_from_class [as 别名]
def import_h5(file_path, project_id):

    flow_service = FlowService()

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

    adapter_instance = ABCAdapter.build_adapter_from_class(TVBImporter)

    ## Prepare the input algorithms as if they were coming from web UI submit:
    launch_args = {"data_file": file_path}

    print "We will try to import file at path " + file_path
    ## launch an operation and have the results stored both in DB and on disk
    launched_operations = flow_service.fire_operation(
        adapter_instance, project.administrator, project.id, **launch_args
    )

    print "Operation launched. Check the web UI"
开发者ID:transpersonify,项目名称:tvb-framework,代码行数:21,代码来源:h5_import.py

示例2: get_logger

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import build_adapter_from_class [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.build_adapter_from_class(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:gummadhav,项目名称:tvb-framework,代码行数:32,代码来源:run_simulation.py

示例3: get_logger

# 需要导入模块: from tvb.core.adapters.abcadapter import ABCAdapter [as 别名]
# 或者: from tvb.core.adapters.abcadapter.ABCAdapter import build_adapter_from_class [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.build_adapter_from_class(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)
        launched_operation = dao.get_operation_by_id(launched_operation.id)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:32,代码来源:run_analyzer.py


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