basic Package

exceptions

exception tvb.basic.exceptions.TVBException(message, parent_exception=None)[source]

Bases: Exception

Base class for all TVB exceptions.

exception tvb.basic.exceptions.ValidationException(message, parent_exception=None)[source]

Bases: TVBException

Exception class for problems that occurs during HasTraits validations on fields.

profile

TVB Profile Manager (top level in TVB profile & settings).

This class is responsible for referring towards application settings, based on current running environment (e.g. dev vs deployment), or developer profile choice (e.g. web vs console).

class tvb.basic.profile.TvbProfile[source]

Bases: object

ENUM-like class with current TVB profile and accepted values.

ALL = ['LIBRARY_PROFILE', 'COMMAND_PROFILE', 'WEB_PROFILE', 'MATLAB_PROFILE', 'TEST_POSTGRES_PROFILE', 'TEST_SQLITE_PROFILE', 'TEST_LIBRARY_PROFILE']
COMMAND_PROFILE = 'COMMAND_PROFILE'
CURRENT_PROFILE_NAME = 'LIBRARY_PROFILE'
LIBRARY_PROFILE = 'LIBRARY_PROFILE'
MATLAB_PROFILE = 'MATLAB_PROFILE'
REGISTERED_PROFILES = {'LIBRARY_PROFILE': <class 'tvb.basic.config.profile_settings.LibrarySettingsProfile'>, 'MATLAB_PROFILE': <class 'tvb.basic.config.profile_settings.MATLABLibraryProfile'>, 'TEST_LIBRARY_PROFILE': <class 'tvb.basic.config.profile_settings.TestLibraryProfile'>}
TEST_LIBRARY_PROFILE = 'TEST_LIBRARY_PROFILE'
TEST_POSTGRES_PROFILE = 'TEST_POSTGRES_PROFILE'
TEST_SQLITE_PROFILE = 'TEST_SQLITE_PROFILE'
WEB_PROFILE = 'WEB_PROFILE'
current = <tvb.basic.config.profile_settings.LibrarySettingsProfile object>
env = <tvb.basic.config.environment.Environment object>
static is_first_run()[source]
static is_library_mode(new_profile=None)[source]
classmethod set_profile(selected_profile, in_operation=False, run_init=True)[source]

Sets TVB profile and do related initializations.

readers

This module contains basic reading mechanism for default DataType fields.

class tvb.basic.readers.FileReader(file_path)[source]

Bases: object

Read one or multiple numpy arrays from a text/bz2 file.

read_array(dtype=<class 'numpy.float64'>, skip_rows=0, use_cols=None, matlab_data_name=None)[source]
read_gain_from_brainstorm()[source]
class tvb.basic.readers.H5Reader(h5_path)[source]

Bases: object

Read one or many numpy arrays from a H5 file.

read_field(field, log_exception=True)[source]
read_optional_field(field)[source]
exception tvb.basic.readers.ReaderException[source]

Bases: Exception

class tvb.basic.readers.ZipReader(zip_path)[source]

Bases: object

Read one or many numpy arrays from a ZIP archive.

has_file_like(file_name)[source]
read_array_from_file(file_name, dtype=<class 'numpy.float64'>, skip_rows=0, use_cols=None, matlab_data_name=None)[source]
read_optional_array_from_file(file_name, dtype=<class 'numpy.float64'>, skip_rows=0, use_cols=None, matlab_data_name=None)[source]
tvb.basic.readers.copy_zip_entry_into_temp(source, file_suffix, buffer_size=1048576)[source]

Copy a ZIP Entry into a new file created under system temporary folder.

Parameters:
  • source – ZipEntry

  • file_suffix – String suffix to be added to the temporary file name

  • buffer_size – Buffer size used when copying the file-content

Returns:

the path towards the new file.

tvb.basic.readers.try_get_absolute_path(relative_module, file_suffix)[source]
Parameters:
  • relative_module – python module to be imported. When import of this fails, we will return the file_suffix

  • file_suffix – In case this is already an absolute path, return it immediately, otherwise append it after the module path

Returns:

Try to build an absolute path based on a python module and a file-suffix

Subpackages