Processed tables¶
These tables are written by this package from the raw acquisition data (see Raw data contract for the inputs). They are what you read when you follow the data access patterns.
| Table | Description | Where |
|---|---|---|
session |
One row per session | <root>/session.parquet |
sites |
One row per site | <root>/sites.parquet |
position_velocity |
Treadmill-derived position and velocity, one row per sample | <source_s3_location>/position_velocity.parquet |
licks |
Lickometer state changes, one row per lick onset or offset | <source_s3_location>/licks.parquet |
sniffing |
Sniff sensor trace, one row per sample | <source_s3_location>/sniffing.parquet |
software_events |
Events logged by the task software, one row per event | <source_s3_location>/software_events.parquet |
events |
Events derived from underlying streams, one row per event | <source_s3_location>/events.parquet |
session_id is the join key across all of them.
Every parquet file also carries packaging provenance in its schema metadata (packaging_version, data_contract_version, dataset_version, processor).
session¶
One row per session, in the aggregated session.parquet catalogue.
| Column | Type | Unit | Nullable | Description |
|---|---|---|---|---|
session_id |
str |
Session directory name (AIND naming convention); the join key for every other table. | ||
subject_id |
str |
Subject identifier, from the contraqctor Behavior/InputSchemas/Session stream. | ||
date |
datetime |
Session start, as recorded. Timezone-aware for current sessions; legacy sessions carry no offset and stay naive. | ||
dataset_version |
str |
Dataset schema version recorded in the session (from tasklogic_input.json). | ||
data_contract_version |
str |
Version of the aind-behavior-vr-foraging data-contract library used to parse this session. | ||
packaging_version |
str |
Version of the aind-behavior-vr-foraging-packaging library that produced this output. | ||
session |
JSON string |
The Session model instance used for the session. | ||
rig |
JSON string |
The Rig model instance used for the session. | ||
task_logic |
JSON string |
The Task Logic model instance used for the session. | ||
curriculum_enabled |
bool |
yes | Whether the session's TrainerState reports the subject as being on-curriculum. Null when the session has no trainer_state.json (curriculum tracking is optional). | |
curriculum_name |
str |
yes | Name of the curriculum recorded in the session's TrainerState, if any. | |
curriculum_stage_name |
str |
yes | Name of the curriculum stage recorded in the session's TrainerState, if any. | |
trainer_state |
JSON string |
yes | Raw TrainerState payload from the session's behavior/trainer_state.json, verbatim (includes active_policies), for discoverability without a second pass over the dataset. Null when the session has no trainer_state.json. |
Skip the config columns
session, rig, task_logic and trainer_state hold the full serialized configuration and make up nearly all of the file. Drop them when you do not need them.
sites¶
One row per site (the unit the animal visits in the corridor), in the aggregated sites.parquet, with a session_id column added when sessions are aggregated. Times are in seconds on the same clock as the stream tables below.
| Column | Type | Unit | Nullable | Description |
|---|---|---|---|---|
start_time |
float |
second | Start time, in software, for this site. | |
stop_time |
float |
second | Stop time, in software, for this site. | |
start_position |
float |
centimeter | Start coordinate for this site in the VR environment. | |
length |
float |
centimeter | The length of the site. | |
site_label |
str |
Label of the site | ||
friction |
float |
percentage | Assigned friction for the site. | |
patch_label |
str |
Patch type name | ||
odor_concentration |
list[float] |
percentage | An array representing the concentration levels of each odor channels. | |
odor_onset_time |
float |
second | yes | Time of odor onset. Will be null if no odor was delivered. |
reward_onset_time |
float |
second | yes | Time when reward was delivered. |
reward_amount |
float |
milliliter | yes | Amount of reward delivered. |
reward_probability |
float |
percentage | yes | Reward probability at the time of the reward delivery. Will be null if the reward is not sampled (e.g. has_choice is False). |
reward_available |
float |
milliliter | yes | Reward left at the time of reward delivery. Will be null if the reward is not sampled (e.g. has_choice is False). |
has_reward |
bool |
yes | Boolean whether reward was delivered, bool. | |
has_forced_rewards |
bool |
Whether a forced/manual reward was delivered in this site interval. See events table (event_name='ManualWaterDelivery') for exact times. | ||
choice_cue_time |
float |
second | yes | Time when choice cue was delivered. Also can be considered the stop cue. The choice tone is delivered when a stop is successful. |
has_choice |
bool |
yes | Defines whether a choice occurred in the site. | |
reward_delay_duration |
float |
second | yes | reward_onset_time - choice_cue_time. |
has_waited_reward_delay |
bool |
yes | Boolean whether the mouse successfully waited through the reward delay to get the reward. Will be null if has_choice is false. | |
last_stop_time |
float |
second | yes | Timestamp of the last stop (IsStopped transition to True) before the choice cue in this trial. Will be null if no choice occurred. |
last_stop_duration |
float |
second | yes | Duration from last_stop_time to choice_cue_time. Will be null if no choice occurred. |
velocity_at_last_stop |
float |
cm/s | yes | Animal velocity at the timestamp closest to last_stop_time. Will be null if last_stop_time is null. |
site_index |
int |
Site number within the session | ||
patch_index |
int |
Patch number within the session | ||
block_index |
int |
Block number within the session | ||
site_index_in_patch |
int |
Site number within the patch | ||
site_index_in_block |
int |
Site number within the block | ||
site_index_by_type |
int |
Site number only counting sites of the same type (e.g. RewardSite) | ||
site_index_in_patch_by_type |
int |
Same as site_in_patch_index but only counting sites of the same type (e.g. RewardSite) | ||
site_index_in_block_by_type |
int |
Same as site_in_block_index but only counting sites of the same type (e.g. RewardSite) | ||
patch_index_by_type |
int |
Patch number only counting patches of the same label | ||
patch_index_in_block |
int |
Patch number within the block | ||
patch_index_in_block_by_type |
int |
Same as patch_in_block_index but only counting patches of the same label |
Stream tables¶
Large tables stored once per session, in the session's own processed asset (source_s3_location in session.parquet). They are not aggregated. Each description below is the docstring of the processor that writes the table.
position_velocity¶
Bases: AbstractProcessor
Treadmill-derived position and velocity, one row per sample.
| Column | Type | Unit | Description |
|---|---|---|---|
timestamp |
float |
second | Harp time. |
position |
float |
centimeter | Position along the VR environment. |
velocity |
float |
cm/s | Velocity. |
licks¶
Bases: AbstractProcessor
Lickometer state changes, one row per lick onset or offset.
| Column | Type | Unit | Description |
|---|---|---|---|
timestamp |
float |
second | Harp time. |
is_lick_onset |
bool |
true for a lick onset, false for a lick offset. |
sniffing¶
Bases: AbstractProcessor
Sniff sensor trace, one row per sample.
The sampling rate is stored in the file's metadata as sampling_rate_hz.
| Column | Type | Unit | Description |
|---|---|---|---|
timestamp |
float |
second | Harp time. |
voltage |
float |
volt | Sniff sensor voltage. |
software_events¶
Bases: AbstractProcessor
Events logged by the task software, one row per event.
All SoftwareEvents streams are collected into a single tall DataFrame.
Software timestamps are low precision; do not use them to align to physiology data.
| Column | Type | Unit | Description |
|---|---|---|---|
timestamp |
float |
second | Harp time. |
event_name |
string |
Name of the event stream, e.g. ActiveSite. |
|
data |
string |
JSON-serialized payload. Its structure depends on the event, so parse it per event name. |
The data column is polymorphic. Parse it back with::
df["data"].apply(json.loads)
# or flatten a specific event type:
active_sites = df[df["event_name"] == "ActiveSite"]
pd.json_normalize(active_sites["data"].apply(json.loads).tolist())
Rows are sorted by harp timestamp (the DataFrame index, named "timestamp").
events¶
Bases: AbstractProcessor
Events derived from underlying streams, one row per event.
Collects derived/computed events into a single tall table, alongside SoftwareEventsProcessor's raw streams.
Each row is one event. Unlike SoftwareEventsProcessor, sources here are computed from one or more underlying streams rather than being a straight passthrough.
| Column | Type | Unit | Description |
|---|---|---|---|
timestamp |
float |
second | Harp time. |
event_name |
string |
Name of the event, e.g. ManualWaterDelivery. |
|
data |
float |
The event's payload. |
To add a new event source: write a @staticmethod(dataset) -> pd.DataFrame returning a
data-column frame indexed by timestamp, and append it to _EVENT_SOURCES.