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.



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 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.


tvb.core.operation_hpc_launcher.do_operation_launch(simulator_gid, available_disk_space, is_group_launch, base_url, operation_id, plain_dir='/root/plain')[source]


Created on Nov 1, 2011

tvb.core.removers_factory.get_remover(datatype_index_class: HasTraitsIndex) Type[ABCRemover][source]

datatype_index_class – class of datatype index; to search for a remover class for this.

tvb.core.removers_factory.update_dictionary(new_dict: dict) None[source]

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, default=None)[source]

Bases: JSONEncoder

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


Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
        iterable = iter(o)
    except TypeError:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
tvb.core.utils.date2string(date_input, complex_format=True, date_format=None)[source]

Convert date into string, after internal format

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 timedelta: object timedelta to format :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.

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.prepare_time_slice(total_time_length, max_length=10000)[source]

Limit the time dimension when retrieving from TS. If total time length is greater than MAX, then retrieve only the last part of the TS

  • total_time_length – TS time dimension

  • max_length – limiting number of TS steps


python slice


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).