murineshiftwork 2.16.1__tar.gz → 2.16.3__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 (57) hide show
  1. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/CITATION.cff +2 -2
  2. murineshiftwork-2.16.3/LICENSE +35 -0
  3. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/PKG-INFO +42 -37
  4. murineshiftwork-2.16.3/VERSION +1 -0
  5. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/pyproject.toml +12 -9
  6. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_calibration_tasks_sim.py +4 -3
  7. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_cli_evaluate.py +28 -44
  8. murineshiftwork-2.16.3/tests/test_host_session.py +111 -0
  9. murineshiftwork-2.16.1/LICENSE +0 -31
  10. murineshiftwork-2.16.1/VERSION +0 -1
  11. murineshiftwork-2.16.1/tests/test_hardware_manager.py +0 -336
  12. murineshiftwork-2.16.1/tests/test_host_session.py +0 -307
  13. murineshiftwork-2.16.1/tests/test_preflight_and_pipeline.py +0 -376
  14. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/.gitignore +0 -0
  15. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/README.md +0 -0
  16. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/src/murineshiftwork/py.typed +0 -0
  17. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/conftest.py +0 -0
  18. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_fixedsubjects/_test_subject__20260518_121602_710824__probabilistic_switching_fixedsubjects.msw.csv +0 -0
  19. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_fixedsubjects/_test_subject__20260518_121602_710824__probabilistic_switching_fixedsubjects.msw.df.jsonl +0 -0
  20. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_fixedsubjects/_test_subject__20260518_121602_710824__probabilistic_switching_fixedsubjects.msw.session.yaml +0 -0
  21. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.csv +0 -0
  22. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.df.jsonl +0 -0
  23. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.settings.process.json +0 -0
  24. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.settings.task.json +0 -0
  25. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_legacy/subject003__20210426_183409__probabilistic_switching/subject003__20210426_183409__probabilistic_switching.pkl +0 -0
  26. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_legacy/subject003__20210426_183409__probabilistic_switching/subject003__20210426_183409__probabilistic_switching.task_settings.py +0 -0
  27. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/_test_subject__20260527_133053_901389__optotagging.msw.session.yaml +0 -0
  28. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/_test_subject__20260527_133053_901389__optotagging_power_ramp_1mw.msw.df.jsonl +0 -0
  29. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/_test_subject__20260527_133053_901389__optotagging_power_ramp_2mw.msw.csv +0 -0
  30. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/session_manifest.yaml +0 -0
  31. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.csv +0 -0
  32. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.df.pkl +0 -0
  33. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.settings.process.json +0 -0
  34. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.settings.task.json +0 -0
  35. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_sequence/_test_subject__20260520_114516_534465__sequence.msw.csv +0 -0
  36. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_sequence/_test_subject__20260520_114516_534465__sequence.msw.df.jsonl +0 -0
  37. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_sequence/_test_subject__20260520_114516_534465__sequence.msw.session.yaml +0 -0
  38. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_v2/_test_subject__20260516_130611_739182__probabilistic_switching_fixedsubjects.msw.csv +0 -0
  39. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_v2/_test_subject__20260516_130611_739182__probabilistic_switching_fixedsubjects.msw.df.jsonl +0 -0
  40. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/fixture_v2/_test_subject__20260516_130611_739182__probabilistic_switching_fixedsubjects.msw.session.yaml +0 -0
  41. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/namespace.v1.yaml +0 -0
  42. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/namespace.v2.yaml +0 -0
  43. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/data/namespace.v3.yaml +0 -0
  44. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_calibration_outliers.py +0 -0
  45. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_cli_entrypoints.py +0 -0
  46. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_config_io.py +0 -0
  47. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_config_models.py +0 -0
  48. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_hooks.py +0 -0
  49. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_integration_deps.py +0 -0
  50. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_logagent.py +0 -0
  51. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_namespace_readiness.py +0 -0
  52. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_plot_spec.py +0 -0
  53. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_post_and_action.py +0 -0
  54. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_session_yaml_serialization.py +0 -0
  55. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_sim_hardware.py +0 -0
  56. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_task_discovery.py +0 -0
  57. {murineshiftwork-2.16.1 → murineshiftwork-2.16.3}/tests/test_taskrunner_paths.py +0 -0
@@ -3,8 +3,8 @@ message: "If you use this software, please cite it as below."
3
3
  type: software
4
4
  title: "Murine Shift Work: behavioural task acquisition with hardware support"
5
5
  version: "2.6.0"
6
- repository-code: https://github.com/larsrollik/murineshiftwork
7
- license-url: https://github.com/larsrollik/murineshiftwork/blob/main/LICENSE
6
+ repository-code: https://github.com/MurineShiftWork/murineshiftwork
7
+ license-url: https://github.com/MurineShiftWork/murineshiftwork/blob/main/LICENSE
8
8
  authors:
9
9
  - family-names: Rollik
10
10
  given-names: Lars B.
@@ -0,0 +1,35 @@
1
+ BSD-3-Clause-NonCommercial
2
+
3
+ Copyright (c) 2020-present, Lars B. Rollik.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted for NON-COMMERCIAL research, academic, and
8
+ educational purposes only, provided that the following conditions are met:
9
+
10
+ 1. Redistributions of source code must retain the above copyright notice,
11
+ this list of conditions and the following disclaimer.
12
+
13
+ 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+
17
+ 3. Neither the name of the copyright holder nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software
19
+ without specific prior written permission.
20
+
21
+ 4. Any use of this software or its derivatives for COMMERCIAL purposes -
22
+ including sale, paid licensing, or providing paid services built on it -
23
+ requires a separate commercial licence. Contact lars@rollik.me.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
+ POSSIBILITY OF SUCH DAMAGE.
@@ -1,54 +1,59 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: murineshiftwork
3
- Version: 2.16.1
3
+ Version: 2.16.3
4
4
  Summary: Behaviour acquisition framework for standardised, scalable experiments.
5
5
  Project-URL: Homepage, https://github.com/MurineShiftWork/murineshiftwork
6
6
  Project-URL: Documentation, https://MurineShiftWork.github.io/murineshiftwork/
7
7
  Project-URL: Issue Tracker, https://github.com/MurineShiftWork/murineshiftwork/issues
8
8
  Author-email: "Lars B. Rollik" <lars@rollik.me>
9
- License: Copyright (c) 2020-present Lars B. Rollik. All rights reserved.
9
+ License: BSD-3-Clause-NonCommercial
10
10
 
11
- Permission is granted, free of charge, to use, copy, modify, and distribute
12
- this software and associated documentation files (the "Software") for
13
- non-commercial research or academic purposes only, subject to the following
14
- conditions:
11
+ Copyright (c) 2020-present, Lars B. Rollik.
12
+ All rights reserved.
15
13
 
16
- 1. This copyright notice and permission notice must be included in all copies
17
- or substantial portions of the Software.
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted for NON-COMMERCIAL research, academic, and
16
+ educational purposes only, provided that the following conditions are met:
18
17
 
19
- 2. Any publication, presentation, or product that uses or builds upon the
20
- Software must give clear attribution to the original work and its authors.
18
+ 1. Redistributions of source code must retain the above copyright notice,
19
+ this list of conditions and the following disclaimer.
21
20
 
22
- 3. Commercial use is prohibited without a separate written commercial licence
23
- agreement with the copyright holder. Commercial use means incorporation of
24
- the Software into anything for which fees or other compensation are charged
25
- or received, including commercial products and commercial services.
21
+ 2. Redistributions in binary form must reproduce the above copyright notice,
22
+ this list of conditions and the following disclaimer in the documentation
23
+ and/or other materials provided with the distribution.
26
24
 
27
- 4. No patent licence, express or implied, is granted under these terms. Any
28
- use that would require a patent licence from the copyright holder requires
29
- a separate written agreement.
25
+ 3. Neither the name of the copyright holder nor the names of its contributors
26
+ may be used to endorse or promote products derived from this software
27
+ without specific prior written permission.
30
28
 
31
- 5. Redistribution, in source or binary form, is permitted only for
32
- non-commercial purposes and must retain this notice unmodified.
29
+ 4. Any use of this software or its derivatives for COMMERCIAL purposes -
30
+ including sale, paid licensing, or providing paid services built on it -
31
+ requires a separate commercial licence. Contact lars@rollik.me.
33
32
 
34
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
- IMPLIED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
36
- DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE
37
- SOFTWARE OR THE USE OR DEALINGS IN THE SOFTWARE.
38
-
39
- For commercial or patent licensing enquiries contact: lars@rollik.me
33
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
34
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
37
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
38
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43
+ POSSIBILITY OF SUCH DAMAGE.
40
44
  License-File: LICENSE
45
+ Classifier: License :: Free for non-commercial use
41
46
  Requires-Python: <3.14,>=3.12
42
47
  Requires-Dist: ipython>=9.14.1
43
- Requires-Dist: msw-core>=0.12.1
44
- Requires-Dist: msw-io>=1.10.0
48
+ Requires-Dist: msw-core>=0.33.2
49
+ Requires-Dist: msw-io>=1.14.1
45
50
  Requires-Dist: plotly>=5.0
46
51
  Requires-Dist: pyarrow>=24.0.0
47
52
  Requires-Dist: tqdm
48
53
  Provides-Extra: agent
49
54
  Requires-Dist: msw-agent>=0.1.0; extra == 'agent'
50
55
  Provides-Extra: calibration
51
- Requires-Dist: serial-scale-bench>=0.2.4; extra == 'calibration'
56
+ Requires-Dist: serial-scale-bench>=0.2.5; extra == 'calibration'
52
57
  Requires-Dist: serial-scale-hx711>=2.1.4; extra == 'calibration'
53
58
  Provides-Extra: dev
54
59
  Requires-Dist: commitizen; extra == 'dev'
@@ -63,23 +68,23 @@ Requires-Dist: pytest-cov; extra == 'dev'
63
68
  Requires-Dist: ruff; extra == 'dev'
64
69
  Provides-Extra: docs
65
70
  Requires-Dist: mkdocs-material<10,>=9.6; extra == 'docs'
66
- Requires-Dist: mkdocstrings[python]<2,>=1.0.4; extra == 'docs'
71
+ Requires-Dist: mkdocstrings[python]<2,>=1.0.8; extra == 'docs'
67
72
  Provides-Extra: flir
68
- Requires-Dist: msw-flir-bonsai>=0.4.1; extra == 'flir'
73
+ Requires-Dist: msw-flir-bonsai>=0.5.0; extra == 'flir'
69
74
  Provides-Extra: full
70
- Requires-Dist: msw-flir-bonsai>=0.4.1; extra == 'full'
71
- Requires-Dist: msw-open-ephys>=3.4.1; extra == 'full'
72
- Requires-Dist: msw-tasks-core>=0.5.6; extra == 'full'
75
+ Requires-Dist: msw-flir-bonsai>=0.5.0; extra == 'full'
76
+ Requires-Dist: msw-open-ephys>=3.5.0; extra == 'full'
77
+ Requires-Dist: msw-tasks-core>=0.5.8; extra == 'full'
73
78
  Provides-Extra: oe
74
- Requires-Dist: msw-open-ephys>=3.4.1; extra == 'oe'
79
+ Requires-Dist: msw-open-ephys>=3.5.0; extra == 'oe'
75
80
  Provides-Extra: pulsepal
76
81
  Requires-Dist: pypulsepal>=0.4.6; extra == 'pulsepal'
77
82
  Provides-Extra: rce
78
83
  Requires-Dist: rpi-camera-ensemble[conductor]>=0.6.2; extra == 'rce'
79
84
  Provides-Extra: stage
80
- Requires-Dist: one-axis-stage>=0.2.2; extra == 'stage'
85
+ Requires-Dist: one-axis-stage>=0.3.0; extra == 'stage'
81
86
  Provides-Extra: tasks
82
- Requires-Dist: msw-tasks-core>=0.5.6; extra == 'tasks'
87
+ Requires-Dist: msw-tasks-core>=0.5.8; extra == 'tasks'
83
88
  Description-Content-Type: text/markdown
84
89
 
85
90
  # Murine Shift Work
@@ -0,0 +1 @@
1
+ 2.16.3
@@ -8,13 +8,16 @@ dynamic = ["version"]
8
8
  description = "Behaviour acquisition framework for standardised, scalable experiments."
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  license = { file = "LICENSE" }
11
+ classifiers = [
12
+ "License :: Free for non-commercial use",
13
+ ]
11
14
  authors = [
12
15
  { name = "Lars B. Rollik", email = "lars@rollik.me" },
13
16
  ]
14
17
  requires-python = ">=3.12,<3.14"
15
18
  dependencies = [
16
- "msw-core>=0.12.1",
17
- "msw-io>=1.10.0",
19
+ "msw-core>=0.33.2",
20
+ "msw-io>=1.14.1",
18
21
  "tqdm",
19
22
  "plotly>=5.0",
20
23
  "pyarrow>=24.0.0",
@@ -44,26 +47,26 @@ dev = [
44
47
  ]
45
48
  docs = [
46
49
  "mkdocs-material>=9.6,<10", # pin below v10: the team warns it is a breaking rewrite
47
- "mkdocstrings[python]>=1.0.4,<2",
50
+ "mkdocstrings[python]>=1.0.8,<2",
48
51
  ]
49
52
  tasks = [
50
- "msw-tasks-core>=0.5.6", # >=0.5.6 declares sshkeyboard (formerly the umbrella [keyboard] extra)
53
+ "msw-tasks-core>=0.5.8", # >=0.5.6 declares sshkeyboard; >=0.5.7 takes the scale from the device collection
51
54
  ]
52
55
  agent = [
53
56
  "msw-agent>=0.1.0",
54
57
  ]
55
58
  oe = [
56
- "msw-open-ephys>=3.4.1",
59
+ "msw-open-ephys>=3.5.0",
57
60
  ]
58
61
  flir = [
59
- "msw-flir-bonsai>=0.4.1",
62
+ "msw-flir-bonsai>=0.5.0",
60
63
  ]
61
64
  pulsepal = [
62
65
  "pypulsepal>=0.4.6",
63
66
  ]
64
67
  calibration = [
65
68
  "serial-scale-hx711>=2.1.4",
66
- "serial-scale-bench>=0.2.4",
69
+ "serial-scale-bench>=0.2.5",
67
70
  ]
68
71
  # Note: sshkeyboard now ships with msw-tasks-core (via [tasks]); the Qt live-plot
69
72
  # stack ships with the task packages that plot (e.g. msw-tasks-lab[qt]). Both former
@@ -72,7 +75,7 @@ rce = [
72
75
  "rpi-camera-ensemble[conductor]>=0.6.2",
73
76
  ]
74
77
  stage = [
75
- "one-axis-stage>=0.2.2",
78
+ "one-axis-stage>=0.3.0",
76
79
  ]
77
80
  # Full software stack: framework + tasks + first-party plugins (oe, flir). Rig-specific
78
81
  # hardware is a la carte on top: [rce] cameras, [pulsepal] stim, [calibration] scales,
@@ -141,7 +144,7 @@ include = [
141
144
  [tool.commitizen]
142
145
  name = "cz_conventional_commits"
143
146
  version_provider = "commitizen"
144
- version = "2.16.1"
147
+ version = "2.16.3"
145
148
  tag_format = "v$version"
146
149
  update_changelog_on_bump = false
147
150
  version_files = ["VERSION"]
@@ -49,7 +49,8 @@ def _make_sim_kwargs(tmp_path: Path, valve_id: int = 1) -> dict:
49
49
  "TARGET_RANGE_UL": [0.1, 5.0],
50
50
  },
51
51
  "calibration_file_liquid": str(cal_file),
52
- "scale": SimWeighingScale(weight_g=0.004),
52
+ # the framework injects the opened scale via the device collection (msw-tasks-core >= 0.5.7)
53
+ "devices": {"scale": SimWeighingScale(weight_g=0.004)},
53
54
  "config_dir": "",
54
55
  "setup": "unknown_setup",
55
56
  }
@@ -98,7 +99,7 @@ class TestCalibrationLiquidStaticSim:
98
99
 
99
100
  kwargs = _make_sim_kwargs(tmp_path)
100
101
  scale = SimWeighingScale(weight_g=0.004)
101
- kwargs["scale"] = scale
102
+ kwargs["devices"] = {"scale": scale}
102
103
  bpod = SimBpod()
103
104
  bpod.open()
104
105
 
@@ -150,7 +151,7 @@ class TestCalibrationLiquidDynamicSim:
150
151
 
151
152
  kwargs = _make_sim_kwargs(tmp_path)
152
153
  scale = SimWeighingScale(weight_g=0.004)
153
- kwargs["scale"] = scale
154
+ kwargs["devices"] = {"scale": scale}
154
155
  bpod = SimBpod()
155
156
  bpod.open()
156
157
 
@@ -237,21 +237,20 @@ def test_task_overlay_deep_merges_nested_keys(tmp_path):
237
237
 
238
238
 
239
239
  # ---------------------------------------------------------------------------
240
- # Sticky task_mode from subject YAML
240
+ # task_mode: chosen per run with --task-mode, never stored in the subject YAML
241
241
 
242
242
 
243
- def _write_task_overlay_with_mode(tmp_path, task, mode_name, mode_params):
244
- """Write overlay task.yaml with both default: and mode: sections."""
243
+ def _write_task_overlay_with_mode(tmp_path, task, modes):
244
+ """Write overlay task.yaml with an empty default: and the given mode: sections."""
245
245
  overlay_dir = tmp_path / "tasks" / task
246
246
  overlay_dir.mkdir(parents=True, exist_ok=True)
247
- (overlay_dir / "task.yaml").write_text(
248
- yaml.dump({"default": {}, "mode": {mode_name: mode_params}})
249
- )
247
+ (overlay_dir / "task.yaml").write_text(yaml.dump({"default": {}, "mode": modes}))
250
248
 
251
249
 
252
- def test_sticky_task_mode_from_subject_yaml_applied(tmp_path):
253
- """task_mode in subject YAML task_overrides is applied like --task-mode."""
250
+ def test_sticky_task_mode_in_subject_yaml_is_rejected(tmp_path):
251
+ """A task_mode key in subject YAML task_overrides is refused, not applied."""
254
252
  from murineshiftwork.cli.evaluate import evaluate_args
253
+ from murineshiftwork.logic.task_settings import StickyTaskModeError
255
254
 
256
255
  subject = "s082_tabfixed_m3000001"
257
256
  _write_subject_yaml(
@@ -260,49 +259,33 @@ def test_sticky_task_mode_from_subject_yaml_applied(tmp_path):
260
259
  task_overrides={"_test_flush_valves": {"task_mode": "low_volume"}},
261
260
  )
262
261
  _write_task_overlay_with_mode(
263
- tmp_path, "_test_flush_valves", "low_volume", {"VALVE_OPENING_TIME_MS": 25.0}
262
+ tmp_path, "_test_flush_valves", {"low_volume": {"VALVE_OPENING_TIME_MS": 25.0}}
264
263
  )
265
- args = _base_args(tmp_path, subject)
266
- result = evaluate_args(args_dict=args)
267
- assert result["settings.task.patched"]["VALVE_OPENING_TIME_MS"] == 25.0
264
+ with pytest.raises(StickyTaskModeError, match="--task-mode"):
265
+ evaluate_args(args_dict=_base_args(tmp_path, subject))
268
266
 
269
267
 
270
- def test_cli_task_mode_beats_sticky_subject_yaml_mode(tmp_path):
271
- """CLI --task-mode overrides task_mode stored in subject YAML."""
268
+ def test_cli_task_mode_selects_overlay_mode(tmp_path):
269
+ """--task-mode applies the named mode from the config-dir overlay."""
272
270
  from murineshiftwork.cli.evaluate import evaluate_args
273
271
 
274
272
  subject = "s082_tabfixed_m3000002"
275
- _write_subject_yaml(
276
- tmp_path,
277
- subject,
278
- task_overrides={"_test_flush_valves": {"task_mode": "low_volume"}},
279
- )
273
+ _write_subject_yaml(tmp_path, subject)
280
274
  _write_task_overlay_with_mode(
281
275
  tmp_path,
282
276
  "_test_flush_valves",
283
- "low_volume",
284
- {"VALVE_OPENING_TIME_MS": 25.0},
285
- )
286
- # Add a second mode to select via CLI
287
- overlay_dir = tmp_path / "tasks" / "_test_flush_valves"
288
- (overlay_dir / "task.yaml").write_text(
289
- yaml.dump(
290
- {
291
- "default": {},
292
- "mode": {
293
- "low_volume": {"VALVE_OPENING_TIME_MS": 25.0},
294
- "high_volume": {"VALVE_OPENING_TIME_MS": 99.0},
295
- },
296
- }
297
- )
277
+ {
278
+ "low_volume": {"VALVE_OPENING_TIME_MS": 25.0},
279
+ "high_volume": {"VALVE_OPENING_TIME_MS": 99.0},
280
+ },
298
281
  )
299
282
  args = _base_args(tmp_path, subject, task_mode="high_volume")
300
283
  result = evaluate_args(args_dict=args)
301
284
  assert result["settings.task.patched"]["VALVE_OPENING_TIME_MS"] == 99.0
302
285
 
303
286
 
304
- def test_subject_yaml_overrides_stack_on_top_of_sticky_mode(tmp_path):
305
- """Non-mode keys in subject YAML override the mode's params."""
287
+ def test_subject_yaml_overrides_stack_on_top_of_cli_mode(tmp_path):
288
+ """Subject YAML keys override the params of the mode chosen with --task-mode."""
306
289
  from murineshiftwork.cli.evaluate import evaluate_args
307
290
 
308
291
  subject = "s082_tabfixed_m3000003"
@@ -311,19 +294,20 @@ def test_subject_yaml_overrides_stack_on_top_of_sticky_mode(tmp_path):
311
294
  subject,
312
295
  task_overrides={
313
296
  "_test_flush_valves": {
314
- "task_mode": "low_volume",
315
- "N_FLUSH_CYCLES": 7, # subject key on top of mode
297
+ "VALVE_OPENING_TIME_MS": 30.0, # subject beats the mode
298
+ "N_FLUSH_CYCLES": 7,
316
299
  }
317
300
  },
318
301
  )
319
302
  _write_task_overlay_with_mode(
320
- tmp_path, "_test_flush_valves", "low_volume", {"VALVE_OPENING_TIME_MS": 25.0}
303
+ tmp_path,
304
+ "_test_flush_valves",
305
+ {"low_volume": {"VALVE_OPENING_TIME_MS": 25.0, "N_FLUSH_CYCLES": 2}},
321
306
  )
322
- args = _base_args(tmp_path, subject)
323
- result = evaluate_args(args_dict=args)
324
- patched = result["settings.task.patched"]
325
- assert patched["VALVE_OPENING_TIME_MS"] == 25.0 # from mode
326
- assert patched["N_FLUSH_CYCLES"] == 7 # subject key on top of mode
307
+ args = _base_args(tmp_path, subject, task_mode="low_volume")
308
+ patched = evaluate_args(args_dict=args)["settings.task.patched"]
309
+ assert patched["VALVE_OPENING_TIME_MS"] == 30.0
310
+ assert patched["N_FLUSH_CYCLES"] == 7
327
311
 
328
312
 
329
313
  def test_full_priority_chain_order(tmp_path):
@@ -0,0 +1,111 @@
1
+ """Integration tests for the host-session plugin system.
2
+
3
+ Exercises the installed ``msw-open-ephys`` plugin through msw-core's entry-point dispatch and
4
+ feeds its attach() result into msw-io's session path generation. Unit coverage lives with each
5
+ package: ``_parse_host``/``attach`` parsing in msw-open-ephys, ``make_host_session`` dispatch in
6
+ msw-core, ``HostSessionInfo`` in msw-plugin-api.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from pathlib import Path
12
+ from unittest.mock import MagicMock, PropertyMock, patch
13
+
14
+ import pytest
15
+
16
+ msw_open_ephys = pytest.importorskip("msw_open_ephys")
17
+ from msw_open_ephys.host import OpenEphysHostSession # noqa: E402
18
+ from msw_plugin_api import HostSessionProtocol # noqa: E402
19
+
20
+ # ---------------------------------------------------------------------------
21
+ # make_host_session resolves the installed plugin through the real entry point
22
+
23
+
24
+ def test_make_host_session_resolves_installed_openephys_plugin():
25
+ from murineshiftwork.hardware.host_session import make_host_session
26
+
27
+ client = make_host_session("open-ephys", url="http://10.0.10.111:37497")
28
+ assert isinstance(client, OpenEphysHostSession)
29
+ assert isinstance(client, HostSessionProtocol)
30
+ assert client._host == "10.0.10.111"
31
+
32
+
33
+ # ---------------------------------------------------------------------------
34
+ # base_text parsing relies on msw-io's session and acquisition levels
35
+
36
+
37
+ def test_attach_acquisition_and_session_levels_are_distinct_in_v42():
38
+ # v4.2 deliberately differentiates the two levels: the acquisition carries
39
+ # acq_type + optional version, the session container carries session_type.
40
+ from murineshiftwork.namespace.paths import get_msw_builder
41
+
42
+ b = get_msw_builder()
43
+ acq_spec = b.spec.levels["acquisition"]
44
+ ses_spec = b.spec.levels["session"]
45
+ assert acq_spec.template != ses_spec.template
46
+ assert "acq_type" in acq_spec.template
47
+ assert "session_type" in ses_spec.template
48
+
49
+
50
+ # ---------------------------------------------------------------------------
51
+ # Integration: base_text -> session_name -> generate_session_paths
52
+ # (attach() runs against a mocked OE HTTP controller)
53
+
54
+
55
+ def _make_gui_mock(
56
+ status="IDLE", base_text="", prepend_text="", append_text="", record_nodes=None
57
+ ):
58
+ gui = MagicMock()
59
+ type(gui).status = PropertyMock(return_value=status)
60
+ type(gui).recording = PropertyMock(
61
+ return_value={
62
+ "base_text": base_text,
63
+ "prepend_text": prepend_text,
64
+ "append_text": append_text,
65
+ "record_nodes": record_nodes or [],
66
+ }
67
+ )
68
+ return gui
69
+
70
+
71
+ def _attach_with_mock_gui(client, gui_mock):
72
+ with patch.dict(
73
+ "sys.modules",
74
+ {
75
+ "msw_open_ephys": MagicMock(),
76
+ "msw_open_ephys.controller": MagicMock(OEController=lambda ip: gui_mock),
77
+ },
78
+ ):
79
+ return client.attach()
80
+
81
+
82
+ def test_attach_feeds_generate_session_paths_correctly(tmp_path):
83
+ from murineshiftwork.namespace.paths import generate_session_paths
84
+
85
+ gui = _make_gui_mock(
86
+ status="RECORD",
87
+ base_text="m01/m01__20260524_143022__ephys/m01__20260524_143022__pxi",
88
+ record_nodes=[{"parent_directory": "/data/rig1"}],
89
+ )
90
+ client = OpenEphysHostSession(url="127.0.0.1")
91
+ info = _attach_with_mock_gui(client, gui)
92
+ assert info is not None
93
+
94
+ paths = generate_session_paths(
95
+ subject="m01",
96
+ task="sequence",
97
+ acq_type="sequence",
98
+ basepath=tmp_path,
99
+ linked_to=info.session_name,
100
+ printout=False,
101
+ )
102
+
103
+ rel_parts = Path(paths["session_folder_relative"]).parts
104
+ assert rel_parts[0] == "m01"
105
+ assert rel_parts[1] == "m01__20260524_143022__ephys" # host session dir
106
+ assert rel_parts[2].startswith("m01__") # MSW acquisition dir
107
+ # v4.2: acquisition dir carries acq_type + default version suffix.
108
+ assert "__sequence" in rel_parts[2]
109
+ assert rel_parts[2].endswith("__v1")
110
+ assert paths["host_session_name"] == "m01__20260524_143022__ephys"
111
+ assert paths["acquisition_name"] == paths["session_basename"]
@@ -1,31 +0,0 @@
1
- Copyright (c) 2020-present Lars B. Rollik. All rights reserved.
2
-
3
- Permission is granted, free of charge, to use, copy, modify, and distribute
4
- this software and associated documentation files (the "Software") for
5
- non-commercial research or academic purposes only, subject to the following
6
- conditions:
7
-
8
- 1. This copyright notice and permission notice must be included in all copies
9
- or substantial portions of the Software.
10
-
11
- 2. Any publication, presentation, or product that uses or builds upon the
12
- Software must give clear attribution to the original work and its authors.
13
-
14
- 3. Commercial use is prohibited without a separate written commercial licence
15
- agreement with the copyright holder. Commercial use means incorporation of
16
- the Software into anything for which fees or other compensation are charged
17
- or received, including commercial products and commercial services.
18
-
19
- 4. No patent licence, express or implied, is granted under these terms. Any
20
- use that would require a patent licence from the copyright holder requires
21
- a separate written agreement.
22
-
23
- 5. Redistribution, in source or binary form, is permitted only for
24
- non-commercial purposes and must retain this notice unmodified.
25
-
26
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
- IMPLIED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
28
- DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE
29
- SOFTWARE OR THE USE OR DEALINGS IN THE SOFTWARE.
30
-
31
- For commercial or patent licensing enquiries contact: lars@rollik.me
@@ -1 +0,0 @@
1
- 2.16.1