The Virtual Brain Project

Table Of Contents

Previous topic

creators Package

Next topic

simulator Package

This Page

exporters Package

abcexporter

Root class for export functionality.

class tvb.adapters.exporters.abcexporter.ABCExporter[source]

Bases: object

Base class for all data type exporters This should provide common functionality for all TVB exporters.

accepts(data)[source]

This method specify if the current exporter can export provided data. :param data: data to be checked :returns: true if this data can be exported by current exporter, false otherwise.

export(data, export_folder, project)[source]

Actual export method, to be implemented in each sub-class.

Parameters:
  • data – data type to be exported
  • export_folder – folder where to write results of the export if needed. This is necessary in case new files are generated.
  • project – project that contains data to be exported
Returns:

a tuple with the following elements:

  1. name of the file to be shown to user
  2. full path of the export file (available for download)
  3. boolean which specify if file can be deleted after download

get_export_file_extension(data)[source]

This method computes the extension of the export file :param data: data type to be exported :returns: the extension of the file to be exported (e.g zip or h5)

get_export_file_name(data)[source]

This method computes the name used to save exported data on user computer

get_label()[source]

This method returns a string to be used on the UI controls to initiate export

Returns:string to be used on UI for starting this export. By default class name is returned
get_supported_types()[source]

This method specify what types are accepted by this exporter. Method should be implemented by each subclass and return an array with the supported types.

Returns:an array with the supported data types.
is_data_a_group(data)[source]

Checks if the provided data, ready for export is a DataTypeGroup or not

exceptions

Exceptions for Export mechanism.

exception tvb.adapters.exporters.exceptions.ExportException(message)[source]

Bases: tvb.basic.traits.exceptions.TVBException

Generic export exception.

exception tvb.adapters.exporters.exceptions.InvalidExportDataException(message)[source]

Bases: tvb.basic.traits.exceptions.TVBException

Exception thrown when an invalid data is provided for export

export_manager

Class responsible for all TVB exports (datatype or project).

class tvb.adapters.exporters.export_manager.ExportManager[source]

This class provides basic methods for exporting data types of projects in different formats.

EXPORT_FOLDER_NAME = 'EXPORT_TMP'
ZIP_FILE_EXTENSION = 'zip'
all_exporters = {}
export_burst(burst_id)[source]
Parameters:burst_id – ID for existing burst
Returns:JSON of burst representation.
export_data(data, exporter_id, project)[source]

Export provided data using given exporter :param data: data type to be exported :param exporter_id: identifier of the exporter to be used :param project: project that contains data to be exported

Returns:a tuple with the following elements 1. name of the file to be shown to user 2. full path of the export file (available for download) 3. boolean which specify if file can be deleted after download
export_folder = None
export_project(project, optimize_size=False)[source]

Given a project root and the TVB storage_path, create a ZIP ready for export. :param project: project object which identifies project to be exported

get_exporters_for_data(data)[source]

Get available exporters for current data type. :returns: a dictionary with the {exporter_id : label}

obj_export

class tvb.adapters.exporters.obj_export.ObjSurfaceExporter[source]

Bases: tvb.adapters.exporters.abcexporter.ABCExporter

Exports a tvb surface geometry in the obj format.

export(data, export_folder, project)[source]
get_export_file_extension(data)[source]
get_label()[source]
get_supported_types()[source]

tvb_export

class tvb.adapters.exporters.tvb_export.TVBExporter[source]

Bases: tvb.adapters.exporters.abcexporter.ABCExporter

This exporter simply provides for download data in TVB format

OPERATION_FOLDER_PREFIX = 'Operation_'
export(data, export_folder, project)[source]

Exports data type: 1. If data is a normal data type, simply exports storage file (HDF format) 2. If data is a DataTypeGroup creates a zip with all files for all data types

get_export_file_extension(data)[source]
get_label()[source]
get_supported_types()[source]