ImportExport class

(Shortest import: from brian2 import ImportExport)

class brian2.importexport.importexport.ImportExport[source]

Bases: object

Class for registering new import/export methods (via static methods). Also the base class that should be extended for such methods (ImportExport.export_data, ImportExport.import_data, and ImportExport.name have to be overwritten).

Attributes

methods A dictionary mapping import/export methods names to ImportExport objects
name Abstract property giving a method name.

Methods

export_data(group, variables) Asbtract static export data method with two obligatory parameters.
import_data(group, data) Import and set state variables.
register(importerexporter) Register a import/export method.

Details

methods

A dictionary mapping import/export methods names to ImportExport objects

name

Abstract property giving a method name.

static export_data(group, variables)[source]

Asbtract static export data method with two obligatory parameters. It should return a copy of the current state variable values. The returned arrays are copies of the actual arrays that store the state variable values, therefore changing the values in the returned dictionary will not affect the state variables.

Parameters:

group : Group

Group object.

variables : list of str

The names of the variables to extract.

static import_data(group, data)[source]

Import and set state variables.

Parameters:

group : Group

Group object.

data : dict_like

Data to import with variable names.

static register(importerexporter)[source]

Register a import/export method. Registered methods can be referred to via their name.

Parameters:

importerexporter : ImportExport

The importerexporter object, e.g. an DictImportExport.