sollertia-experiment 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. sollertia_experiment-5.0.0/.claude/scheduled_tasks.lock +1 -0
  2. sollertia_experiment-5.0.0/.claude/settings.local.json +4 -0
  3. sollertia_experiment-5.0.0/.gitattributes +2 -0
  4. sollertia_experiment-5.0.0/.gitignore +213 -0
  5. sollertia_experiment-5.0.0/.netlify-site +1 -0
  6. sollertia_experiment-5.0.0/CLAUDE.md +294 -0
  7. sollertia_experiment-5.0.0/LICENSE +191 -0
  8. sollertia_experiment-5.0.0/PKG-INFO +1423 -0
  9. sollertia_experiment-5.0.0/README.md +1374 -0
  10. sollertia_experiment-5.0.0/assets/mesoscope_vr/README.md +169 -0
  11. sollertia_experiment-5.0.0/assets/mesoscope_vr/runAcquisition.m +713 -0
  12. sollertia_experiment-5.0.0/docs/Makefile +19 -0
  13. sollertia_experiment-5.0.0/docs/make.bat +35 -0
  14. sollertia_experiment-5.0.0/docs/source/api.rst +47 -0
  15. sollertia_experiment-5.0.0/docs/source/conf.py +45 -0
  16. sollertia_experiment-5.0.0/docs/source/index.rst +19 -0
  17. sollertia_experiment-5.0.0/docs/source/welcome.rst +23 -0
  18. sollertia_experiment-5.0.0/envs/sle_dev_lin.yml +210 -0
  19. sollertia_experiment-5.0.0/envs/sle_dev_osx.yml +198 -0
  20. sollertia_experiment-5.0.0/envs/sle_dev_win.yml +204 -0
  21. sollertia_experiment-5.0.0/pyproject.toml +274 -0
  22. sollertia_experiment-5.0.0/src/sollertia_experiment/__init__.py +24 -0
  23. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/__init__.py +95 -0
  24. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/data_preprocessing.py +344 -0
  25. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/filesystem_tools.py +27 -0
  26. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/google_sheet_tools.py +967 -0
  27. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/module_interfaces.py +1306 -0
  28. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/project_tools.py +37 -0
  29. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/shutdown_tools.py +35 -0
  30. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/system_configuration.py +171 -0
  31. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/terminal_prompts.py +150 -0
  32. sollertia_experiment-5.0.0/src/sollertia_experiment/cross_system/zaber_bindings.py +1139 -0
  33. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/__init__.py +3 -0
  34. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/entry_points.py +76 -0
  35. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/get.py +162 -0
  36. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/get_tools.py +243 -0
  37. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/mcp_instance.py +323 -0
  38. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/mcp_server.py +46 -0
  39. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/mesoscope_vr.py +708 -0
  40. sollertia_experiment-5.0.0/src/sollertia_experiment/interfaces/mesoscope_vr_tools.py +556 -0
  41. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/__init__.py +48 -0
  42. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/acquisition_components.py +1003 -0
  43. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/binding_classes.py +722 -0
  44. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/data_acquisition.py +1685 -0
  45. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/data_preprocessing.py +1438 -0
  46. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/maintenance_ui.py +1034 -0
  47. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/mesoscope_driver.py +526 -0
  48. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/runtime_ui.py +1788 -0
  49. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/system.py +797 -0
  50. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/system_controller.py +1885 -0
  51. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/system_health.py +173 -0
  52. sollertia_experiment-5.0.0/src/sollertia_experiment/mesoscope_vr/visualizer.py +889 -0
  53. sollertia_experiment-5.0.0/src/sollertia_experiment/py.typed +0 -0
  54. sollertia_experiment-5.0.0/src/sollertia_experiment/vr_task/__init__.py +14 -0
  55. sollertia_experiment-5.0.0/src/sollertia_experiment/vr_task/bridge.py +311 -0
  56. sollertia_experiment-5.0.0/src/sollertia_experiment/vr_task/configuration.py +55 -0
  57. sollertia_experiment-5.0.0/src/sollertia_experiment/vr_task/driver.py +744 -0
  58. sollertia_experiment-5.0.0/src/sollertia_experiment/vr_task/trial_decomposition.py +313 -0
  59. sollertia_experiment-5.0.0/tox.ini +151 -0
@@ -0,0 +1 @@
1
+ {"sessionId":"f068c88a-5160-4b07-844f-f15b36536ead","pid":2260352,"procStart":"101985338","acquiredAt":1782048478949}
@@ -0,0 +1,4 @@
1
+ {
2
+ "enabledMcpjsonServers": [],
3
+ "enableAllProjectMcpServers": true
4
+ }
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,213 @@
1
+ # This version of gitignore is designed to work for python projects using C++ computational core. It has been
2
+ # configured, it to exclude certain jetbrains files, but additional configuration may be needed for contributors
3
+ # seeking to use VSCode or other IDE / code editor.
4
+
5
+ # Prerequisites
6
+ *.d
7
+
8
+ # Compiled Object files
9
+ *.slo
10
+ *.lo
11
+ *.o
12
+ *.obj
13
+
14
+ # Precompiled Headers
15
+ *.gch
16
+ *.pch
17
+
18
+ # Compiled Dynamic libraries
19
+ *.so
20
+ *.dylib
21
+ *.dll
22
+
23
+ # Fortran module files
24
+ *.mod
25
+ *.smod
26
+
27
+ # Compiled Static libraries
28
+ *.lai
29
+ *.la
30
+ *.a
31
+ *.lib
32
+
33
+ # Executables
34
+ *.exe
35
+ *.out
36
+ *.app
37
+
38
+ # Platformio files
39
+ *.pio
40
+
41
+ # Byte-compiled / optimized / DLL files
42
+ __pycache__/
43
+ *.py[cod]
44
+ *$py.class
45
+
46
+ # Distribution / packaging
47
+ .Python
48
+ build/
49
+ develop-eggs/
50
+ dist/
51
+ downloads/
52
+ eggs/
53
+ .eggs/
54
+ lib/
55
+ lib64/
56
+ parts/
57
+ sdist/
58
+ var/
59
+ wheels/
60
+ share/python-wheels/
61
+ *.egg-info/
62
+ .installed.cfg
63
+ *.egg
64
+ MANIFEST
65
+
66
+ # PyInstaller
67
+ # Usually these files are written by a python script from a template
68
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
69
+ *.manifest
70
+ *.spec
71
+
72
+ # Installer logs
73
+ pip-log.txt
74
+ pip-delete-this-directory.txt
75
+
76
+ # Unit test / coverage reports
77
+ htmlcov/
78
+ .tox/
79
+ .nox/
80
+ .coverage
81
+ .coverage.*
82
+ .cache
83
+ nosetests.xml
84
+ coverage.xml
85
+ *.cover
86
+ *.py,cover
87
+ .hypothesis/
88
+ .pytest_cache/
89
+ cover/
90
+
91
+ # Translations
92
+ *.mo
93
+ *.pot
94
+
95
+ # Django stuff:
96
+ *.log
97
+ local_settings.py
98
+ db.sqlite3
99
+ db.sqlite3-journal
100
+
101
+ # Flask stuff:
102
+ instance/
103
+ .webassets-cache
104
+
105
+ # Scrapy stuff:
106
+ .scrapy
107
+
108
+ # Sphinx documentation
109
+ docs/_build/
110
+
111
+ # PyBuilder
112
+ .pybuilder/
113
+ target/
114
+
115
+ # Jupyter Notebook
116
+ .ipynb_checkpoints
117
+
118
+ # IPython
119
+ profile_default/
120
+ ipython_config.py
121
+
122
+ # pyenv
123
+ # For a library or package, you might want to ignore these files since the code is
124
+ # intended to run in multiple environments; otherwise, check them in:
125
+ # python-version
126
+
127
+ # pipenv
128
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
129
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
130
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
131
+ # install all needed dependencies.
132
+ #Pipfile.lock
133
+
134
+ # poetry
135
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
136
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
137
+ # commonly ignored for libraries.
138
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
139
+ #poetry.lock
140
+
141
+ # pdm
142
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
143
+ #pdm.lock
144
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
145
+ # in version control.
146
+ # https://pdm.fming.dev/#use-with-ide
147
+ .pdm.toml
148
+
149
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
150
+ __pypackages__/
151
+
152
+ # Celery stuff
153
+ celerybeat-schedule
154
+ celerybeat.pid
155
+
156
+ # SageMath parsed files
157
+ *.sage.py
158
+
159
+ # Environments
160
+ .env
161
+ .venv
162
+ env/
163
+ venv/
164
+ ENV/
165
+ env.bak/
166
+ venv.bak/
167
+
168
+ # Spyder project settings
169
+ .spyderproject
170
+ .spyproject
171
+
172
+ # Rope project settings
173
+ .ropeproject
174
+
175
+ # mkdocs documentation
176
+ /site
177
+
178
+ # mypy
179
+ .mypy_cache/
180
+ .dmypy.json
181
+ dmypy.json
182
+
183
+ # Pyre type checker
184
+ .pyre/
185
+
186
+ # pytype static type analyzer
187
+ .pytype/
188
+
189
+ # Cython debug symbols
190
+ cython_debug/
191
+
192
+ # PyCharm
193
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
194
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
195
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
196
+ # option (not recommended) you can uncomment the following to ignore the entire idea directory.
197
+ .idea/
198
+
199
+ # OSx
200
+ .DS_Store
201
+
202
+ # Project files that are part of the general Sollertia platform C-Python project architecture that should not be
203
+ # uploaded to and from Github
204
+ /cmake-build-debug/
205
+ /reports/
206
+ /docs/source/doxygen/
207
+ /docs/build/
208
+ /stubs/
209
+ /.pypirc
210
+ /.netlifyrc
211
+
212
+ # Project: Add any project-specific exclusions here
213
+ /temp
@@ -0,0 +1 @@
1
+ sollertia-experiment-api-docs.netlify.app
@@ -0,0 +1,294 @@
1
+ # Claude Code Instructions
2
+
3
+ ## Session start behavior
4
+
5
+ At the beginning of each coding session, before making any code changes, you MUST build a comprehensive understanding
6
+ of the codebase by invoking the `automation:explore-codebase` skill.
7
+
8
+ ## Style guide compliance
9
+
10
+ You MUST invoke the appropriate `automation:*` style skill before performing ANY of the following tasks:
11
+
12
+ | Task | Skill to invoke |
13
+ |-----------------------------------|------------------------------|
14
+ | Writing or modifying Python code | `automation:python-style` |
15
+ | Writing or modifying README files | `automation:readme-style` |
16
+ | Writing git commit messages | `automation:commit` |
17
+ | Writing or modifying skill files | `automation:skill-design` |
18
+ | Modifying pyproject.toml | `automation:pyproject-style` |
19
+ | Modifying tox.ini | `automation:tox-config` |
20
+ | Modifying Sphinx documentation | `automation:api-docs` |
21
+
22
+ Each skill contains verification checklists that you MUST complete before submitting any work.
23
+
24
+ ## Cross-referenced library verification
25
+
26
+ This library depends on `ataraxis-time`, `ataraxis-base-utilities`, `ataraxis-data-structures`,
27
+ `ataraxis-transport-layer-pc`, `ataraxis-communication-interface`, `ataraxis-video-system`, and
28
+ `sollertia-shared-assets`, each pinned to an exact version in `pyproject.toml`. It also drives the
29
+ `sollertia-micro-controllers` firmware over serial and the `sollertia-virtual-reality` Unity project over MQTT. Local
30
+ clones of all of these typically live alongside this repository, in its parent directory. The external tool bindings
31
+ below are reached as subprocesses instead, so none of them is version-checked here.
32
+
33
+ **Before writing code that interacts with a cross-referenced library, you MUST:**
34
+
35
+ 1. **Check for local version**: Look for the library in the parent directory (e.g.,
36
+ `../ataraxis-communication-interface/`, `../ataraxis-video-system/`, and `../sollertia-shared-assets/`).
37
+
38
+ 2. **Compare versions**: If a local copy exists, compare its version against the latest release or main branch on
39
+ GitHub:
40
+ - Read the local `pyproject.toml` to get the current version
41
+ - Use `gh api repos/Sun-Lab-NBB/{repo-name}/releases/latest` to check the latest release
42
+ - Alternatively, check the main branch version on GitHub
43
+
44
+ 3. **Handle version mismatches**: If the local version differs from the latest release or main branch, notify the user
45
+ with the following options:
46
+ - **Use online version**: Fetch documentation and API details from the GitHub repository
47
+ - **Update local copy**: The user will pull the latest changes locally before proceeding
48
+
49
+ 4. **Proceed with correct source**: Use whichever version the user selects as the authoritative reference for API
50
+ usage, patterns, and documentation.
51
+
52
+ ## Available skills
53
+
54
+ The sollertia marketplace ships two plugins that target this library directly: the system-agnostic `experiment` core
55
+ plugin and the `mesoscope` plugin (Mesoscope-VR system-specific skills, layered on `experiment`). Both are backed by the
56
+ `sollertia-experiment` MCP server (`sle mcp`). The ataraxis marketplace ships the `automation` plugin used across all
57
+ Sollertia platform repositories. Low-level hardware work also draws on the `video`, `communication`, and
58
+ `microcontroller` plugins, and configuration authoring draws on the `assets` plugin (see Downstream library integration
59
+ below). The table lists the `automation`, `experiment`, and `mesoscope` skills alone, and this file names each
60
+ cross-plugin skill at its point of use.
61
+
62
+ | Skill | Description |
63
+ |-------------------------------------------------|----------------------------------------------------------------------|
64
+ | `automation:explore-codebase` | Perform in-depth codebase exploration at session start |
65
+ | `automation:explore-dependencies` | Explore installed dependency source to build a live API snapshot |
66
+ | `automation:python-style` | Apply Sollertia platform Python conventions (REQUIRED for .py edits) |
67
+ | `automation:readme-style` | Apply Sollertia platform README conventions (REQUIRED for READMEs) |
68
+ | `automation:commit` | Draft Sollertia platform style-compliant commit messages |
69
+ | `automation:pr` | Draft a style-compliant pull request summary |
70
+ | `automation:release` | Draft style-compliant release notes |
71
+ | `automation:pyproject-style` | Apply Sollertia platform pyproject.toml conventions |
72
+ | `automation:tox-config` | Apply Sollertia platform tox.ini conventions |
73
+ | `automation:api-docs` | Apply Sollertia platform Sphinx documentation conventions |
74
+ | `automation:project-layout` | Apply Sollertia platform directory structure conventions |
75
+ | `automation:skill-design` | Generate, update, and verify skill files and this CLAUDE.md |
76
+ | `automation:audit-correctness` | Audit source for active and latent bugs |
77
+ | `automation:audit-facts` | Audit documentation against source code for factual accuracy |
78
+ | `automation:audit-performance` | Audit source for algorithmic, allocation, and dtype costs |
79
+ | `automation:audit-project` | Orchestrate all four audits and merge their findings |
80
+ | `automation:audit-style` | Audit files against the applicable style skill checklists |
81
+ | `experiment:pipeline` | Orchestrate the end-to-end experiment lifecycle |
82
+ | `experiment:system-design-pipeline` | Orchestrate building a new acquisition system end-to-end |
83
+ | `experiment:acquisition-system-design` | Design a new acquisition system (config, bindings, runtime) |
84
+ | `experiment:acquisition-system-runtime` | Runtime pattern: per-mode logic, state machine, dispatch |
85
+ | `experiment:acquisition-system-setup` | Discover and verify connected acquisition hardware |
86
+ | `experiment:library-extension` | Extension seams for a new acquisition system across sle and slmc |
87
+ | `experiment:system-health-check` | Pre-flight checks of configuration, mounts, and hardware |
88
+ | `experiment:zaber-interface` | Implement Zaber motor interfaces and binding classes |
89
+ | `experiment:microcontroller-interface` | Paired Module + ModuleInterface registry and conventions |
90
+ | `experiment:vr-driver-interface` | VR task driver, Unity MQTT contract, trial decomposition |
91
+ | `experiment:data-management` | Preprocess, migrate, and delete session data via `sle mcp` |
92
+ | `experiment:google-sheets-processing` | Implement SurgeryLog / WaterLog Google Sheets processors |
93
+ | `experiment:cli-reference` | Document the `sle` root, `sle mcp`, and `sle get` CLI surface |
94
+ | `experiment:external-tool-bindings` | Bind a tool that cannot be installed beside the stack |
95
+ | `experiment:experiment-mcp-environment-setup` | Diagnose `sle mcp` server connectivity issues |
96
+ | `mesoscope:mesoscope-vr` | Mesoscope-VR hardware inventory, configuration, and bindings |
97
+ | `mesoscope:mesoscope-vr-runtime` | Mesoscope-VR state machine, orchestrator, UIs, and CLI |
98
+ | `mesoscope:mesoscope-vr-snapshots` | Read/write per-session Zaber and Mesoscope position snapshots |
99
+ | `mesoscope:mesoscope-vr-session-schema` | Mesoscope-VR session descriptor and hardware-state field schema |
100
+ | `mesoscope:mesoscope-vr-experiment-schema` | Mesoscope-VR experiment configuration and trial-class field schema |
101
+ | `mesoscope:mesoscope-vr-processing-schema` | Processed filename rosters and the assembled column schema |
102
+ | `mesoscope:mesoscope-vr-module-parsing` | Per-module log parser registry and processed feather schemas |
103
+ | `mesoscope:mesoscope-vr-trial-decomposition` | Runtime log decomposition into cue, trigger zone, and trial data |
104
+ | `mesoscope:mesoscope-vr-fluorescence-alignment` | Fluorescence TTL frame alignment and ScanImage metadata fallback |
105
+ | `mesoscope:mesoscope-vr-video-tracking` | Pupil tracking pass and per-camera video sub-dataset assembly |
106
+ | `mesoscope:mesoscope-vr-imaging-configuration` | Two-photon imaging locators and cindra configuration resolvers |
107
+ | `mesoscope:mesoscope-vr-dataset-assembly` | Session-assembly worker and admission policy for forged datasets |
108
+ | `mesoscope:mesoscope-vr-cli-reference` | Reference for the `sle mesoscope` commands and their options |
109
+
110
+ ## MCP server
111
+
112
+ The library ships one MCP server, started with `sle mcp` and selecting its transport through `-t/--transport`
113
+ (`stdio` by default, `streamable-http` otherwise). It exposes two tool sets, the hardware-agnostic tools in
114
+ `interfaces/get_tools.py` and the Mesoscope-VR tools in `interfaces/mesoscope_vr_tools.py`. Neither set mirrors its
115
+ `sle` CLI counterpart, and the README lists every tool with its purpose.
116
+
117
+ `set_zaber_device_setting_tool` and `delete_session_tool` refuse to act until the caller passes an explicit `confirm`
118
+ or `confirm_deletion` value. You MUST warn the user about the consequences and obtain a decision before retrying
119
+ either tool with `yes`.
120
+
121
+ `interfaces/mcp_server.py` discovers tool modules by their `*_tools.py` filename suffix and imports each one, so a new
122
+ acquisition system registers its tools by adding `interfaces/{system}_tools.py` and needs no edit to the server module.
123
+ The CLI side carries no equivalent discovery, so that system's command group reaches the top-level `sle` group only
124
+ after one import and one `add_command()` call are added to `_register_subcommands()` in `interfaces/entry_points.py`.
125
+ The server deliberately omits the assets, video, and communication tools, which the `slsa mcp`, `axvs mcp`, and
126
+ `axci mcp` servers of those dependencies serve instead.
127
+
128
+ ## Downstream library integration
129
+
130
+ Hardware discovery and configuration authoring are owned by different skills. You MUST invoke the appropriate skill
131
+ before helping users interact with the acquisition system.
132
+
133
+ **For hardware discovery and health checks**, use the `experiment:acquisition-system-setup` and
134
+ `experiment:system-health-check` skills. These drive this library's `sle mcp` server and `sle get` commands together
135
+ with read-only `slsa mcp` checks and the `axvs mcp` and `axci mcp` servers of the `video` and `communication` plugins.
136
+ The `assets` plugin does NOT expose hardware-discovery tools. Invoke them when users want to:
137
+ - Discover hardware (cameras, microcontrollers, Zaber motors, MQTT broker)
138
+ - Verify hardware connectivity and storage mounts before running experiments
139
+ - Troubleshoot hardware connectivity issues
140
+
141
+ Example triggers: "What cameras are connected?", "Check if the MQTT broker is running", "Verify my system
142
+ configuration".
143
+
144
+ **For configuration authoring**, use the appropriate `assets:*` skill from the `assets` plugin (backed by the
145
+ `slsa mcp` server), which reads, writes, and validates the shared configuration and metadata YAMLs. For Mesoscope-VR
146
+ hardware and calibration parameters, also consult the `mesoscope:mesoscope-vr` skill. Invoke these when users want to:
147
+ - Set up or configure an acquisition system
148
+ - Change system parameters (ports, calibration values, thresholds)
149
+
150
+ Example triggers: "Set up the mesoscope system", "Change the lick threshold".
151
+
152
+ ### External tool bindings
153
+
154
+ An acquisition system may need a tool this stack cannot host, because its runtime, its dependency pins, its license, or
155
+ its own launcher forbids installing or driving it beside the stack. Such a tool is bound rather than registered. It is
156
+ invoked as a subprocess, it is never imported, and what it contributes is the artifact it writes into the session tree
157
+ rather than an API. The `experiment:external-tool-bindings` skill owns the convention, the admission test that decides
158
+ whether a dependency registers or binds, and the workflow for adding one. Invoke it before wiring any tool that cannot
159
+ share this environment.
160
+
161
+ This library carries the producer half of every binding. A binding declares the tool's address in identity fields on
162
+ the acquisition system's configuration, and launches only when every one of them is set. It resolves that address at
163
+ call time rather than at import time. It returns silently when the host has not configured the tool, and logs a warning
164
+ and returns when the tool's input is missing, so preprocessing completes in both cases. The consumer half lives in
165
+ `sollertia-forgery`, where a donated locator finds the artifact and decides whether the dependent job is possible for
166
+ that session. `forging:processing-input-format` owns that half.
167
+
168
+ One binding exists today. Mesoscope-VR preprocessing invokes `slvt infer` from `sollertia-video-tracking` through
169
+ `conda run`, because DeepLabCut supports only Python 3.10 to 3.12 and the numpy 1.x series, against this stack's
170
+ Python 3.14 and numpy 2. That inference runs alongside the other preprocessing stages and is joined before the
171
+ checksum, so a failed run aborts the transfer and retains the local session copy. The `mesoscope:mesoscope-vr` skill
172
+ documents the invocation and its configuration fields.
173
+
174
+ ## Companion library synchronization
175
+
176
+ The companion `sollertia-micro-controllers` (`../sollertia-micro-controllers/`) C++ library is the firmware counterpart
177
+ to this library, and parts of this codebase track it in lockstep. Any change to a firmware `Module` subclass's parameter
178
+ structure, status codes, command codes, controller IDs, keepalive interval, or per-target module layout requires a
179
+ matching change here. That change touches the system-agnostic `ModuleInterface` wrappers in
180
+ `cross_system/module_interfaces.py`, the per-system binding classes in `mesoscope_vr/binding_classes.py`, and the
181
+ `MesoscopeMicroControllers` configuration dataclass in `mesoscope_vr/system.py`. The
182
+ `experiment:microcontroller-interface` skill owns the paired Module + ModuleInterface list, and
183
+ `microcontroller:firmware-module` covers the firmware side.
184
+
185
+ ## Distribution model
186
+
187
+ The package ships to PyPI as `sollertia-experiment` and installs the `sle` CLI. Its Claude Code skills ship separately,
188
+ through the [sollertia](https://github.com/Sun-Lab-NBB/sollertia) marketplace, in its `experiment` and `mesoscope`
189
+ plugins, and the `experiment` plugin also registers the `sle mcp` server. An agent asked to add or change a skill edits
190
+ `sollertia/plugins/<plugin>/skills/<skill>/SKILL.md` in that repository rather than this one, and bumps that plugin's
191
+ `version` in its `.claude-plugin/plugin.json` exactly once per branch.
192
+
193
+ ## Project context
194
+
195
+ This is **sollertia-experiment**, the data acquisition and preprocessing runtime of the Sollertia platform. Every
196
+ Sollertia acquisition system runs in virtual reality, presenting a Unity task in the linear infinite corridor. The
197
+ library manages these systems and is designed to be extended with new ones. Currently, sollertia-experiment manages
198
+ the **Mesoscope-VR** two-photon imaging system, which combines brain imaging with virtual reality behavioral tasks.
199
+
200
+ ### Key areas
201
+
202
+ | Directory | Purpose |
203
+ |------------------------------------------|----------------------------------------------------------|
204
+ | `src/sollertia_experiment/interfaces/` | The `sle` CLI groups, the MCP server, and its tools |
205
+ | `src/sollertia_experiment/mesoscope_vr/` | Mesoscope-VR system implementation (current system) |
206
+ | `src/sollertia_experiment/cross_system/` | Cross-system utilities shared by all acquisition systems |
207
+ | `src/sollertia_experiment/vr_task/` | VR task driver: Unity MQTT coupling, trial decomposition |
208
+ | `assets/mesoscope_vr/` | MATLAB assets deployed to the ScanImagePC, not packaged |
209
+
210
+ `experiment:vr-driver-interface` owns the host side of the Unity coupling alone. The Unity side lives in the
211
+ `sollertia-virtual-reality` project and is owned by the `unity` plugin, through `unity:mqtt-contract` for the topic
212
+ constants, `unity:play-mode` and `unity:task-scenes` for the editor bridge and scene activation, and
213
+ `unity:gimbl-framework` for the VR framework itself.
214
+
215
+ ### Architecture
216
+
217
+ - A single `sle` CLI entry point delegates to two command groups, a general, hardware-agnostic discovery group
218
+ (`sle get`) and a per-system group that combines configuration, acquisition, and data management for one system
219
+ (`sle mesoscope` for the Mesoscope-VR system). The `sle mcp` command starts the MCP server
220
+ - Hardware abstraction via binding classes (Zaber motors, cameras, microcontrollers)
221
+ - Shared memory IPC for GUI-runtime communication
222
+ - Session-based data management with distributed storage
223
+
224
+ ### Code standards
225
+
226
+ - MyPy strict mode with full type annotations
227
+ - Google-style docstrings
228
+ - 120 character line limit
229
+ - See `automation:python-style` for complete conventions
230
+
231
+ ### Workflow guidance
232
+
233
+ **Adding hardware to mesoscope-vr:** (see `experiment:acquisition-system-design` and `mesoscope:mesoscope-vr`)
234
+
235
+ 1. Add or extend the per-subsystem configuration dataclass in `mesoscope_vr/system.py`
236
+ 2. Implement binding classes in `sollertia-experiment`
237
+ 3. Integrate the binding classes with the `MesoscopeVRSystem` lifecycle in `mesoscope_vr/system_controller.py`
238
+
239
+ For low-level camera hardware implementation, use the `video:camera-interface` skill.
240
+
241
+ For PC-side microcontroller hardware implementation, use the `experiment:microcontroller-interface` skill (the
242
+ registry of paired Module + ModuleInterface classes). For the underlying AXCI base API, use the
243
+ `communication:microcontroller-interface` skill.
244
+
245
+ For Zaber motor configuration, use the `experiment:zaber-interface` skill and follow the existing patterns in
246
+ `cross_system/zaber_bindings.py`.
247
+
248
+ **Adding hardware bindings (general):**
249
+
250
+ 1. For shared hardware (microcontrollers), add `ModuleInterface` subclasses to `cross_system/module_interfaces.py`
251
+ 2. For system-specific hardware, add wrapper classes to the system's `binding_classes.py`
252
+ 3. Follow existing patterns: wrapper classes acquire their devices in `__init__`, where `ZaberMotors` calls
253
+ `ZaberConnection.connect()`, and expose teardown alongside per-subsystem control methods. `ZaberMotors` provides
254
+ `disconnect()` and the `is_connected` property, `MicroControllerInterfaces` provides `start()` and `stop()`, and
255
+ `VideoSystems` provides `start_face_camera()`, `start_body_camera()`, and `stop()`
256
+ 4. Use the system's own configuration dataclasses for hardware parameters (`mesoscope_vr/system.py`)
257
+
258
+ **Modifying CLI commands:** `experiment:cli-reference` covers the `sle` root group, `sle mcp`, and the six `sle get`
259
+ commands with their options, failure modes, and MCP-tool mapping. `mesoscope:mesoscope-vr-cli-reference` covers the
260
+ `sle mesoscope` command and option surface. `experiment:library-extension` covers the `_register_subcommands()`
261
+ registration seam.
262
+
263
+ 1. Identify the appropriate CLI module: `get.py` for general, hardware-agnostic discovery commands (`sle get`), or
264
+ `mesoscope_vr.py` for Mesoscope-VR-specific commands (`sle mesoscope`). The `sle mesoscope` group covers `maintain`,
265
+ `check-bridge`, `check-mounts`, `validate-config`, `preprocess`, `delete`, `migrate`, the `configure` command group
266
+ with its `system` and `experiment` subcommands, and the `run` command group with its `window-checking`,
267
+ `lick-training`, `run-training`, and `experiment` subcommands
268
+ 2. Add Click-decorated command functions following existing patterns
269
+ 3. Import logic functions from the relevant acquisition system package
270
+ 4. Register commands with the appropriate Click group. The `get` and `mesoscope` groups reach the top-level `sle`
271
+ group through two explicit imports and two `add_command()` calls inside `_register_subcommands()` in
272
+ `entry_points.py`, so a third group requires editing that function
273
+
274
+ **Modifying sollertia-shared-assets (session records and registries):**
275
+
276
+ sollertia-shared-assets (`../sollertia-shared-assets/`) owns the session descriptor, hardware state, experiment
277
+ configuration, and raw data classes, together with the registries in `registries.py` that key them by session type and
278
+ by acquisition system. Use the `assets:library-extension` skill for the registry extension path and the other
279
+ `assets:*` skills for authoring. System configuration is owned by this repository, in
280
+ `cross_system/system_configuration.py` and each system's `system.py`.
281
+
282
+ **Modifying sollertia-micro-controllers (hardware modules):**
283
+
284
+ See `## Companion library synchronization` above for the lockstep contract and the owning skills.
285
+
286
+ **Managing session data (preprocess, migrate, delete):**
287
+
288
+ Use the `experiment:data-management` skill, which drives the `preprocess`, `migrate`, and `delete` operations exposed
289
+ by the `sle mesoscope` CLI and the `sle mcp` server.
290
+
291
+ **Adding a new acquisition system:**
292
+
293
+ Invoke `experiment:library-extension` first for the catalog of seams a new system touches across this library and
294
+ sollertia-micro-controllers, then `experiment:system-design-pipeline` for the build phase order.