murineshiftwork 2.16.2__tar.gz → 2.16.4__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.
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/CITATION.cff +2 -2
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/PKG-INFO +15 -15
- murineshiftwork-2.16.4/VERSION +1 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/pyproject.toml +11 -11
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_calibration_tasks_sim.py +4 -3
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_cli_evaluate.py +28 -44
- murineshiftwork-2.16.4/tests/test_host_session.py +111 -0
- murineshiftwork-2.16.2/VERSION +0 -1
- murineshiftwork-2.16.2/tests/test_hardware_manager.py +0 -340
- murineshiftwork-2.16.2/tests/test_host_session.py +0 -307
- murineshiftwork-2.16.2/tests/test_preflight_and_pipeline.py +0 -376
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/.gitignore +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/LICENSE +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/README.md +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/src/murineshiftwork/py.typed +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/conftest.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_fixedsubjects/_test_subject__20260518_121602_710824__probabilistic_switching_fixedsubjects.msw.csv +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_fixedsubjects/_test_subject__20260518_121602_710824__probabilistic_switching_fixedsubjects.msw.df.jsonl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_fixedsubjects/_test_subject__20260518_121602_710824__probabilistic_switching_fixedsubjects.msw.session.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.csv +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.df.jsonl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.settings.process.json +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_jsonl/subject001__20260508_172956_258756__probabilistic_switching_fixedsubjects.msw.settings.task.json +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_legacy/subject003__20210426_183409__probabilistic_switching/subject003__20210426_183409__probabilistic_switching.pkl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_legacy/subject003__20210426_183409__probabilistic_switching/subject003__20210426_183409__probabilistic_switching.task_settings.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/_test_subject__20260527_133053_901389__optotagging.msw.session.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/_test_subject__20260527_133053_901389__optotagging_power_ramp_1mw.msw.df.jsonl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/_test_subject__20260527_133053_901389__optotagging_power_ramp_2mw.msw.csv +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_optotagging/_test_subject__20260527_133053_901389__optotagging/session_manifest.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.csv +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.df.pkl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.settings.process.json +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_pkl/subject002__20260429_153653__probabilistic_switching_fixedsubjects.msw.settings.task.json +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_sequence/_test_subject__20260520_114516_534465__sequence.msw.csv +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_sequence/_test_subject__20260520_114516_534465__sequence.msw.df.jsonl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_sequence/_test_subject__20260520_114516_534465__sequence.msw.session.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_v2/_test_subject__20260516_130611_739182__probabilistic_switching_fixedsubjects.msw.csv +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_v2/_test_subject__20260516_130611_739182__probabilistic_switching_fixedsubjects.msw.df.jsonl +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/fixture_v2/_test_subject__20260516_130611_739182__probabilistic_switching_fixedsubjects.msw.session.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/namespace.v1.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/namespace.v2.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/data/namespace.v3.yaml +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_calibration_outliers.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_cli_entrypoints.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_config_io.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_config_models.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_hooks.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_integration_deps.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_logagent.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_namespace_readiness.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_plot_spec.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_post_and_action.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_session_yaml_serialization.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_sim_hardware.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/tests/test_task_discovery.py +0 -0
- {murineshiftwork-2.16.2 → murineshiftwork-2.16.4}/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/
|
|
7
|
-
license-url: https://github.com/
|
|
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: murineshiftwork
|
|
3
|
-
Version: 2.16.
|
|
3
|
+
Version: 2.16.4
|
|
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/
|
|
@@ -45,15 +45,15 @@ License-File: LICENSE
|
|
|
45
45
|
Classifier: License :: Free for non-commercial use
|
|
46
46
|
Requires-Python: <3.14,>=3.12
|
|
47
47
|
Requires-Dist: ipython>=9.14.1
|
|
48
|
-
Requires-Dist: msw-core>=0.
|
|
49
|
-
Requires-Dist: msw-io>=1.
|
|
48
|
+
Requires-Dist: msw-core>=0.36.3
|
|
49
|
+
Requires-Dist: msw-io>=1.16.0
|
|
50
50
|
Requires-Dist: plotly>=5.0
|
|
51
51
|
Requires-Dist: pyarrow>=24.0.0
|
|
52
52
|
Requires-Dist: tqdm
|
|
53
53
|
Provides-Extra: agent
|
|
54
54
|
Requires-Dist: msw-agent>=0.1.0; extra == 'agent'
|
|
55
55
|
Provides-Extra: calibration
|
|
56
|
-
Requires-Dist: serial-scale-bench>=0.2.
|
|
56
|
+
Requires-Dist: serial-scale-bench>=0.2.5; extra == 'calibration'
|
|
57
57
|
Requires-Dist: serial-scale-hx711>=2.1.4; extra == 'calibration'
|
|
58
58
|
Provides-Extra: dev
|
|
59
59
|
Requires-Dist: commitizen; extra == 'dev'
|
|
@@ -62,29 +62,29 @@ Requires-Dist: httpx; extra == 'dev'
|
|
|
62
62
|
Requires-Dist: mypy; extra == 'dev'
|
|
63
63
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
64
64
|
Requires-Dist: pyarrow; extra == 'dev'
|
|
65
|
-
Requires-Dist: pypulsepal>=0.4.
|
|
65
|
+
Requires-Dist: pypulsepal>=0.4.7; extra == 'dev'
|
|
66
66
|
Requires-Dist: pytest; extra == 'dev'
|
|
67
67
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
68
68
|
Requires-Dist: ruff; extra == 'dev'
|
|
69
69
|
Provides-Extra: docs
|
|
70
70
|
Requires-Dist: mkdocs-material<10,>=9.6; extra == 'docs'
|
|
71
|
-
Requires-Dist: mkdocstrings[python]<2,>=1.0.
|
|
71
|
+
Requires-Dist: mkdocstrings[python]<2,>=1.0.8; extra == 'docs'
|
|
72
72
|
Provides-Extra: flir
|
|
73
|
-
Requires-Dist: msw-flir-bonsai>=0.
|
|
73
|
+
Requires-Dist: msw-flir-bonsai>=0.6.1; extra == 'flir'
|
|
74
74
|
Provides-Extra: full
|
|
75
|
-
Requires-Dist: msw-flir-bonsai>=0.
|
|
76
|
-
Requires-Dist: msw-open-ephys>=3.4
|
|
77
|
-
Requires-Dist: msw-tasks-core>=0.5.
|
|
75
|
+
Requires-Dist: msw-flir-bonsai>=0.6.1; extra == 'full'
|
|
76
|
+
Requires-Dist: msw-open-ephys>=3.5.4; extra == 'full'
|
|
77
|
+
Requires-Dist: msw-tasks-core>=0.5.13; extra == 'full'
|
|
78
78
|
Provides-Extra: oe
|
|
79
|
-
Requires-Dist: msw-open-ephys>=3.4
|
|
79
|
+
Requires-Dist: msw-open-ephys>=3.5.4; extra == 'oe'
|
|
80
80
|
Provides-Extra: pulsepal
|
|
81
|
-
Requires-Dist: pypulsepal>=0.4.
|
|
81
|
+
Requires-Dist: pypulsepal>=0.4.7; extra == 'pulsepal'
|
|
82
82
|
Provides-Extra: rce
|
|
83
|
-
Requires-Dist: rpi-camera-ensemble[conductor]>=0.
|
|
83
|
+
Requires-Dist: rpi-camera-ensemble[conductor]>=0.18.1; extra == 'rce'
|
|
84
84
|
Provides-Extra: stage
|
|
85
|
-
Requires-Dist: one-axis-stage>=0.
|
|
85
|
+
Requires-Dist: one-axis-stage>=0.3.0; extra == 'stage'
|
|
86
86
|
Provides-Extra: tasks
|
|
87
|
-
Requires-Dist: msw-tasks-core>=0.5.
|
|
87
|
+
Requires-Dist: msw-tasks-core>=0.5.13; extra == 'tasks'
|
|
88
88
|
Description-Content-Type: text/markdown
|
|
89
89
|
|
|
90
90
|
# Murine Shift Work
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.16.4
|
|
@@ -16,8 +16,8 @@ authors = [
|
|
|
16
16
|
]
|
|
17
17
|
requires-python = ">=3.12,<3.14"
|
|
18
18
|
dependencies = [
|
|
19
|
-
"msw-core>=0.
|
|
20
|
-
"msw-io>=1.
|
|
19
|
+
"msw-core>=0.36.3",
|
|
20
|
+
"msw-io>=1.16.0",
|
|
21
21
|
"tqdm",
|
|
22
22
|
"plotly>=5.0",
|
|
23
23
|
"pyarrow>=24.0.0",
|
|
@@ -47,35 +47,35 @@ dev = [
|
|
|
47
47
|
]
|
|
48
48
|
docs = [
|
|
49
49
|
"mkdocs-material>=9.6,<10", # pin below v10: the team warns it is a breaking rewrite
|
|
50
|
-
"mkdocstrings[python]>=1.0.
|
|
50
|
+
"mkdocstrings[python]>=1.0.8,<2",
|
|
51
51
|
]
|
|
52
52
|
tasks = [
|
|
53
|
-
"msw-tasks-core>=0.5.
|
|
53
|
+
"msw-tasks-core>=0.5.13", # >=0.5.6 declares sshkeyboard; >=0.5.7 takes the scale from the device collection
|
|
54
54
|
]
|
|
55
55
|
agent = [
|
|
56
56
|
"msw-agent>=0.1.0",
|
|
57
57
|
]
|
|
58
58
|
oe = [
|
|
59
|
-
"msw-open-ephys>=3.4
|
|
59
|
+
"msw-open-ephys>=3.5.4",
|
|
60
60
|
]
|
|
61
61
|
flir = [
|
|
62
|
-
"msw-flir-bonsai>=0.
|
|
62
|
+
"msw-flir-bonsai>=0.6.1",
|
|
63
63
|
]
|
|
64
64
|
pulsepal = [
|
|
65
|
-
"pypulsepal>=0.4.
|
|
65
|
+
"pypulsepal>=0.4.7",
|
|
66
66
|
]
|
|
67
67
|
calibration = [
|
|
68
68
|
"serial-scale-hx711>=2.1.4",
|
|
69
|
-
"serial-scale-bench>=0.2.
|
|
69
|
+
"serial-scale-bench>=0.2.5",
|
|
70
70
|
]
|
|
71
71
|
# Note: sshkeyboard now ships with msw-tasks-core (via [tasks]); the Qt live-plot
|
|
72
72
|
# stack ships with the task packages that plot (e.g. msw-tasks-lab[qt]). Both former
|
|
73
73
|
# umbrella extras ([keyboard], [qt]) are therefore removed.
|
|
74
74
|
rce = [
|
|
75
|
-
"rpi-camera-ensemble[conductor]>=0.
|
|
75
|
+
"rpi-camera-ensemble[conductor]>=0.18.1",
|
|
76
76
|
]
|
|
77
77
|
stage = [
|
|
78
|
-
"one-axis-stage>=0.
|
|
78
|
+
"one-axis-stage>=0.3.0",
|
|
79
79
|
]
|
|
80
80
|
# Full software stack: framework + tasks + first-party plugins (oe, flir). Rig-specific
|
|
81
81
|
# hardware is a la carte on top: [rce] cameras, [pulsepal] stim, [calibration] scales,
|
|
@@ -144,7 +144,7 @@ include = [
|
|
|
144
144
|
[tool.commitizen]
|
|
145
145
|
name = "cz_conventional_commits"
|
|
146
146
|
version_provider = "commitizen"
|
|
147
|
-
version = "2.16.
|
|
147
|
+
version = "2.16.4"
|
|
148
148
|
tag_format = "v$version"
|
|
149
149
|
update_changelog_on_bump = false
|
|
150
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
|
-
|
|
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["
|
|
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["
|
|
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
|
-
#
|
|
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,
|
|
244
|
-
"""Write overlay task.yaml with
|
|
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
|
|
253
|
-
"""task_mode in subject YAML task_overrides is
|
|
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"
|
|
262
|
+
tmp_path, "_test_flush_valves", {"low_volume": {"VALVE_OPENING_TIME_MS": 25.0}}
|
|
264
263
|
)
|
|
265
|
-
|
|
266
|
-
|
|
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
|
|
271
|
-
"""
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
|
305
|
-
"""
|
|
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
|
-
"
|
|
315
|
-
"N_FLUSH_CYCLES": 7,
|
|
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,
|
|
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
|
-
|
|
324
|
-
patched
|
|
325
|
-
assert patched["
|
|
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"]
|
murineshiftwork-2.16.2/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.16.2
|