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.

@Developers:
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.

decorators

tvb.core.decorators.synchronized(lock)[source]

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

tvb.core.decorators.user_environment_execution(func)[source]

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.

model_validations

This is intended to be a Benchmarking and Validator script.

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

Bases: object

launch_validation()[source]

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

overwrites = {}
validate_results(last_verified_index)[source]
tvb.core.model_validations.main(settings_file)[source]

operation_async_launcher

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

tvb.core.operation_async_launcher.do_operation_launch(operation_id)[source]

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

removers_factory

Created on Nov 1, 2011

tvb.core.removers_factory.get_remover(datatype_name)[source]
Parameters:datatype_name – class-name; to search for a remover class for this.
tvb.core.removers_factory.update_dictionary(new_dict)[source]

Update removers dictionary.

utils

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.

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

Convert date into string, after internal format

tvb.core.utils.extract_matlab_doc_string(file_n)[source]

Extract the first doc entry from a matlab file.

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

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.

tvb.core.utils.generate_guid()[source]

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

tvb.core.utils.get_matlab_executable()[source]

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.

tvb.core.utils.parse_json_parameters(parameters)[source]

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

tvb.core.utils.path2url_part(file_path)[source]

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.
tvb.core.utils.string2bool(string_input)[source]

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

tvb.core.utils.url2path(encoded_path)[source]

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

Subpackages