subject
Data models used by the Subject
class
Classes:
Table to describe parameter and protocol change history |
|
Table to track changes in version over time |
|
Class to describe table for weight history |
|
Group for collecting subject history tables. |
|
Status of assigned protocol. |
|
Structure of the |
|
Structure of the |
- pydantic model History[source]
Bases:
autopilot.data.modeling.base.Table
Table to describe parameter and protocol change history
Show JSON schema
{ "title": "History", "description": "Table to describe parameter and protocol change history", "type": "object", "properties": { "time": { "title": "Time", "type": "array", "items": { "type": "string", "format": "date-time" } }, "type": { "title": "Type", "type": "array", "items": { "type": "string" } }, "name": { "title": "Name", "type": "array", "items": { "type": "string" } }, "value": { "title": "Value", "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "object" } } ] } } }, "required": [ "time", "type", "name", "value" ] }
- Fields
- Validators
- field time: List[datetime.datetime] [Required]
Timestamps for history changes
- Validated by
- field name: List[str] [Required]
Which parameter was changed, name of protocol, manual vs. graduation step change
- pydantic model Hashes[source]
Bases:
autopilot.data.modeling.base.Table
Table to track changes in version over time
Show JSON schema
{ "title": "Hashes", "description": "Table to track changes in version over time", "type": "object", "properties": { "time": { "title": "Time", "type": "array", "items": { "type": "string", "format": "date-time" } }, "hash": { "title": "Hash", "type": "array", "items": { "type": "string" } }, "version": { "title": "Version", "type": "array", "items": { "type": "string" } }, "id": { "title": "Id", "type": "array", "items": { "type": "string" } } }, "required": [ "time", "hash", "version", "id" ] }
- field time: List[datetime.datetime] [Required]
Timestamps for entries
- pydantic model Weights[source]
Bases:
autopilot.data.modeling.base.Table
Class to describe table for weight history
Show JSON schema
{ "title": "Weights", "description": "Class to describe table for weight history", "type": "object", "properties": { "start": { "title": "Start", "type": "array", "items": { "type": "number" } }, "stop": { "title": "Stop", "type": "array", "items": { "type": "number" } }, "date": { "title": "Date", "type": "array", "items": { "type": "string", "format": "date-time" } }, "session": { "title": "Session", "type": "array", "items": { "type": "integer" } } }, "required": [ "start", "stop", "date", "session" ] }
- Fields
- Validators
- field date: List[datetime.datetime] [Required]
Timestamp of task start
- Validated by
- pydantic model History_Group[source]
Bases:
autopilot.data.modeling.base.Group
Group for collecting subject history tables.
Typically stored in
/history
in the subject .h5f fileShow JSON schema
{ "title": "History_Group", "description": "Group for collecting subject history tables.\n\nTypically stored in ``/history`` in the subject .h5f file", "type": "object", "properties": { "children": { "title": "Children", "type": "array", "items": { "$ref": "#/definitions/Node" } }, "history": { "$ref": "#/definitions/History" }, "hashes": { "$ref": "#/definitions/Hashes" }, "weights": { "$ref": "#/definitions/Weights" }, "past_protocols": { "$ref": "#/definitions/Group" } }, "required": [ "history", "hashes", "weights", "past_protocols" ], "definitions": { "Node": { "title": "Node", "description": "Abstract representation of a Node in a treelike or linked data structure.\nThis should be extended by interfaces when relevant and needed to implement\nan abstract representation of their structure.\n\nThis class purposely lacks structure like a path or parents pending further\nusage in interfaces to see what would be the best means of implementing them.", "type": "object", "properties": {} }, "History": { "title": "History", "description": "Table to describe parameter and protocol change history", "type": "object", "properties": { "time": { "title": "Time", "type": "array", "items": { "type": "string", "format": "date-time" } }, "type": { "title": "Type", "type": "array", "items": { "type": "string" } }, "name": { "title": "Name", "type": "array", "items": { "type": "string" } }, "value": { "title": "Value", "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "object" } } ] } } }, "required": [ "time", "type", "name", "value" ] }, "Hashes": { "title": "Hashes", "description": "Table to track changes in version over time", "type": "object", "properties": { "time": { "title": "Time", "type": "array", "items": { "type": "string", "format": "date-time" } }, "hash": { "title": "Hash", "type": "array", "items": { "type": "string" } }, "version": { "title": "Version", "type": "array", "items": { "type": "string" } }, "id": { "title": "Id", "type": "array", "items": { "type": "string" } } }, "required": [ "time", "hash", "version", "id" ] }, "Weights": { "title": "Weights", "description": "Class to describe table for weight history", "type": "object", "properties": { "start": { "title": "Start", "type": "array", "items": { "type": "number" } }, "stop": { "title": "Stop", "type": "array", "items": { "type": "number" } }, "date": { "title": "Date", "type": "array", "items": { "type": "string", "format": "date-time" } }, "session": { "title": "Session", "type": "array", "items": { "type": "integer" } } }, "required": [ "start", "stop", "date", "session" ] }, "Group": { "title": "Group", "description": "A generic representation of a \"Group\" if present in a given interface.\nUseful for when, for example in a given container format you want to\nmake an empty group that will be filled later, or one that has to be\npresent for syntactic correctness.\n\nA children attribute is present because it is definitive of groups, but\nshould be overridden by interfaces that use it.", "type": "object", "properties": { "children": { "title": "Children", "type": "array", "items": { "$ref": "#/definitions/Node" } } } } } }
- Fields
- field history: autopilot.data.models.subject.History [Required]
- field hashes: autopilot.data.models.subject.Hashes [Required]
- field weights: autopilot.data.models.subject.Weights [Required]
- field past_protocols: autopilot.data.modeling.base.Group [Required]
- pydantic model Protocol_Status[source]
Bases:
autopilot.data.modeling.base.Attributes
Status of assigned protocol. Accessible from the
Subject.protocol
getter/setterSee
Subject.assign_protocol()
.Show JSON schema
{ "title": "Protocol_Status", "description": "Status of assigned protocol. Accessible from the :attr:`.Subject.protocol` getter/setter\n\nSee :meth:`.Subject.assign_protocol`.", "type": "object", "properties": { "current_trial": { "title": "Current Trial", "type": "integer" }, "session": { "title": "Session", "type": "integer" }, "step": { "title": "Step", "type": "integer" }, "protocol": { "title": "Protocol", "type": "array", "items": { "type": "object" } }, "protocol_name": { "title": "Protocol Name", "type": "string" }, "pilot": { "title": "Pilot", "description": "Pilot that this subject runs on", "type": "string" }, "assigned": { "title": "Assigned", "type": "string", "format": "date-time" } }, "required": [ "current_trial", "session", "step", "protocol", "protocol_name" ] }
- Fields
- field current_trial: int [Required]
Current or last trial that was run in the particular level of the protocol. Continues to increment across sessions, resets across different levels of the protocol.
- field protocol: List[dict] [Required]
The full definition of the steps (individual tasks) that define the protocol
- field protocol_name: str [Required]
Name of the assigned protocol, typically the filename this protocol is stored in minus .json
- field pilot: Optional[str] = None
The ID of the pilot that this subject does their experiment on
Pilot that this subject runs on
- field assigned: datetime.datetime [Optional]
The time that this protocol was assigned. If not passed explicitly, generated each time the protocol status is changed.
- pydantic model Subject_Structure[source]
Bases:
autopilot.data.modeling.base.Schema
Structure of the
Subject
class’s hdf5 fileShow JSON schema
{ "title": "Subject_Structure", "description": "Structure of the :class:`.Subject` class's hdf5 file", "type": "object", "properties": { "info": { "title": "Info" }, "data": { "title": "Data" }, "protocol": { "title": "Protocol" }, "history": { "title": "History" } } }
- Fields
- pydantic model Subject_Schema[source]
Bases:
autopilot.data.modeling.base.Schema
Structure of the
Subject
class’s hdf5 fileTodo
Convert this into an abstract representation of data rather than literally hdf5 tables.
At the moment twins
Subject_Structure
Show JSON schema
{ "title": "Subject_Schema", "description": "Structure of the :class:`.Subject` class's hdf5 file\n\n.. todo::\n\n Convert this into an abstract representation of data rather than literally hdf5 tables.\n\n At the moment twins :class:`.Subject_Structure`", "type": "object", "properties": { "info": { "$ref": "#/definitions/Biography" }, "data": { "$ref": "#/definitions/Protocol_Data" }, "protocol": { "$ref": "#/definitions/Protocol_Status" }, "past_protocols": { "title": "Past Protocols", "type": "array", "items": { "$ref": "#/definitions/Protocol_Status" } }, "history": { "$ref": "#/definitions/History_Group" } }, "required": [ "info", "data", "protocol", "past_protocols", "history" ], "definitions": { "Breeding": { "title": "Breeding", "description": "Information about the breeding conditions of the subject", "type": "object", "properties": { "parents": { "title": "Parents", "description": "The IDs of the parents of this subject, if any", "type": "array", "items": { "type": "string" } }, "litter": { "title": "Litter", "description": "The identifying number or tag of the litter this subject was born in", "anyOf": [ { "type": "string" }, { "type": "integer" } ] } }, "required": [ "parents", "litter" ] }, "Enclosure": { "title": "Enclosure", "description": "Where does the subject live?", "type": "object", "properties": { "box": { "title": "Box", "description": "The number or name of the box this subject lives in, if any", "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "building": { "title": "Building", "description": "The name of the building that the subject is housed in", "type": "string" }, "room": { "title": "Room", "description": "The room number that the animal is housed in", "anyOf": [ { "type": "string" }, { "type": "integer" } ] } } }, "Baselines": { "title": "Baselines", "description": "Baseline health measurements for animal care regulation. In the future this\nwill be integrated with a TrialManager class to titrate trials to ensure experimental\nsubjects remain healthy.", "type": "object", "properties": { "mass": { "title": "Mass", "description": "Mass (grams) of the animal before any experimental manipulation", "type": "number" }, "minimum_pct": { "title": "Minimum Pct", "description": "The proportion (0-1) of the baseline mass that the animal is not allowed to fall under", "type": "number" } } }, "Gene": { "title": "Gene", "description": "An individual (trans)gene that an animal may have.\n\nI am not a geneticist, lmk what this should look like", "type": "object", "properties": { "name": { "title": "Name", "description": "The name of this gene", "type": "string" }, "zygosity": { "title": "Zygosity", "description": "One of typing.Literal['heterozygous', 'homozygous']", "enum": [ "heterozygous", "homozygous" ], "type": "string" } }, "required": [ "name" ] }, "Genotype": { "title": "Genotype", "description": "Genotyping information, information about a subject's background and (potentially multiple) :class:`.Gene` s of interest\n\n.. todo::\n\n Call Jax's API to get a list of available strain names", "type": "object", "properties": { "strain": { "title": "Strain", "description": "The strain or background line of this subject, if any", "type": "string" }, "genes": { "title": "Genes", "description": "A list of any transgenes that this animal has", "type": "array", "items": { "$ref": "#/definitions/Gene" } } } }, "Biography": { "title": "Biography", "description": "The combined biographical, health, genetic, and other details that define an experimental subject.\n\nThis is stored within the ``/info`` node in a typical :class:`.Subject` file as\nmetadata attributes, and accessible from :attr:`.Subject.info`\n\n**Development Goals**\n\n- Interface with the NWB biographical information schema.", "type": "object", "properties": { "id": { "title": "Id", "description": "The indentifying string, name, subject_id, etc. for this subject. This value is also used to name the related Subject file, like {id}.h5, so these are typically expected to be unique. If None is provided, a uuid.uuid4() will be generated (which will be ugly so you probably want to give an id).", "type": "string" }, "start_date": { "title": "Start Date", "description": "The date that this subject file was created. Not that this is not necessarily the date that the subject began training, which is more reliably determined from the timestamps within the data. If none is provided, generated from current time.", "type": "string", "format": "date-time" }, "dob": { "title": "Dob", "description": "The subject's date of birth. A datetime is allowed, but hours and minutes are typically not reliable. A time of midnight formally indicates that the hour and minute is not precise.", "type": "string", "format": "date-time" }, "sex": { "title": "Sex", "description": "Sex of the subject, one of typing.Literal['F', 'M', 'U', 'O']. See :data:`.SEX`", "default": "U", "enum": [ "F", "M", "U", "O" ], "type": "string" }, "description": { "title": "Description", "description": "Some lengthier description of the subject, idk go hogwild.", "type": "string" }, "tags": { "title": "Tags", "description": "Any additional key/value tags that apply to this subject. Idiosyncratic metadata can be stored here, but caution should be taken to not overload this field and instead extend the Biography class because these values will not be included in any resulting schema.", "type": "object" }, "species": { "title": "Species", "description": "Species of subject, no recommendation common vs. latin names, but will be integrated with linked data schemas in the future", "type": "string" }, "breeding": { "$ref": "#/definitions/Breeding" }, "enclosure": { "$ref": "#/definitions/Enclosure" }, "baselines": { "$ref": "#/definitions/Baselines" }, "genotype": { "$ref": "#/definitions/Genotype" } } }, "Task_Params": { "title": "Task_Params", "description": "Metaclass for storing task parameters\n\n.. todo::\n\n Not yet used in GUI, terminal, and subject classes. Will replace the dictionary structure ASAP", "type": "object", "properties": {} }, "Table": { "title": "Table", "description": "Tabular data: each field will have multiple values -- in particular an equal number across fields.\n\nUsed for trialwise data, and can be used to create pytables descriptions.\n\n.. todo::\n\n To make this usable as a live container of data, the fields need to be declared as Lists (eg. instead of just\n declaring something an ``int``, it must be specified as a ``List[int]`` to pass validation. We should expand this\n model to relax that constraint and effectively treat every field as containing a list of values.", "type": "object", "properties": {} }, "Trial_Data": { "title": "Trial_Data", "description": "Base class for declaring trial data.\n\nTasks should subclass this and add any additional parameters that are needed.\nThe subject class will then use this to create a table in the hdf5 file.\n\nSee :attr:`.Nafc.TrialData` for an example", "type": "object", "properties": { "group": { "title": "Group", "description": "Path of the parent step group", "type": "string" }, "session": { "title": "Session", "description": "Current training session, increments every time the task is started", "type": "integer" }, "session_uuid": { "title": "Session Uuid", "description": "Each session gets a unique uuid, regardless of the session integer, to enable independent addressing of sessions when session numbers might overlap (eg. reassignment)", "type": "string" }, "trial_num": { "title": "Trial Num", "description": "Trial data is grouped within, well, trials, which increase (rather than resetting) across sessions within a task", "datajoint": { "key": true }, "type": "integer" } }, "required": [ "session", "trial_num" ] }, "Step_Data": { "title": "Step_Data", "description": "Schema for storing data for a single step of a protocol", "type": "object", "properties": { "task": { "$ref": "#/definitions/Task_Params" }, "trial_data_table": { "$ref": "#/definitions/Table" }, "trial_data": { "$ref": "#/definitions/Trial_Data" }, "continuous_data": { "title": "Continuous Data", "type": "object", "additionalProperties": { "type": "array", "items": {} } } }, "required": [ "task", "trial_data_table", "trial_data", "continuous_data" ] }, "Protocol_Data": { "title": "Protocol_Data", "description": "A special type of type intended to be a representation of an\nabstract structure/schema of data, rather than a live container of\ndata objects themselves. This class is used for constructing data containers,\ntranslating between formats, etc. rather than momentary data handling", "type": "object", "properties": { "steps": { "title": "Steps", "type": "array", "items": { "$ref": "#/definitions/Step_Data" } } }, "required": [ "steps" ] }, "Protocol_Status": { "title": "Protocol_Status", "description": "Status of assigned protocol. Accessible from the :attr:`.Subject.protocol` getter/setter\n\nSee :meth:`.Subject.assign_protocol`.", "type": "object", "properties": { "current_trial": { "title": "Current Trial", "type": "integer" }, "session": { "title": "Session", "type": "integer" }, "step": { "title": "Step", "type": "integer" }, "protocol": { "title": "Protocol", "type": "array", "items": { "type": "object" } }, "protocol_name": { "title": "Protocol Name", "type": "string" }, "pilot": { "title": "Pilot", "description": "Pilot that this subject runs on", "type": "string" }, "assigned": { "title": "Assigned", "type": "string", "format": "date-time" } }, "required": [ "current_trial", "session", "step", "protocol", "protocol_name" ] }, "Node": { "title": "Node", "description": "Abstract representation of a Node in a treelike or linked data structure.\nThis should be extended by interfaces when relevant and needed to implement\nan abstract representation of their structure.\n\nThis class purposely lacks structure like a path or parents pending further\nusage in interfaces to see what would be the best means of implementing them.", "type": "object", "properties": {} }, "History": { "title": "History", "description": "Table to describe parameter and protocol change history", "type": "object", "properties": { "time": { "title": "Time", "type": "array", "items": { "type": "string", "format": "date-time" } }, "type": { "title": "Type", "type": "array", "items": { "type": "string" } }, "name": { "title": "Name", "type": "array", "items": { "type": "string" } }, "value": { "title": "Value", "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "object" } } ] } } }, "required": [ "time", "type", "name", "value" ] }, "Hashes": { "title": "Hashes", "description": "Table to track changes in version over time", "type": "object", "properties": { "time": { "title": "Time", "type": "array", "items": { "type": "string", "format": "date-time" } }, "hash": { "title": "Hash", "type": "array", "items": { "type": "string" } }, "version": { "title": "Version", "type": "array", "items": { "type": "string" } }, "id": { "title": "Id", "type": "array", "items": { "type": "string" } } }, "required": [ "time", "hash", "version", "id" ] }, "Weights": { "title": "Weights", "description": "Class to describe table for weight history", "type": "object", "properties": { "start": { "title": "Start", "type": "array", "items": { "type": "number" } }, "stop": { "title": "Stop", "type": "array", "items": { "type": "number" } }, "date": { "title": "Date", "type": "array", "items": { "type": "string", "format": "date-time" } }, "session": { "title": "Session", "type": "array", "items": { "type": "integer" } } }, "required": [ "start", "stop", "date", "session" ] }, "Group": { "title": "Group", "description": "A generic representation of a \"Group\" if present in a given interface.\nUseful for when, for example in a given container format you want to\nmake an empty group that will be filled later, or one that has to be\npresent for syntactic correctness.\n\nA children attribute is present because it is definitive of groups, but\nshould be overridden by interfaces that use it.", "type": "object", "properties": { "children": { "title": "Children", "type": "array", "items": { "$ref": "#/definitions/Node" } } } }, "History_Group": { "title": "History_Group", "description": "Group for collecting subject history tables.\n\nTypically stored in ``/history`` in the subject .h5f file", "type": "object", "properties": { "children": { "title": "Children", "type": "array", "items": { "$ref": "#/definitions/Node" } }, "history": { "$ref": "#/definitions/History" }, "hashes": { "$ref": "#/definitions/Hashes" }, "weights": { "$ref": "#/definitions/Weights" }, "past_protocols": { "$ref": "#/definitions/Group" } }, "required": [ "history", "hashes", "weights", "past_protocols" ] } } }
- Fields
- field info: autopilot.data.models.biography.Biography [Required]
- field data: autopilot.data.models.protocol.Protocol_Data [Required]
- field protocol: autopilot.data.models.subject.Protocol_Status [Required]
- field past_protocols: List[autopilot.data.models.subject.Protocol_Status] [Required]
- field history: autopilot.data.models.subject.History_Group [Required]