コード例 #1
0
from tvb.datatypes.time_series import TimeSeriesRegion
from tvb.datatypes.spectral import FourierSpectrum

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]
コード例 #2
0

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)
コード例 #3
0
from tvb.datatypes.time_series import TimeSeriesRegion
from tvb.datatypes.connectivity import Connectivity

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[
コード例 #4
0

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,