visiomode.models.Session¶
- class visiomode.models.Session(animal_id: str, experiment: str, duration: float, protocol: None = None, spec: ~typing.Optional[dict] = None, complete: bool = False, timestamp: str = '2023-01-19T15:44:17.305559', notes: str = '', device: str = 'build-19216788-project-725858-visiomode', trials: ~typing.List[~visiomode.models.Trial] = <factory>)¶
Bases:
BaseSession model class.
- animal_id¶
String representing the animal identifier.
- Type
str
- experiment¶
A string holding the experiment identifier.
- Type
str
- protocol¶
An instance of the Protocol class.
- Type
None
- duration¶
Integer representing the session duration in minutes.
- Type
float
- complete¶
Boolean value indicating whether or not a session was completed
- Type
bool
- timestamp¶
A string with the session start date and time (ISO format). Defaults to current date and time.
- Type
str
- notes¶
String with additional session notes. Defaults to empty string
- Type
str
- device¶
String hostname of the device running the session. Defaults to the hostname provided by the socket lib.
- Type
str
- trials¶
A mutable list of session trials; each trial is an instance of the Trial dataclass.
- Type
List[visiomode.models.Trial]
- __init__(animal_id: str, experiment: str, duration: float, protocol: None = None, spec: ~typing.Optional[dict] = None, complete: bool = False, timestamp: str = '2023-01-19T15:44:17.305559', notes: str = '', device: str = 'build-19216788-project-725858-visiomode', trials: ~typing.List[~visiomode.models.Trial] = <factory>) None¶
Methods
__init__(animal_id, experiment, duration[, ...])save(path)Save session to json file.
to_dict()Returns class instance attributes as a dictionary.
to_json()Returns class instance attributes as JSON.
Attributes
spec- save(path)¶
Save session to json file.
- to_dict()¶
Returns class instance attributes as a dictionary.
This method overrides the Base class to cast nested Trial objects under self.trials as dictionaries.
- to_json()¶
Returns class instance attributes as JSON.