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. from tvb.basic.profile import TvbProfile 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.config.init.model_manager import reset_database from tvb.config.init.initializer import initialize reset_database() initialize(skip_import=True) # Add Dummy DataType REGISTRY.register_datatype(DummyDataType, DummyDataTypeH5, DummyDataTypeIndex) REGISTRY.register_datatype(None, None, DummyDataType2Index)
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)
def fire_operation(project_id, adapter_instance, view_model): TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) project = dao.get_project_by_id(project_id) # launch an operation and have the results stored both in DB and on disk launched_operation = OperationService().fire_operation(adapter_instance, project.administrator, project.id, view_model=view_model) LOG.info("Operation launched....") return launched_operation
def import_conn_zip(project_id, zip_path): TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) project = dao.get_project_by_id(project_id) importer = ABCAdapter.build_adapter_from_class(ZIPConnectivityImporter) view_model = ZIPConnectivityImporterModel() view_model.uploaded = zip_path return OperationService().fire_operation(importer, project.administrator, project_id, view_model=view_model)
def setup_test_console_env(): import sys # Remove anything pointing to the framework, to make sure that only one direct dependency exists # TVB-Framework --> TVB Scientific Library # We should have nothing inverse. sys.path = [ path for path in sys.path if not path.endswith('framework_tvb') ] from tvb.basic.profile import TvbProfile TvbProfile.set_profile(TvbProfile.TEST_LIBRARY_PROFILE)
def command_initializer(persist_settings=True, skip_import=False): if persist_settings and TvbProfile.is_first_run(): settings_service = SettingsService() settings = {} # Save default settings for key, setting in settings_service.configurable_keys.items(): settings[key] = setting['value'] settings_service.save_settings(**settings) TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) # Build new db engine in case DB URL value changed new_db_engine = build_db_engine() SA_SESSIONMAKER.configure(bind=new_db_engine) # Initialize application initialize(skip_import)
def import_conn_h5(project_id, h5_path): project = dao.get_project_by_id(project_id) TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) now = datetime.now() date_str = "%d-%d-%d_%d-%d-%d_%d" % (now.year, now.month, now.day, now.hour, now.minute, now.second, now.microsecond) uq_name = "%s-Connectivity" % date_str new_path = os.path.join(TvbProfile.current.TVB_TEMP_FOLDER, uq_name) StorageInterface.copy_file(h5_path, new_path) importer = ABCAdapter.build_adapter_from_class(TVBImporter) view_model = importer.get_view_model_class()() view_model.data_file = new_path return OperationService().fire_operation(importer, project.administrator, project_id, view_model=view_model)
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)
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)
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
def fire_simulation(project_id, simulator_model): TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) project = dao.get_project_by_id(project_id) assert isinstance(simulator_model, SimulatorAdapterModel) # Load the SimulatorAdapter algorithm from DB cached_simulator_algorithm = AlgorithmService( ).get_algorithm_by_module_and_class(IntrospectionRegistry.SIMULATOR_MODULE, IntrospectionRegistry.SIMULATOR_CLASS) # Instantiate a SimulatorService and launch the configured simulation simulator_service = SimulatorService() burst = BurstConfiguration(project.id) burst.name = "Sim " + str(datetime.now()) burst.start_time = datetime.now() dao.store_entity(burst) launched_operation = simulator_service.async_launch_and_prepare_simulation( burst, project.administrator, project, cached_simulator_algorithm, simulator_model) LOG.info("Operation launched ....") return launched_operation
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)
# -*- coding: utf-8 -*- import time import numpy as np from tvb.basic.profile import TvbProfile TvbProfile.set_profile(TvbProfile.LIBRARY_PROFILE) from tvb_multiscale.examples.plot_results import plot_results from tvb_multiscale.config import CONFIGURED from tvb_multiscale.tvb.simulator_builder import SimulatorBuilder from tvb_multiscale.plot.plotter import Plotter from tvb.simulator.models.reduced_wong_wang_exc_io_inh_i import ReducedWongWangExcIOInhI from tvb.simulator.models.spiking_wong_wang_exc_io_inh_i import SpikingWongWangExcIOInhI from tvb.simulator.models.multiscale_wong_wang_exc_io_inh_i import MultiscaleWongWangExcIOInhI from tvb.simulator.models.wilson_cowan_constraint import WilsonCowan from tvb.simulator.models.generic_2d_oscillator_multiscale import Generic2dOscillator def main_example(tvb_sim_model=ReducedWongWangExcIOInhI, connectivity=CONFIGURED.DEFAULT_CONNECTIVITY_ZIP, simulation_length=100.0, config=CONFIGURED, **model_params): plotter = Plotter(config) # ----------------------1. Define a TVB simulator (model, integrator, monitors...)---------------------------------- simulator_builder = SimulatorBuilder() # Optionally modify the default configuration: simulator_builder.model = tvb_sim_model
def profile(request): profile = request.config.getoption("--profile") TvbProfile.set_profile(profile) return profile
def applicationWillTerminate_(self, notification): """ Make sure no TVB subprocess is left behind running """ execute_stop() app = AppKit.NSApplication.sharedApplication() delegate = ApplicationDelegate.alloc().init() app.setDelegate_(delegate) AppHelper.runEventLoop() if __name__ == "__main__": ARGS = parse_commandline() # Do not run BaseSettingsProfile.initialize_profile(..) as we do not want artefacts TvbProfile.set_profile(ARGS.profile, run_init=False) PYTHON_EXE_PATH = TvbProfile.current.PYTHON_INTERPRETER_PATH tvb_storage = TvbProfile.current.TVB_STORAGE TVB_PID_FILE = os.path.join(tvb_storage, "pid.tvb") if not os.path.exists(tvb_storage): try: os.makedirs(tvb_storage) except Exception: sys.exit( "You do not have enough rights to use TVB storage folder:" + str(tvb_storage)) if ARGS.subcommand == 'start': # Start one of TVB interfaces
from tvb.adapters.simulator.hpc_simulator_adapter import HPCSimulatorAdapter from tvb.basic.logger.builder import get_logger from tvb.basic.profile import TvbProfile from tvb.config.init.datatypes_registry import populate_datatypes_registry from tvb.core.entities.model.model_operation import STATUS_STARTED, STATUS_FINISHED, STATUS_ERROR from tvb.core.neocom import h5 from tvb.core.services.authorization import AuthorizationManager from tvb.core.services.backend_clients.hpc_scheduler_client import HPCSchedulerClient from tvb.storage.storage_interface import StorageInterface log = get_logger(__name__) UPDATE_STATUS_KEY = "NEW_STATUS" if __name__ == '__main__': TvbProfile.set_profile(TvbProfile.WEB_PROFILE, True) TvbProfile.current.hpc.IS_HPC_RUN = True def _encrypt_results(adapter_instance, storage_interface, dir_gid): output_plain_dir = adapter_instance._get_output_path() output_plain_files = os.listdir(output_plain_dir) output_plain_files = [ os.path.join(output_plain_dir, plain_file) for plain_file in output_plain_files ] log.info("Encrypt files: {}".format(output_plain_files)) storage_interface.encrypt_inputs(dir_gid, output_plain_files, HPCSchedulerClient.OUTPUT_FOLDER)
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 <*****@*****.**> .. moduleauthor:: Lia Domide <*****@*****.**> .. moduleauthor:: Yann Gordon <*****@*****.**> """ ## 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.operationservice import OperationService from tvb.core.services.workflowservice import WorkflowService
# 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) # # """ Find a TS in current project (by Subject) and later run an analyzer on it. __main__ will contain the code. .. moduleauthor:: Lia Domide <*****@*****.**> """ if __name__ == "__main__": from tvb.basic.profile import TvbProfile TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) from time import sleep from tvb.basic.logger.builder import get_logger from tvb.core.adapters.abcadapter import ABCAdapter from tvb.core.entities import model from tvb.core.entities.storage import dao from tvb.core.entities.transient.structure_entities import DataTypeMetaData from tvb.core.services.flow_service import FlowService from tvb.core.services.operation_service import OperationService from tvb.adapters.analyzers.fourier_adapter import FourierAdapter from tvb.datatypes.time_series import TimeSeriesRegion from tvb.datatypes.spectral import FourierSpectrum LOG = get_logger(__name__)
""" import importlib import time from subprocess import Popen, PIPE STARTUP_TIC = time.time() import os import sys import cherrypy import webbrowser from cherrypy import Tool from tvb.basic.profile import TvbProfile if __name__ == '__main__': TvbProfile.set_profile(sys.argv[1]) from tvb.basic.logger.builder import get_logger from tvb.core.adapters.abcdisplayer import ABCDisplayer from tvb.core.decorators import user_environment_execution from tvb.config.init.initializer import initialize, reset from tvb.core.services.exceptions import InvalidSettingsException from tvb.interfaces.web.request_handler import RequestHandler from tvb.interfaces.web.controllers.base_controller import BaseController from tvb.interfaces.web.controllers.users_controller import UserController from tvb.interfaces.web.controllers.help.help_controller import HelpController from tvb.interfaces.web.controllers.project.project_controller import ProjectController from tvb.interfaces.web.controllers.project.figure_controller import FigureController from tvb.interfaces.web.controllers.flow_controller import FlowController from tvb.interfaces.web.controllers.settings_controller import SettingsController from tvb.interfaces.web.controllers.burst.region_model_parameters_controller import RegionsModelParametersController
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)
.. moduleauthor:: Lia Domide <*****@*****.**> """ import os import sys import cherrypy import webbrowser from copy import copy from cherrypy import Tool from sys import platform, argv ### 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( os.path.dirname(sys.executable), 'mpl-data') # sys.path = ['', os.path.dirname(sys.executable)] ### Import MPLH5 to have the back-end Thread started. from tvb.interfaces.web.mplh5 import mplh5server from tvb.basic.logger.builder import get_logger LOGGER = get_logger('tvb.interfaces.web.mplh5.mplh5server') mplh5server.start_server(LOGGER)
Example: python operation_async_launcher.py 4 user_name_label 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 <*****@*****.**> .. moduleauthor:: Lia Domide <*****@*****.**> .. moduleauthor:: Yann Gordon <*****@*****.**> """ 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')
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())
# # 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 = {}
# # """ 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 <*****@*****.**> """ 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:
Launches the web server and configure the controllers for UI. .. moduleauthor:: Lia Domide <*****@*****.**> """ 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
# 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):
""" tvb.simulator.lab is a umbrella module designed to make console and scripting work easier by importing all the simulator pieces at once. .. moduleauthor:: Marmaduke Woodman <*****@*****.**> """ import os import pdb from time import time from numpy import * # for load & save not available in pylab import numpy as np from tvb.basic.profile import TvbProfile TvbProfile.set_profile(["-profile", "LIBRARY_PROFILE"], try_reload=False) from tvb.simulator import (simulator, models, coupling, integrators, monitors, noise) from tvb.datatypes import connectivity, surfaces, equations, patterns from tvb.simulator.common import get_logger LOG = get_logger(__name__) PDB = lambda: pdb.set_trace() def file_exists(fname): """ file_exists(fname) is a convenience function to test whether a file already exists or not. Returns True if we can stat the file, otherwise
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 <*****@*****.**> .. moduleauthor:: Lia Domide <*****@*****.**> .. moduleauthor:: Yann Gordon <*****@*****.**> """ ## 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
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 <*****@*****.**> .. moduleauthor:: Lia Domide <*****@*****.**> .. moduleauthor:: Yann Gordon <*****@*****.**> """ 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')
# 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) # # """ Based on the Brunel and Wang model. .. moduleauthor:: Paula Sanz Leon <*****@*****.**> .. moduleauthor:: Marmaduke Woodman <*****@*****.**> .. moduleauthor:: Stuart A. Knock <*****@*****.**> """ from tvb.basic.profile import TvbProfile TvbProfile.set_profile(TvbProfile.TEST_LIBRARY_PROFILE) import inspect import numpy from tvb.basic.neotraits.api import NArray, Range, List, Final import tvb.datatypes.lookup_tables as lookup_tables import tvb.simulator.models as models from tvb.simulator.common import get_logger LOG = get_logger(__name__) class BrunelWang(models.Model): """ .. [DJ_2012] Deco G and Jirsa V. *Ongoing Cortical Activity at Rest: Criticality, Multistability, and Ghost Attractors*.
import shutil import os import sys from tvb.basic.profile import TvbProfile from tvb.config.init.initializer import initialize from tvb.core.entities.file.files_update_manager import FilesUpdateManager if __name__ == '__main__': """ Script written for testing the migration from version 1.5.8 to 2.1.0. """ # set web profile TvbProfile.set_profile(TvbProfile.WEB_PROFILE) # migrate the database and h5 files h5_migrating_thread = initialize() # wait for thread to finish before processing h5_migrating_thread.join() # copy files in tvb_root folder so Jenkins can find them shutil.copytree( TvbProfile.current.TVB_LOG_FOLDER, os.path.join(TvbProfile.current.EXTERNALS_FOLDER_PARENT, 'logs')) # test if there are any files which were not migrated number_of_unmigrated_files = len(FilesUpdateManager.get_all_h5_paths()) if number_of_unmigrated_files != 0: sys.exit(-1)