Welcome to the AIND Behavior Device Olfactometer project documentation!¶
aind-behavior-device-olfactometer¶
A library with a SDK for the Olfactometer behavior task
📋 General instructions¶
This repository follows the project structure laid out in the Aind.Behavior.Services repository.
🔧 Prerequisites¶
🚀 Deployment¶
For convenience, once third-party dependencies are installed, Bonsai and python virtual environments can be bootstrapped by running:
./scripts/deploy.ps1
from the root of the repository.
⚙️ Generating settings files¶
The task is instantiated by a set of three settings files that strictly follow a DSL schema. These files are:
task_logic.jsonrig.jsonsession.json
Examples on how to generate these files can be found in the ./examples directory of the repository. Once generated, these are the only required inputs to run the Bonsai workflow in ./src/main.bonsai.
The workflow can thus be executed using the Bonsai CLI:
"./.bonsai/Bonsai.exe" "./src/main.bonsai" -p SessionPath=<path-to-session.json> -p RigPath=<path-to-rig.json> -p TaskLogicPath=<path-to-task_logic.json>
[> ] CLI tools¶
Task CLI¶
The platform exposes a few CLI tools to facilitate various tasks. Tools are available via:
uv run device-olfactometer <subcommand>
for a list of all sub commands available:
uv run device-olfactometer -h
You may need to install optional dependencies depending on the sub-commands you run.
🔍 Primary data quality-control¶
Once an experiment is collected, the primary data quality-control script can be run to check the data for issues. This script can be launched using:
uv run device-olfactometer data-qc <path-to-data-dir>
🗂️ AIND metadata mapping¶
After a calibration session is collected, acquisition.json, instrument.json and subject.json
(following aind-data-schema) can be
generated from Python:
from aind_behavior_device_olfactometer.data_mappers import map_dataset
mapped = map_dataset(
session_directory, # where the Bonsai workflow wrote its data
repository_path, # this repository's checkout
session_end_time=utcnow(),
)
mapped.write_standard_files(session_directory)
🔄 Regenerating schemas¶
DSL schemas can be modified in ./src/aind_behavior_device_olfactometer/rig.py (or (...)/task_logic.py).
Once modified, changes to the DSL must be propagated to json-schema and csharp API. This can be done by running:
uv run device-olfactometer regenerate