msw-core 0.2.0__py3-none-any.whl
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.
- msw_core-0.2.0.dist-info/METADATA +47 -0
- msw_core-0.2.0.dist-info/RECORD +51 -0
- msw_core-0.2.0.dist-info/WHEEL +4 -0
- msw_core-0.2.0.dist-info/entry_points.txt +3 -0
- msw_core-0.2.0.dist-info/licenses/LICENSE +0 -0
- murineshiftwork/_version.py +24 -0
- murineshiftwork/cli/__init__.py +68 -0
- murineshiftwork/cli/__main__.py +4 -0
- murineshiftwork/cli/defaults.py +44 -0
- murineshiftwork/cli/evaluate.py +541 -0
- murineshiftwork/cli/execute.py +460 -0
- murineshiftwork/cli/parser.py +734 -0
- murineshiftwork/cli/post.py +113 -0
- murineshiftwork/cli/preflight.py +75 -0
- murineshiftwork/cli/tasks.py +243 -0
- murineshiftwork/hardware/__init__.py +0 -0
- murineshiftwork/hardware/bpod/__init__.py +19 -0
- murineshiftwork/hardware/bpod/actions.py +96 -0
- murineshiftwork/hardware/bpod/device.py +54 -0
- murineshiftwork/hardware/bpod/factory.py +205 -0
- murineshiftwork/hardware/bpod/override.py +130 -0
- murineshiftwork/hardware/bpod/sim.py +150 -0
- murineshiftwork/hardware/bpod/ttl.py +35 -0
- murineshiftwork/hardware/bpod/user_settings.py +22 -0
- murineshiftwork/hardware/bpod/user_settings_8port.py +7 -0
- murineshiftwork/hardware/bpod/valve.py +79 -0
- murineshiftwork/hardware/camera/__init__.py +3 -0
- murineshiftwork/hardware/camera/client.py +303 -0
- murineshiftwork/hardware/host_session.py +70 -0
- murineshiftwork/hardware/manager.py +98 -0
- murineshiftwork/hardware/pulsepal/__init__.py +1 -0
- murineshiftwork/hardware/pulsepal/device.py +62 -0
- murineshiftwork/hardware/scale.py +182 -0
- murineshiftwork/hardware/stimulation.py +507 -0
- murineshiftwork/hooks/__init__.py +167 -0
- murineshiftwork/logic/__init__.py +0 -0
- murineshiftwork/logic/barcode.py +59 -0
- murineshiftwork/logic/calibration.py +608 -0
- murineshiftwork/logic/config/__init__.py +43 -0
- murineshiftwork/logic/config/_defaults.py +15 -0
- murineshiftwork/logic/config/ini.py +75 -0
- murineshiftwork/logic/config/io.py +241 -0
- murineshiftwork/logic/config/models.py +399 -0
- murineshiftwork/logic/log.py +139 -0
- murineshiftwork/logic/machine_config.py +171 -0
- murineshiftwork/logic/maths.py +44 -0
- murineshiftwork/logic/misc.py +71 -0
- murineshiftwork/logic/paths.py +55 -0
- murineshiftwork/logic/sounds.py +267 -0
- murineshiftwork/logic/task_process.py +498 -0
- murineshiftwork/logic/task_settings.py +99 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: msw-core
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Murine Shift Work acquisition stack: CLI, hardware, hooks, and logic.
|
|
5
|
+
Project-URL: Homepage, https://github.com/MurineShiftWork/msw-core
|
|
6
|
+
Project-URL: Issue Tracker, https://github.com/MurineShiftWork/msw-core/issues
|
|
7
|
+
Author-email: "Lars B. Rollik" <lars@rollik.me>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Requires-Dist: matplotlib
|
|
11
|
+
Requires-Dist: msw-io>=1.0.2
|
|
12
|
+
Requires-Dist: msw-plugin-api>=0.1.0
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: one-axis-stage
|
|
15
|
+
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: pybpod-api
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Requires-Dist: pyserial
|
|
19
|
+
Requires-Dist: pyyaml
|
|
20
|
+
Requires-Dist: rich
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Requires-Dist: seaborn
|
|
23
|
+
Requires-Dist: sounddevice
|
|
24
|
+
Requires-Dist: ttl-barcoder>=0.4.1
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: commitizen; extra == 'dev'
|
|
27
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
28
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
31
|
+
Requires-Dist: types-pyyaml; extra == 'dev'
|
|
32
|
+
Provides-Extra: docs
|
|
33
|
+
Requires-Dist: mkdocs-material; extra == 'docs'
|
|
34
|
+
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# msw-core
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/msw-core)
|
|
40
|
+
|
|
41
|
+
Murine Shift Work acquisition stack: CLI, hardware drivers, session hooks, and task logic.
|
|
42
|
+
|
|
43
|
+
Provides the `murineshiftwork.cli`, `murineshiftwork.hardware`, `murineshiftwork.hooks`,
|
|
44
|
+
and `murineshiftwork.logic` namespace sub-packages. Installs the `msw` / `murineshiftwork`
|
|
45
|
+
CLI entry points.
|
|
46
|
+
|
|
47
|
+
Part of the [MurineShiftWork](https://github.com/MurineShiftWork) namespace package ecosystem.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
murineshiftwork/_version.py,sha256=s9U3X54Pdr-Jlh9GP6LBaa_VRos7qs_wtrVefUHHNIA,520
|
|
2
|
+
murineshiftwork/cli/__init__.py,sha256=DGzlZv34r7d7X2864t0HAteiZ9D1n8Q-jsS17tTGA4U,1589
|
|
3
|
+
murineshiftwork/cli/__main__.py,sha256=CaqwO3qsZYcJSWGUB1u4Cuv5ODesQz-b9Tgd7MKQW_E,82
|
|
4
|
+
murineshiftwork/cli/defaults.py,sha256=Ak79skDim3WmlzzwsuEa3vlOWNZvvqzgQ3g6HEa-8-I,1369
|
|
5
|
+
murineshiftwork/cli/evaluate.py,sha256=5QeaIRMRf4S6dx1M504Y68W2jvh160g-o_h7tCBMSG8,20695
|
|
6
|
+
murineshiftwork/cli/execute.py,sha256=gM3AEpOj0Y3dWZ0n8h_zr4aVLtZWg6Pbt0BLiTu_w1k,15715
|
|
7
|
+
murineshiftwork/cli/parser.py,sha256=5pRRk9sLcVtNOvCZfIxE7GJNLFRC80nP_Ewxl_FE66g,21776
|
|
8
|
+
murineshiftwork/cli/post.py,sha256=MkmVLJt5Pz0Mj1aaBb7s6Z5kcxh5Ba9KNfZBfoSY97k,3613
|
|
9
|
+
murineshiftwork/cli/preflight.py,sha256=eB5HYJ-89o9oUccGInt_n68DAVNq1cQdiOaPIT-oj6g,3045
|
|
10
|
+
murineshiftwork/cli/tasks.py,sha256=dF7wIBHvBA7md9IghDtnAL230oDq7JF_68ciu6kQjH4,7710
|
|
11
|
+
murineshiftwork/hardware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
murineshiftwork/hardware/host_session.py,sha256=eJ51Z_RdD5wb9wzxK5Wwm-4N6cWIEod5LJq-SdEasQE,2425
|
|
13
|
+
murineshiftwork/hardware/manager.py,sha256=gzH1xPMPqnQy5BFGYm-3TB_8EzYEHSv4M81aynwdGik,3133
|
|
14
|
+
murineshiftwork/hardware/scale.py,sha256=-pBnYQzNcDgGiIRIK5qT6HnUbAlurG8Mf8NyIqCSX_Q,6035
|
|
15
|
+
murineshiftwork/hardware/stimulation.py,sha256=DsAlisZH9weh8JcmMBFBButBQf1pD8oWXS66oPWMBs4,21024
|
|
16
|
+
murineshiftwork/hardware/bpod/__init__.py,sha256=pT82ef1bx1HJUK6-xW65R3WlL1JVc2FQgODNO9fzYtg,749
|
|
17
|
+
murineshiftwork/hardware/bpod/actions.py,sha256=jHzZo0lchhrCGmZ0Z1Nhw5ticr1ApbdD4UBlUGlB4Hw,3829
|
|
18
|
+
murineshiftwork/hardware/bpod/device.py,sha256=P9Ad2y8Ifwlw8vcMsxwfpoK9tbzJtpboyEE75dKoJww,1806
|
|
19
|
+
murineshiftwork/hardware/bpod/factory.py,sha256=5ceuzsJju_LjaI8AWwo_Sh2161y0-8Xlt2QrbUdG1oA,7325
|
|
20
|
+
murineshiftwork/hardware/bpod/override.py,sha256=DlIDmZZBC7j3HBduoXImWYGMMPxu-RTEPkx8Kmwc8Z0,4368
|
|
21
|
+
murineshiftwork/hardware/bpod/sim.py,sha256=GosbVXLcwrdQg0qnRAAwLwPbvMK0nyuNcyTjmbTlJFo,4461
|
|
22
|
+
murineshiftwork/hardware/bpod/ttl.py,sha256=igEDqonU8HZzesKwS7fA5rtvl0n53WjPgxyhSVGoxvE,1057
|
|
23
|
+
murineshiftwork/hardware/bpod/user_settings.py,sha256=PMe50C9jDK7OJOAC7PX6ldP2H3lccNZVRiOpgyBOodI,744
|
|
24
|
+
murineshiftwork/hardware/bpod/user_settings_8port.py,sha256=-10Il4hhdivYwu16NlPbhgQU1z3b0UGZDF5hU7zCzIc,359
|
|
25
|
+
murineshiftwork/hardware/bpod/valve.py,sha256=4gxhT5Yt8fieM7TRjTsFgjyjVy3tIKnr-upX2A3vopU,2400
|
|
26
|
+
murineshiftwork/hardware/camera/__init__.py,sha256=rQ4Q6jL8YexGu9-6jV436SAuXLNQYg9BcKl8KcQ-Y60,104
|
|
27
|
+
murineshiftwork/hardware/camera/client.py,sha256=x-981AdksFUnfgrGT8TwGFdxGCZ62W06p0lHh55egf8,11142
|
|
28
|
+
murineshiftwork/hardware/pulsepal/__init__.py,sha256=MEZ6E-jf0EOlqQGsOafuQkrwCeAaAzhJrYlqeFbXGoA,86
|
|
29
|
+
murineshiftwork/hardware/pulsepal/device.py,sha256=J0XPmauWAm2IqVVc5Ud2H3rrSaIoSj3QMz6zabJRylo,2023
|
|
30
|
+
murineshiftwork/hooks/__init__.py,sha256=02g-Cquh7wHBHYymfoXLwPWJpMZMcyOrh4jDeIF_VSI,5504
|
|
31
|
+
murineshiftwork/logic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
+
murineshiftwork/logic/barcode.py,sha256=C1dgRRPWhQ1UXWEDs3E9j4owmzPYAkPAsnIoTxzxY5o,1978
|
|
33
|
+
murineshiftwork/logic/calibration.py,sha256=7kANswyqkPJve0KPQaLAH1hX7VP2SU8NkUTCpCitQiQ,21392
|
|
34
|
+
murineshiftwork/logic/log.py,sha256=wLSpwPkYUQXfv6GzXJiyR7usEUdhS_uTkkRa4Bk_2L8,4657
|
|
35
|
+
murineshiftwork/logic/machine_config.py,sha256=DIAWHIWszkCse0CY2c0MsEWpTQ8Lvkz8m7CFuFhrFt0,5419
|
|
36
|
+
murineshiftwork/logic/maths.py,sha256=sbeM943BES_i92NUDdobjjz1_Xo5j0L8jVkbMehqn4A,1317
|
|
37
|
+
murineshiftwork/logic/misc.py,sha256=3FBDveykuhd-8M0HpfcIlOpgz0IpP4zQbIvHcyyqoEM,1954
|
|
38
|
+
murineshiftwork/logic/paths.py,sha256=9QNR44JsGyHq2Z9pkD78UIa8HWCJOkZCBJh0FTxbnCE,1236
|
|
39
|
+
murineshiftwork/logic/sounds.py,sha256=M_tZuGxdU2f3zKIf0jUDvO7YgFvND942yzmYtTh2AFI,8844
|
|
40
|
+
murineshiftwork/logic/task_process.py,sha256=MARTHqoZvrBuSvAbPr5X9mTaCZc7ixDHPt1mfdlcErs,17274
|
|
41
|
+
murineshiftwork/logic/task_settings.py,sha256=BDq33QS3h0FYkCNBd2bkqa0Ly8m7Ldy89jVA8HufGbo,3544
|
|
42
|
+
murineshiftwork/logic/config/__init__.py,sha256=_BljktAkQxPiw6uw9iREFRh5ftAL-_xhtFUR-0ap80E,1176
|
|
43
|
+
murineshiftwork/logic/config/_defaults.py,sha256=DVzmtNf4jK_6rqQrrl6rhw0Jz5q8ZtMSt3LYHLOJhpU,462
|
|
44
|
+
murineshiftwork/logic/config/ini.py,sha256=N9uDssX_nRSkbi4qiUhwmY2hd0Ogto54C2aG5nT10SU,2416
|
|
45
|
+
murineshiftwork/logic/config/io.py,sha256=fTfY6jQkIQoLASM48cLejQy2oYssYZAsO-sc_8IlG1g,8014
|
|
46
|
+
murineshiftwork/logic/config/models.py,sha256=M8vj5qy03az8RxA_8PEpQd803YzmPq9eK8yCB518WPs,13636
|
|
47
|
+
msw_core-0.2.0.dist-info/METADATA,sha256=QGJ16RVR9rBY8uHE6CECqLDTkdGimMH_KtOEDCuWT40,1681
|
|
48
|
+
msw_core-0.2.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
49
|
+
msw_core-0.2.0.dist-info/entry_points.txt,sha256=FYd0qTUNwEHO-NDXPycDGhF-arnt18VTeYNE03tuMQk,98
|
|
50
|
+
msw_core-0.2.0.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
|
+
msw_core-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.2.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from murineshiftwork.cli.evaluate import evaluate_args
|
|
5
|
+
from murineshiftwork.cli.parser import parse_args
|
|
6
|
+
from murineshiftwork.hardware.bpod import patch_user_settings
|
|
7
|
+
from murineshiftwork.logic.log import patch_logging_levels
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _print_run_banner():
|
|
11
|
+
from importlib.metadata import version as _v
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
ver = _v("murineshiftwork")
|
|
15
|
+
except Exception:
|
|
16
|
+
ver = "unknown"
|
|
17
|
+
print(f"msw {ver} | © Lars B. Rollik | PolyForm Internal Use 1.0.0")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def run_cli(*args):
|
|
21
|
+
"""Command line interface for Murine Shift Work."""
|
|
22
|
+
patch_logging_levels()
|
|
23
|
+
patch_user_settings()
|
|
24
|
+
|
|
25
|
+
if not args:
|
|
26
|
+
args = sys.argv[1:]
|
|
27
|
+
|
|
28
|
+
if len(args) > 0 and not isinstance(args[0], str):
|
|
29
|
+
args = args[0]
|
|
30
|
+
|
|
31
|
+
if len(args) > 0 and str(args[0]).endswith(".py"):
|
|
32
|
+
_, args = args[0], args[1:]
|
|
33
|
+
|
|
34
|
+
if len(args) <= 1:
|
|
35
|
+
args = args + ["-h"]
|
|
36
|
+
|
|
37
|
+
args_dict = parse_args(args=args)
|
|
38
|
+
|
|
39
|
+
# These subcommands bypass evaluate_args (no hardware/subject/task context needed)
|
|
40
|
+
if args_dict.get("command") in (
|
|
41
|
+
"init",
|
|
42
|
+
"setup",
|
|
43
|
+
"subject",
|
|
44
|
+
"calibration",
|
|
45
|
+
"action",
|
|
46
|
+
"tasks",
|
|
47
|
+
"post",
|
|
48
|
+
):
|
|
49
|
+
args_dict["func"](**args_dict)
|
|
50
|
+
logging.debug("EXITING CLI.")
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
if args_dict.get("command") == "run":
|
|
54
|
+
_print_run_banner()
|
|
55
|
+
|
|
56
|
+
args_dict = evaluate_args(args_dict=args_dict)
|
|
57
|
+
|
|
58
|
+
if "exit_flag" in args_dict:
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
# Call module
|
|
62
|
+
args_dict["func"](**args_dict)
|
|
63
|
+
|
|
64
|
+
logging.debug("EXITING CLI.")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
run_cli()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Module-load-time defaults for the CLI.
|
|
2
|
+
|
|
3
|
+
Factored out of evaluate.py so parser.py can import them without importing the
|
|
4
|
+
full evaluate pipeline, avoiding any risk of a circular dependency.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from murineshiftwork.cli.tasks import list_available_tasks
|
|
10
|
+
from murineshiftwork.logic.machine_config import (
|
|
11
|
+
resolve_config_dir,
|
|
12
|
+
resolve_data_dir,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
default_out_path = resolve_data_dir()
|
|
16
|
+
default_config_dir = resolve_config_dir()
|
|
17
|
+
|
|
18
|
+
CALIBRATION_FILE_PATH = Path("~/.murineshiftwork").expanduser()
|
|
19
|
+
DEFAULT_CALIBRATION_FILE_LIQUID = str(
|
|
20
|
+
CALIBRATION_FILE_PATH / "calibration.liquid.default.csv"
|
|
21
|
+
)
|
|
22
|
+
DEFAULT_CALIBRATION_FILE_SOUND = "calibration.sound.default.csv"
|
|
23
|
+
DEFAULT_CALIBRATION_FILE_STAGE = str(
|
|
24
|
+
CALIBRATION_FILE_PATH / "calibration.stage.default.yaml"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _build_task_list() -> str:
|
|
29
|
+
all_tasks = list_available_tasks()
|
|
30
|
+
main = sorted(t for t in all_tasks if not t.startswith("_"))
|
|
31
|
+
calibration = sorted(t for t in all_tasks if t.startswith("_calibration"))
|
|
32
|
+
tests = sorted(t for t in all_tasks if t.startswith("_test"))
|
|
33
|
+
lines = []
|
|
34
|
+
for heading, group in (
|
|
35
|
+
("Tasks", main),
|
|
36
|
+
("Calibration", calibration),
|
|
37
|
+
("Tests", tests),
|
|
38
|
+
):
|
|
39
|
+
lines.append(f" {heading}:")
|
|
40
|
+
lines.extend(f" - {t}" for t in group)
|
|
41
|
+
return "\n".join(lines)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
available_tasks = _build_task_list()
|