protocol
Representations of experimental protocols: multiple Task
s grouped together with Graduation
objects.
Classes:
Metaclass for storing task parameters |
|
Base class for declaring trial data. |
|
An hdf5 group for an individual step within a protocol. |
|
The group and subgroups for a given protocol. |
|
Schema for storing data for a single step of a protocol |
|
- pydantic model Task_Params[source]
Bases:
autopilot.root.Autopilot_Type
Metaclass for storing task parameters
Todo
Not yet used in GUI, terminal, and subject classes. Will replace the dictionary structure ASAP
Show JSON schema
{ "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": {} }
- pydantic model Trial_Data[source]
Bases:
autopilot.data.modeling.base.Table
Base class for declaring trial data.
Tasks should subclass this and add any additional parameters that are needed. The subject class will then use this to create a table in the hdf5 file.
See
Nafc.TrialData
for an exampleShow JSON schema
{ "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" ] }
- pydantic model Step_Group[source]
Bases:
autopilot.data.interfaces.tables.H5F_Group
An hdf5 group for an individual step within a protocol.
Typically this is populated by passing a step number and a dictionary of step parameters.
- Parameters
step (int) – Step number within a protocol
group_path (str) – Path to the group within an HDF5 file
step_dict (dict) – Dictionary of step parameters. Either this or
step_name
must be passedstep_name (str) – Step name – if
step_dict
is not present, use this to generate a name for the created hdf5 grouptrial_data (
Trial_Data
) – Explicitly passed Trial_Data object. If not passed, get from thetask_type
parameter in thestep_dict
**data – passed to superclass __init__ method
Show JSON schema
{ "title": "Step_Group", "description": "An hdf5 group for an individual step within a protocol.\n\nTypically this is populated by passing a step number and a dictionary of step parameters.", "type": "object", "properties": { "path": { "title": "Path", "type": "string" }, "title": { "title": "Title", "default": "", "type": "string" }, "filters": { "title": "Filters" }, "attrs": { "title": "Attrs", "type": "object" }, "children": { "title": "Children" }, "step_name": { "title": "Step Name", "type": "string" }, "step": { "title": "Step", "type": "integer" }, "trial_data": { "title": "Trial Data" }, "continuous_group": { "title": "Continuous Group" } }, "required": [ "path", "step_name", "step" ] }
- Config
arbitrary_types_allowed: bool = True
- Fields
- field trial_data: Optional[Type[autopilot.data.models.protocol.Trial_Data]] = <class 'autopilot.data.models.protocol.Trial_Data'>
- field continuous_group: Optional[autopilot.data.interfaces.tables.H5F_Group] = None
- pydantic model Protocol_Group[source]
Bases:
autopilot.data.interfaces.tables.H5F_Group
The group and subgroups for a given protocol.
For each protocol, a main group is created that has the name of the protocol, and then subgroups are created for each of its steps.
Within each step group, a table is made for TrialData, and tables are created as-needed for continuous data.
For Example:
/ data |--- protocol_name |--- S##_step_name | |--- trial_data | |--- continuous_data |--- ... additional steps
Todo
Also make a Step group… what’s the matter with ya.
Override default __init__ method to populate a task’s groups.
Todo
When finished, replace the implicit structure of the protocol dictionary with
Task_Params
- Parameters
protocol_name (str) – Name of a protocol (filename minus
.json
)protocol (List[dict]) – A list of dictionaries, one with the parameters for each task level.
**data – passed to superclass init
Show JSON schema
{ "title": "Protocol_Group", "description": "The group and subgroups for a given protocol.\n\nFor each protocol, a main group is created that has the name of the protocol,\nand then subgroups are created for each of its steps.\n\nWithin each step group, a table is made for TrialData, and tables are created\nas-needed for continuous data.\n\nFor Example::\n\n / data\n |--- protocol_name\n |--- S##_step_name\n | |--- trial_data\n | |--- continuous_data\n |--- ... additional steps\n\n.. todo::\n\n Also make a Step group... what's the matter with ya.", "type": "object", "properties": { "path": { "title": "Path", "type": "string" }, "title": { "title": "Title", "default": "", "type": "string" }, "filters": { "title": "Filters" }, "attrs": { "title": "Attrs", "type": "object" }, "children": { "title": "Children" }, "protocol_name": { "title": "Protocol Name", "type": "string" }, "protocol": { "title": "Protocol", "type": "array", "items": { "type": "object" } }, "tabs": { "title": "Tabs" }, "steps": { "title": "Steps" } }, "required": [ "path", "protocol_name", "protocol" ] }
- Config
arbitrary_types_allowed: bool = True
- Fields
- field tabs: List[autopilot.data.interfaces.tables.H5F_Table] [Required]
- field steps: List[autopilot.data.models.protocol.Step_Group] [Required]
- pydantic model Step_Data[source]
Bases:
autopilot.data.modeling.base.Schema
Schema for storing data for a single step of a protocol
Show JSON schema
{ "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" ], "definitions": { "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" ] } } }
- Fields
- field task: autopilot.data.models.protocol.Task_Params [Required]
- field trial_data_table: autopilot.data.modeling.base.Table [Required]
- field trial_data: autopilot.data.models.protocol.Trial_Data [Required]
- pydantic model Protocol_Data[source]
Bases:
autopilot.data.modeling.base.Schema
Show JSON schema
{ "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" ], "definitions": { "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" ] } } }
- field steps: List[autopilot.data.models.protocol.Step_Data] [Required]