FileGenerator

class managers.operatorsTranscribe.metadata_filegenerator.FileGenerator

Available Methods:

Method name Method type
forfile() class method
get_modelID() static method
get_username() static method
get_testdescription() static method
get_labelname() static method
get_institution() static method
classmethod forfile(chosenmodel=None, simtime=None, vtest=None, username=None, labname=None, institutename=None)

Creates the NWB formatted metadata for an intended file to be saved.

Keyword Arguments:

Key Value type
chosenmodel instantiated model
simtime datetime.datetime when simulation started
vtest (optional) instantiated validation CerebUnit test
username (optional) string
labname (optional) string
institutename (optional) string

Returned value: It is a dictionary of the form

{ "session_description":    string;
  "identifier":             string,
  "session_start_time":     datetime,
  "experimenter":           string,
  "experiment_description": string,
  "session_id":             string,
  "lab":                    string,
  "institution":            string }

NOTE:

Use case:

>> fg = FileGenerator()

>> model = Xyz()

For simulation without validation test

>> filemd = fg.forfile(chosenmodel = model)

For simulation with validation test

>> vtest = SomeTest()

>> filemd = fg.forfile(chosenmodel=model, simtime=datetime.datetime.now(), test=vtest, username='john', labname='hbp brain sim lab', institute='CNRS-UNIC')

static get_institution(instname)

Returns the string “no institution was provided” if the argument is None otherwise it returns the attribute the argument (a string) itself.

Note: The argument should be the name of the institute.

static get_labname(labname)

Returns the string “no lab name was provided” if the argument is None otherwise it returns the attribute the argument (a string) itself.

Note: The argument should be the name of the laboratory.

static get_modelID(model)

Try extracting the uuid attribute value of the model and return it or return "no_model_uuid".

Argument: The instantiated model is passed into this function.

static get_testdescription(test)

Returns the string “raw simulation without running any CerebUnit test” if the argument is None otherwise it returns the attribute .description of the argument.

Note: The argument should be the test metadata.

static get_username(username)

Returns the username (also argument passed as a string) or returns “anonymous” if argument is None.