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


Python TvbProfile.set_profile方法代码示例

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


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

示例1: setup_test_env

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
def setup_test_env():

    from tvb.basic.profile import TvbProfile
    if len(sys.argv) > 1:
        profile = sys.argv[1]
    else:
        profile = TvbProfile.TEST_SQLITE_PROFILE
    TvbProfile.set_profile(profile)
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:10,代码来源:main_tests.py

示例2: init_test_env

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
def init_test_env():
    """
    This method prepares all necessary data for tests execution
    """
    # Set a default test profile, for when running tests from dev-env.
    if TvbProfile.CURRENT_PROFILE_NAME is None:
        TvbProfile.set_profile(TvbProfile.TEST_SQLITE_PROFILE)
        print "Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME
        db_file = TvbProfile.current.db.DB_URL.replace("sqlite:///", "")
        if os.path.exists(db_file):
            os.remove(db_file)

    from tvb.core.entities.model_manager import reset_database
    from tvb.core.services.initializer import initialize

    reset_database()
    initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
开发者ID:lcosters,项目名称:tvb-framework,代码行数:19,代码来源:base_testcase.py

示例3: setup

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
def setup():

    if sys.platform != 'darwin':
        unsupport_module('h5py')

    import logging
    logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)

    from tvb.basic.profile import TvbProfile
    TvbProfile.set_profile(TvbProfile.MATLAB_PROFILE)

    # MATLAB states the module doesn't exist if not importable and provides no traceback
    # to diagnose the import error, so we'll need to workaround this in the future. For now,
    # just try to import the simlab and report if it worked or not.
    try:
        import tvb.simulator.lab
        print('TVB modules available.')
    except Exception as exc:
        #print 'failed to import all TVB modules, not all functionality may be .'
        pass
开发者ID:the-virtual-brain,项目名称:tvb-documentation,代码行数:22,代码来源:tvb_matlab.py

示例4: init_test_env

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
def init_test_env():
    """
    This method prepares all necessary data for tests execution
    """
    # Set a default test profile, for when running tests from dev-env.
    if TvbProfile.CURRENT_PROFILE_NAME is None:
        profile = TvbProfile.TEST_SQLITE_PROFILE
        if len(sys.argv) > 1:
            for i in range(1,len(sys.argv)-1):
                if "--profile=" in sys.argv[i]:
                    profile = sys.argv[i].split("=")[1]
        TvbProfile.set_profile(profile)
        print("Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME)
        db_file = TvbProfile.current.db.DB_URL.replace('sqlite:///', '')
        if os.path.exists(db_file):
            os.remove(db_file)

    from tvb.core.entities.model_manager import reset_database
    from tvb.core.services.initializer import initialize

    reset_database()
    initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:24,代码来源:base_testcase.py

示例5: Jirsa

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
#   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)
#
#

"""
This is intended to be a Benchmarking  and Validator script.

.. moduleauthor:: bogdan.neacsa
"""

if __name__ == '__main__':
    from tvb.basic.profile import TvbProfile
    TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE)

import sys
from time import sleep
from tvb.config import SIMULATOR_MODULE, SIMULATOR_CLASS
from tvb.core.adapters.abcadapter import ABCAdapter
from tvb.core.services.flow_service import FlowService
from tvb.core.services.operation_service import OperationService
from tvb.core.entities.storage import dao
from tvb.core.entities.model import STATUS_STARTED, STATUS_FINISHED, STATUS_ERROR, PARAM_RANGE_PREFIX

KEY_PROJECT = 'project'



class ModelValidator(object):
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:33,代码来源:model_validations.py

示例6: do_operation_launch

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
4 is the operation id stored in the DataBase in the table "OPERATIONS"
It gets the algorithm, and the adapter with its parameters from database.
And finally launches the computation.
The results of the computation will be stored by the adapter itself.

.. moduleauthor:: Bogdan Neacsa <[email protected]>
.. moduleauthor:: Lia Domide <[email protected]>
.. moduleauthor:: Yann Gordon <[email protected]>

"""


import sys
from tvb.basic.profile import TvbProfile
if __name__ == '__main__':
    TvbProfile.set_profile(sys.argv[2], True)

from tvb.basic.logger.builder import get_logger
from tvb.core.adapters.abcadapter import ABCAdapter
from tvb.core.entities.storage import dao
from tvb.core.utils import parse_json_parameters
from tvb.core.services.operation_service import OperationService
from tvb.core.services.workflow_service import WorkflowService



def do_operation_launch(operation_id):
    """
    Event attached to the local queue for executing an operation, when we will have resources available.
    """
    LOGGER = get_logger('tvb.core.operation_async_launcher')
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:33,代码来源:operation_async_launcher.py

示例7: Jirsa

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
#
#   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)
#
#

"""
This is intended to be a Benchmarking  and Validator script.

.. moduleauthor:: bogdan.neacsa
"""

from tvb.basic.profile import TvbProfile as tvb_profile
tvb_profile.set_profile(["-profile", "CONSOLE_PROFILE"], try_reload=False)

import sys
from time import sleep
from tvb.config import SIMULATOR_MODULE, SIMULATOR_CLASS
from tvb.core.services.flow_service import FlowService
from tvb.core.services.operation_service import OperationService
from tvb.core.entities.storage import dao
from tvb.core.entities.model import STATUS_STARTED, STATUS_FINISHED, STATUS_ERROR, PARAM_RANGE_PREFIX

KEY_PROJECT = 'project'



class ModelValidator(object):
    overwrites = {}
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:33,代码来源:model_validations.py

示例8: TVBSettings

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
Launches the web server and configure the controllers for UI.

.. moduleauthor:: Lia Domide <[email protected]>
"""

import os
import sys
import cherrypy
import webbrowser
from copy import copy
from cherrypy import Tool
from sys import platform, argv

### This will set running profile from arguments.
from tvb.basic.profile import TvbProfile
TvbProfile.set_profile(argv, True)
from tvb.basic.config.settings import TVBSettings

### For Linux Distribution, correctly set MatplotLib Path, before start.
if TVBSettings().is_linux():
    os.environ['MATPLOTLIBDATA'] = os.path.join(TVBSettings().get_library_folder(), 'mpl-data')

### Import MPLH5 to have the back-end Thread started.
from tvb.interfaces.web.mplh5 import mplh5_server
from tvb.basic.logger.builder import get_logger
LOGGER = get_logger('tvb.interfaces.web.mplh5.mplh5_server')
mplh5_server.start_server(LOGGER)

from tvb.core.adapters.abcdisplayer import ABCDisplayer
from tvb.core.decorators import user_environment_execution
from tvb.core.services.settings_service import SettingsService
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:33,代码来源:run.py

示例9: tests

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
if __name__ == "__main__":
    #Start all TVB tests (if in Coverage mode)
    if KEY_COVERAGE in sys.argv:
        import tvb.interfaces as intf

        SOURCE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(intf.__file__)))
        COVERAGE = coverage(source=[SOURCE_DIR], omit=generage_excludes([SOURCE_DIR]), cover_pylib=False)
        COVERAGE.start()
        ## This needs to be executed before any TVB import.


import unittest
import datetime
from tvb.basic.profile import TvbProfile
TvbProfile.set_profile(sys.argv[1])

from tvb.tests.framework.xml_runner import XMLTestRunner
from tvb.tests.framework.core import core_tests_main
from tvb.tests.framework.adapters import adapters_tests_main
from tvb.tests.framework.analyzers import bct_test
from tvb.tests.framework.interfaces.web import web_tests_main



def suite():
    """
    Gather all the tests in a test suite.
    """
    test_suite = unittest.TestSuite()
    test_suite.addTest(core_tests_main.suite())
开发者ID:unimauro,项目名称:tvb-framework,代码行数:32,代码来源:main_tests.py

示例10: mexOut

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
import sys
import ctypes
mex = ctypes.CDLL('libmex')

class mexOut(object):
    def write(self, s):
        mex.mexPrintf(s)
    def flush(self):
        mex.mexEvalString('drawnow;')

mex_out = mexOut()
if False:
    sys.stdout = sys.stderr = mexOut()
    print 'Python stdout/err -> mexPrintf enabled.'

import logging
logging.basicConfig(level=logging.DEBUG, stream=mex_out)
LOG = logging.getLogger('helpers')
LOG.info('ready')
from tvb.basic.profile import TvbProfile
TvbProfile.set_profile(TvbProfile.MATLAB_PROFILE)
开发者ID:maedoc,项目名称:pybox,代码行数:23,代码来源:helpers.py

示例11:

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
4 is the operation id stored in the DataBase in the table "OPERATIONS"
It gets the algorithm, and the adapter with its parameters from database.
And finally launches the computation.
The results of the computation will be stored by the adapter itself.

.. moduleauthor:: Bogdan Neacsa <[email protected]>
.. moduleauthor:: Lia Domide <[email protected]>
.. moduleauthor:: Yann Gordon <[email protected]>

"""

## Make sure selected profile is propagated when launching an operation.
import sys
from tvb.basic.profile import TvbProfile as tvb_profile

tvb_profile.set_profile(sys.argv)

### Overwrite PostgreSQL number of connections when executed in the context of a node
from tvb.basic.config.settings import TVBSettings

TVBSettings.MAX_DB_CONNECTIONS = TVBSettings.MAX_DB_ASYNC_CONNECTIONS
TVBSettings.OPERATION_EXECUTION_PROCESS = True

import matplotlib
from tvb.basic.logger.builder import get_logger
from tvb.core.adapters.abcadapter import ABCAdapter
from tvb.core.entities.storage import dao
from tvb.core.utils import parse_json_parameters
from tvb.core.traits import db_events
from tvb.core.services.operation_service import OperationService
from tvb.core.services.workflow_service import WorkflowService
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:33,代码来源:operation_async_launcher.py

示例12:

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import set_profile [as 别名]
#
#

"""
Make use of the correlation_coefficient analyzer to compute functional connectivity, using
the demo data at the region level.
``Run time``: 

``Memory requirement``: 

.. moduleauthor:: Paula Sanz Leon <[email protected]>

"""

from tvb.basic.profile import TvbProfile
TvbProfile.set_profile(["-profile", "LIBRARY_PROFILE"], try_reload=False)

import numpy
import tvb.datatypes.connectivity as connectivity
import tvb.analyzers.correlation_coefficient as corr_coeff
from tvb.datatypes.time_series import TimeSeriesRegion
from tvb.basic.logger.builder import get_logger
from tvb.simulator.plot.tools import *


LOG = get_logger(__name__)

#Load the demo region timeseries dataset 
try:
    data = numpy.load("demo_data_region_16s_2048Hz.npy")
except IOError:
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:33,代码来源:corrcoeff_analyse_view_region.py


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