The Virtual Brain Project

Table Of Contents

Previous topic

logger Package

Next topic

adapters Package

This Page

core Package

This is an abstract package.

It should be capable of managing (store, create, repeat, log, etc.) a generic and abstract workFlow of algorithms.

Make sure that all the code you add to this package is abstract!!!! You’ve been warned! No dependencies towards specific adapters should be included here.



Synchronization annotation. We try to mimic the same behavior as Java has with keyword synchronized, for methods.


Decorator that makes sure a function is executed in a ‘user’ environment, removing any TVB specific configurations that alter either LD_LIBRARY_PATH or LD_RUN_PATH.


This is intended to be a Benchmarking and Validator script.

class tvb.core.model_validations.ModelValidator(overwrites=None, settings_file=None)[source]

Bases: object


Prepare the arguments to be submitted and launch actual operations group. TODO: Now get the results and check if any errors

overwrites = {}


This module is called in a new process by the rpserver: Example: python 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.


Event attached to the local queue for executing an operation, when we will have resources available.


Created on Nov 1, 2011

Parameters:datatype_name – class-name; to search for a remover class for this.

Update removers dictionary.


class tvb.core.utils.TVBJSONEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)[source]

Bases: json.encoder.JSONEncoder

Custom encoder class. Referring towards “to_json” method, when found, or default behaviour otherwise.

tvb.core.utils.date2string(date_input, complex_format=True, date_format=None)[source]

Convert date into string, after internal format


Extract the first doc entry from a matlab file.

tvb.core.utils.format_bytes_human(size, si=False)[source]
  • size – size in kilobytes
  • si – if True use SI units (multiple of 1000 not 1024)

a String with [number] [memory unit measure]

tvb.core.utils.format_timedelta(timedelta, most_significant2=True)[source]

Format a datetime.timedelta. :param most_significant2: Will show only the 2 most significant units (ex: hours, minutes). Default True.


Generate new Global Unique Identifier. This identifier should be unique per each station, and unique for different machines.


Check If MATLAB is installed on current system. Return True or False. Return True, when MATLAB executable is found in Path.

tvb.core.utils.get_unique_file_name(storage_folder, file_name, try_number=0)[source]

Compute non-existent file name, in storage_folder. Try file_name, and if already exists, try adding a number.


From JSON with Unicodes, return a dictionary having strings as keys. Loading from DB a JSON will return instead of string keys, unicodes.


Prepare a File System Path for passing into an URL.

tvb.core.utils.store_list_data(data_list, file_name, storage_folder, overwrite=False)[source]

Write a list into a file using CSV writer. CSV writer, better than numpy, write also Strings

tvb.core.utils.string2array(input_data_str, split_char, dtype=None)[source]
Given an input string first try to load it using JSON and if that fails,
meaning some weird array is given by the user, fall-back to _custom_string2array.

Convert given string into boolean value.

tvb.core.utils.string2date(string_input, complex_format=True, date_format=None)[source]

Read date from string, after internal format


Retrieve File System Path from encoded URL (inverse of path2url_part).