plasma-app 2.2.0__tar.gz → 2.2.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.
- {plasma_app-2.2.0 → plasma_app-2.2.3}/PKG-INFO +9 -2
- {plasma_app-2.2.0 → plasma_app-2.2.3}/README.md +8 -1
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/__init__.py +1 -1
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/app_context.py +9 -4
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/desktop_shortcut.py +56 -5
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/config.py +28 -6
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/device.py +32 -1
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma_app.egg-info/PKG-INFO +9 -2
- {plasma_app-2.2.0 → plasma_app-2.2.3}/LICENSE +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/__main__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/__pyinstaller/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/__pyinstaller/hook-plasma.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/api.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/build_info.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/config.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/ctl.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/bitalino.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/ble_scan.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/bleak_probe.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/bleak_reconnect_test.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/detect.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/extract/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/extract/__main__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/extract/clocksync.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/extract/options.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/extract/pipeline.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/formats/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/gyro_bias.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/nus_sim.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/nus_stream.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/_common.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/clocksync.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/control.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/downloader.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/extractor.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/imu.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/sqc.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/tools.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/uuid_tools.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/panels/viewer.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/quaternion.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/records.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense/signal_quality.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense_demo/__init__.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense_demo/config.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense_demo/device.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense_demo/fake_stream.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/msense_demo/faults.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/obs.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/pupil_labs.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/qb2.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/shimmer.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/devices/template.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/integrated_panel.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/journal.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/lsl_recorder.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/lsl_session.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/lsl_util.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/plot_util.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/plugins.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/resources/icons/plasma.icns +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/resources/icons/plasma.ico +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/resources/icons/plasma.png +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/resources/icons/plasma.svg +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/status.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma/xdf_writer.py +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma_app.egg-info/SOURCES.txt +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma_app.egg-info/dependency_links.txt +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma_app.egg-info/entry_points.txt +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma_app.egg-info/requires.txt +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/plasma_app.egg-info/top_level.txt +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/pyproject.toml +0 -0
- {plasma_app-2.2.0 → plasma_app-2.2.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plasma-app
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: PLASMA — Platform for LSL-based Acquisition of Sensor Metrics and Analytics
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/YuyiChang/PLASMA
|
|
@@ -56,6 +56,13 @@ from faults.
|
|
|
56
56
|
|
|
57
57
|
## quickstart
|
|
58
58
|
|
|
59
|
+
**macOS: `brew install --cask yuyichang/plasma/plasma`** is the recommended
|
|
60
|
+
way to get PLASMA — no Python, no `liblsl`, no Gatekeeper dance. See
|
|
61
|
+
[Install & first launch](https://yuyichang.github.io/PLASMA/playbook/install/)
|
|
62
|
+
for that and every other install path (prebuilt binaries, PyPI, from source).
|
|
63
|
+
|
|
64
|
+
To run from source instead:
|
|
65
|
+
|
|
59
66
|
- `conda create -n plasma python=3.12`
|
|
60
67
|
- `conda activate plasma`
|
|
61
68
|
- `pip install -e ".[all]"` — or a lean subset, e.g. `".[msense]"` / `".[qb2,pupil]"`
|
|
@@ -94,7 +101,7 @@ plugins: `msense`, `qb2`, `pupil`, `shimmer`, `obs` (and `all`).
|
|
|
94
101
|
- [x] linux aarch64 build — `PLASMA_Linux_arm64` for Jetson Orin (JetPack 6); CI job `build-linux-arm64`
|
|
95
102
|
- [ ] infrequent stream (e.g., PLASMA journaler) shows green after recording stop
|
|
96
103
|
- [ ] doc for msense workflow with better screenshots
|
|
97
|
-
- [
|
|
104
|
+
- [x] memo `stage` transition logic optimization (e.g., timing of "ready to start" msg wrt sensor init status)
|
|
98
105
|
|
|
99
106
|
## developing a sensor plugin
|
|
100
107
|
|
|
@@ -8,6 +8,13 @@ from faults.
|
|
|
8
8
|
|
|
9
9
|
## quickstart
|
|
10
10
|
|
|
11
|
+
**macOS: `brew install --cask yuyichang/plasma/plasma`** is the recommended
|
|
12
|
+
way to get PLASMA — no Python, no `liblsl`, no Gatekeeper dance. See
|
|
13
|
+
[Install & first launch](https://yuyichang.github.io/PLASMA/playbook/install/)
|
|
14
|
+
for that and every other install path (prebuilt binaries, PyPI, from source).
|
|
15
|
+
|
|
16
|
+
To run from source instead:
|
|
17
|
+
|
|
11
18
|
- `conda create -n plasma python=3.12`
|
|
12
19
|
- `conda activate plasma`
|
|
13
20
|
- `pip install -e ".[all]"` — or a lean subset, e.g. `".[msense]"` / `".[qb2,pupil]"`
|
|
@@ -46,7 +53,7 @@ plugins: `msense`, `qb2`, `pupil`, `shimmer`, `obs` (and `all`).
|
|
|
46
53
|
- [x] linux aarch64 build — `PLASMA_Linux_arm64` for Jetson Orin (JetPack 6); CI job `build-linux-arm64`
|
|
47
54
|
- [ ] infrequent stream (e.g., PLASMA journaler) shows green after recording stop
|
|
48
55
|
- [ ] doc for msense workflow with better screenshots
|
|
49
|
-
- [
|
|
56
|
+
- [x] memo `stage` transition logic optimization (e.g., timing of "ready to start" msg wrt sensor init status)
|
|
50
57
|
|
|
51
58
|
## developing a sensor plugin
|
|
52
59
|
|
|
@@ -36,7 +36,7 @@ import os
|
|
|
36
36
|
import sys
|
|
37
37
|
from dataclasses import dataclass, replace
|
|
38
38
|
|
|
39
|
-
__all__ = ["AppContext", "app_context", "configure", "reset"]
|
|
39
|
+
__all__ = ["AppContext", "app_context", "configure", "reset", "user_data_dir"]
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
@dataclass(frozen=True)
|
|
@@ -71,8 +71,13 @@ _ctx: AppContext | None = None
|
|
|
71
71
|
_DEFAULT_APP_DIR = "PLASMA"
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
def
|
|
75
|
-
"""Per-user, per-OS application-data directory (stdlib, no platformdirs).
|
|
74
|
+
def user_data_dir(app: str = _DEFAULT_APP_DIR) -> str:
|
|
75
|
+
"""Per-user, per-OS application-data directory (stdlib, no platformdirs).
|
|
76
|
+
|
|
77
|
+
Public so other entry points (e.g. ``plasma.desktop_shortcut``) can target
|
|
78
|
+
the same directory a frozen build would resolve to, without themselves
|
|
79
|
+
running frozen.
|
|
80
|
+
"""
|
|
76
81
|
if sys.platform == "win32":
|
|
77
82
|
base = os.environ.get("LOCALAPPDATA") or os.path.join(
|
|
78
83
|
os.path.expanduser("~"), "AppData", "Local")
|
|
@@ -95,7 +100,7 @@ def _from_env() -> AppContext:
|
|
|
95
100
|
if env:
|
|
96
101
|
return AppContext(home=env)
|
|
97
102
|
if _is_frozen():
|
|
98
|
-
return AppContext(home=
|
|
103
|
+
return AppContext(home=user_data_dir())
|
|
99
104
|
return AppContext(home=os.getcwd())
|
|
100
105
|
|
|
101
106
|
|
|
@@ -14,9 +14,19 @@ Points the shortcut directly at *this* environment's ``plasma`` console-script
|
|
|
14
14
|
than re-deriving a `python -m ...` invocation — see the pyshortcuts prototype
|
|
15
15
|
notes in the packaging discussion for why.
|
|
16
16
|
|
|
17
|
+
The shortcut's working directory is pinned to the same per-OS app-data dir a
|
|
18
|
+
frozen PyInstaller build resolves to (``plasma.app_context.user_data_dir``),
|
|
19
|
+
not left to whatever the OS defaults a new shortcut to (``$HOME`` on
|
|
20
|
+
Windows/Linux; an unspecified Terminal default on macOS). Since
|
|
21
|
+
``plasma.app_context`` falls back to the working directory for a non-frozen
|
|
22
|
+
process, this keeps the Desktop-icon launch and a downloaded prebuilt binary
|
|
23
|
+
reading/writing config from the same place.
|
|
24
|
+
|
|
17
25
|
plasma-install-shortcut [--name NAME] [--no-terminal] [--no-startmenu]
|
|
18
26
|
|
|
19
|
-
Requires the ``desktop`` extra (``pip install plasma-app[desktop]``
|
|
27
|
+
Requires the ``desktop`` extra (``pip install "plasma-app[desktop]"`` —
|
|
28
|
+
quote it, or zsh's glob expansion on ``[...]`` will fail with "no matches
|
|
29
|
+
found").
|
|
20
30
|
"""
|
|
21
31
|
from __future__ import annotations
|
|
22
32
|
|
|
@@ -26,6 +36,8 @@ import shutil
|
|
|
26
36
|
import sys
|
|
27
37
|
from pathlib import Path
|
|
28
38
|
|
|
39
|
+
from plasma.app_context import user_data_dir
|
|
40
|
+
|
|
29
41
|
_ICON_DIR = Path(__file__).parent / "resources" / "icons"
|
|
30
42
|
|
|
31
43
|
|
|
@@ -60,6 +72,35 @@ def _plasma_executable() -> str:
|
|
|
60
72
|
)
|
|
61
73
|
|
|
62
74
|
|
|
75
|
+
def _target_home() -> str:
|
|
76
|
+
"""Where the shortcut should run PLASMA from — the same per-OS app-data
|
|
77
|
+
dir a frozen build resolves to (``$PLASMA_HOME`` still wins if set,
|
|
78
|
+
matching ``app_context``'s own precedence)."""
|
|
79
|
+
return os.environ.get("PLASMA_HOME") or user_data_dir()
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _launch_script(target_home: str) -> str:
|
|
83
|
+
"""Path handed to pyshortcuts as the thing to run.
|
|
84
|
+
|
|
85
|
+
On Windows/Linux, pyshortcuts writes ``target_home`` into the shortcut
|
|
86
|
+
itself (the ``.lnk`` ``WorkingDirectory`` / the ``.desktop`` ``Path=``
|
|
87
|
+
key), so the plain console-script is enough. On macOS, pyshortcuts'
|
|
88
|
+
Terminal/Automator launcher never applies ``working_dir`` at all — so we
|
|
89
|
+
wrap the console-script in a tiny shell script that ``cd``s first.
|
|
90
|
+
"""
|
|
91
|
+
exe = _plasma_executable()
|
|
92
|
+
if sys.platform != "darwin":
|
|
93
|
+
return exe
|
|
94
|
+
wrapper = Path(target_home) / "plasma-launch.sh"
|
|
95
|
+
wrapper.write_text(
|
|
96
|
+
"#!/bin/sh\n"
|
|
97
|
+
f'cd "{target_home}" || exit 1\n'
|
|
98
|
+
f'exec "{exe}"\n'
|
|
99
|
+
)
|
|
100
|
+
wrapper.chmod(0o755)
|
|
101
|
+
return str(wrapper)
|
|
102
|
+
|
|
103
|
+
|
|
63
104
|
def install_shortcut(name="PLASMA", terminal=True, startmenu=True, folder=None):
|
|
64
105
|
"""Create the Desktop (+ Start Menu, if requested) shortcut. Returns the
|
|
65
106
|
``pyshortcuts.Shortcut`` namedtuple describing what was written.
|
|
@@ -76,19 +117,23 @@ def install_shortcut(name="PLASMA", terminal=True, startmenu=True, folder=None):
|
|
|
76
117
|
except ImportError as e:
|
|
77
118
|
raise ImportError(
|
|
78
119
|
"pyshortcuts is required to create a desktop shortcut — install "
|
|
79
|
-
|
|
120
|
+
'it with `pip install "plasma-app[desktop]"`.'
|
|
80
121
|
) from e
|
|
81
122
|
|
|
123
|
+
target_home = _target_home()
|
|
124
|
+
os.makedirs(target_home, exist_ok=True)
|
|
125
|
+
|
|
82
126
|
return make_shortcut(
|
|
83
|
-
script=
|
|
127
|
+
script=_launch_script(target_home),
|
|
84
128
|
name=name,
|
|
85
129
|
description="PLASMA sensor acquisition dashboard",
|
|
86
130
|
icon=_icon_path(),
|
|
87
131
|
terminal=terminal,
|
|
88
132
|
desktop=True,
|
|
89
133
|
startmenu=startmenu, # pyshortcuts itself no-ops this on macOS
|
|
134
|
+
working_dir=target_home,
|
|
90
135
|
folder=folder,
|
|
91
|
-
noexe=True, # script is already a standalone console-script
|
|
136
|
+
noexe=True, # script is already a standalone console-script/wrapper
|
|
92
137
|
)
|
|
93
138
|
|
|
94
139
|
|
|
@@ -114,7 +159,13 @@ def main(argv=None):
|
|
|
114
159
|
startmenu=not args.no_startmenu,
|
|
115
160
|
)
|
|
116
161
|
print(f"Created shortcut: {scut.target}")
|
|
117
|
-
|
|
162
|
+
# NOTE: not scut.script/scut.full_script — pyshortcuts splits `script` on
|
|
163
|
+
# its first space to separate a script from trailing arguments, which
|
|
164
|
+
# mangles this when the path itself contains a space (e.g. macOS's
|
|
165
|
+
# "Application Support"). The shortcut it writes is still correct; only
|
|
166
|
+
# the returned namedtuple's script fields are truncated for display.
|
|
167
|
+
print(f" runs: {_plasma_executable()}")
|
|
168
|
+
print(f" in: {scut.working_dir}")
|
|
118
169
|
print(f" desktop: {scut.desktop_dir}")
|
|
119
170
|
if scut.startmenu_dir:
|
|
120
171
|
print(f" menu: {scut.startmenu_dir}")
|
|
@@ -46,7 +46,12 @@ def merge_msense_records(existing, scanned, overwrite):
|
|
|
46
46
|
|
|
47
47
|
``overwrite=True`` → one fresh record per scanned device, nothing kept.
|
|
48
48
|
``overwrite=False`` → ``existing`` plus a record for every scanned address
|
|
49
|
-
not already listed (case-insensitive on "UUID / MAC Address").
|
|
49
|
+
not already listed (case-insensitive on "UUID / MAC Address"). A scanned
|
|
50
|
+
address that IS already listed has that record's Name refreshed to the
|
|
51
|
+
freshly advertised name instead — Nickname/Enabled/IMU Stream are left
|
|
52
|
+
alone — so a firmware update that changes the advertised name reaches the
|
|
53
|
+
table via Append without needing Overwrite (which would also reset those
|
|
54
|
+
per-device toggles for every other configured wristband).
|
|
50
55
|
|
|
51
56
|
Fresh records use the advertised name as Name, blank Nickname, Enabled on,
|
|
52
57
|
IMU Stream off. Returns ``(records, summary_str)``.
|
|
@@ -64,13 +69,30 @@ def merge_msense_records(existing, scanned, overwrite):
|
|
|
64
69
|
records = [_fresh(dev) for dev in scanned]
|
|
65
70
|
return records, f"Overwrote table with {len(records)} scanned wristband(s)"
|
|
66
71
|
|
|
72
|
+
scanned_by_addr = {dev["address"].strip().upper(): dev for dev in scanned}
|
|
73
|
+
records = []
|
|
74
|
+
renamed = 0
|
|
75
|
+
for rec in existing:
|
|
76
|
+
dev = scanned_by_addr.get(str(rec.get("UUID / MAC Address", "")).strip().upper())
|
|
77
|
+
if dev and dev["name"] != rec.get("Name", ""):
|
|
78
|
+
rec = {**rec, "Name": dev["name"]}
|
|
79
|
+
renamed += 1
|
|
80
|
+
records.append(rec)
|
|
81
|
+
|
|
67
82
|
have = {str(rec.get("UUID / MAC Address", "")).strip().upper() for rec in existing}
|
|
68
83
|
added = [_fresh(dev) for dev in scanned if dev["address"].strip().upper() not in have]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
records += added
|
|
85
|
+
|
|
86
|
+
unchanged = len(scanned) - len(added) - renamed
|
|
87
|
+
parts = []
|
|
88
|
+
if added:
|
|
89
|
+
parts.append(f"{len(added)} new")
|
|
90
|
+
if renamed:
|
|
91
|
+
parts.append(f"{renamed} renamed")
|
|
92
|
+
if unchanged:
|
|
93
|
+
parts.append(f"{unchanged} unchanged")
|
|
94
|
+
msg = "Appended " + ", ".join(parts) if parts else "No changes"
|
|
95
|
+
return records, msg
|
|
74
96
|
|
|
75
97
|
|
|
76
98
|
# ── device_info.json import (YAMS provisioning format) ───────────────────────
|
|
@@ -74,6 +74,10 @@ BATTERY_CHAR_UUID = "00002a19-0000-1000-8000-00805f9b34fb"
|
|
|
74
74
|
|
|
75
75
|
SQC_MIN_MTU = 128
|
|
76
76
|
SQC_DEBUG = True # emit per-notification telemetry (printed off the BLE thread)
|
|
77
|
+
# devices with no active SQC/live session still get unsolicited NUS traffic
|
|
78
|
+
# (boot chatter, or firmware that exposes the NUS char but doesn't speak the
|
|
79
|
+
# SQC/live protocol) — coalesce that noise instead of one debug line/packet
|
|
80
|
+
NUS_IDLE_LOG_WINDOW_S = 5.0
|
|
77
81
|
|
|
78
82
|
# NOTE: the overall per-transaction backstop timeout stays DISABLED — the real
|
|
79
83
|
# BLE data rate is far slower than the handoff doc's provisional 35/45 s
|
|
@@ -173,6 +177,11 @@ class MotionSenseHRV(PlasmaDevice):
|
|
|
173
177
|
# addr -> live INFINITY-stream state (see _new_live_state); only ever
|
|
174
178
|
# one NUS stream (SQC snapshot OR live) active per wristband at a time.
|
|
175
179
|
self.live_state = {}
|
|
180
|
+
# addr -> {"count", "bytes", "window_start"} — coalesces the
|
|
181
|
+
# "ignored (no active stream)" debug line so a chatty/idle wristband
|
|
182
|
+
# doesn't flood the console one line per notification (see
|
|
183
|
+
# _log_nus_ignored / NUS_IDLE_LOG_WINDOW_S)
|
|
184
|
+
self._nus_idle_rx = {}
|
|
176
185
|
# addr -> {"status": confirmed|unconfirmed|unverifiable|unknown,
|
|
177
186
|
# "checked_at": ts} — set by collection_ctl(addr, False), see
|
|
178
187
|
# _confirm_acq_stopped. Cleared on the next collection_ctl(addr, True).
|
|
@@ -1325,7 +1334,7 @@ class MotionSenseHRV(PlasmaDevice):
|
|
|
1325
1334
|
elif live and live.get("session") and not live["session"].is_terminal:
|
|
1326
1335
|
self._handle_live_notification(live, name, bytes(data), now, t_entry)
|
|
1327
1336
|
else:
|
|
1328
|
-
self.
|
|
1337
|
+
self._log_nus_ignored(name, len(data))
|
|
1329
1338
|
except Exception as e:
|
|
1330
1339
|
self.info(f"Error handling NUS data from {name}: {e}")
|
|
1331
1340
|
|
|
@@ -1520,6 +1529,28 @@ class MotionSenseHRV(PlasmaDevice):
|
|
|
1520
1529
|
except queue.Full:
|
|
1521
1530
|
pass # never block the BLE thread on a slow console
|
|
1522
1531
|
|
|
1532
|
+
def _log_nus_ignored(self, name, nbytes):
|
|
1533
|
+
# first notification in a window prints immediately (so isolated,
|
|
1534
|
+
# one-off chatter is still visible); anything after that within
|
|
1535
|
+
# NUS_IDLE_LOG_WINDOW_S is tallied silently and flushed as one
|
|
1536
|
+
# rolled-up line — keeps a continuously-chattering/no-session
|
|
1537
|
+
# wristband (e.g. firmware that exposes NUS but doesn't speak the
|
|
1538
|
+
# SQC/live protocol) from spamming a line per packet
|
|
1539
|
+
st = self._nus_idle_rx.setdefault(name, {"count": 0, "bytes": 0, "window_start": 0.0})
|
|
1540
|
+
now = time.time()
|
|
1541
|
+
st["count"] += 1
|
|
1542
|
+
st["bytes"] += nbytes
|
|
1543
|
+
if now - st["window_start"] < NUS_IDLE_LOG_WINDOW_S:
|
|
1544
|
+
return
|
|
1545
|
+
if st["count"] > 1:
|
|
1546
|
+
self._sqc_debug(
|
|
1547
|
+
name, f"rx {st['count']}x ({st['bytes']}B total) ignored (no active stream)")
|
|
1548
|
+
else:
|
|
1549
|
+
self._sqc_debug(name, f"rx {nbytes}B ignored (no active stream)")
|
|
1550
|
+
st["count"] = 0
|
|
1551
|
+
st["bytes"] = 0
|
|
1552
|
+
st["window_start"] = now
|
|
1553
|
+
|
|
1523
1554
|
def _sqc_diag_summary(self, name, store=None):
|
|
1524
1555
|
d = (store or self.sqc_state).get(name, {}).get("diag")
|
|
1525
1556
|
if not d:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plasma-app
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: PLASMA — Platform for LSL-based Acquisition of Sensor Metrics and Analytics
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/YuyiChang/PLASMA
|
|
@@ -56,6 +56,13 @@ from faults.
|
|
|
56
56
|
|
|
57
57
|
## quickstart
|
|
58
58
|
|
|
59
|
+
**macOS: `brew install --cask yuyichang/plasma/plasma`** is the recommended
|
|
60
|
+
way to get PLASMA — no Python, no `liblsl`, no Gatekeeper dance. See
|
|
61
|
+
[Install & first launch](https://yuyichang.github.io/PLASMA/playbook/install/)
|
|
62
|
+
for that and every other install path (prebuilt binaries, PyPI, from source).
|
|
63
|
+
|
|
64
|
+
To run from source instead:
|
|
65
|
+
|
|
59
66
|
- `conda create -n plasma python=3.12`
|
|
60
67
|
- `conda activate plasma`
|
|
61
68
|
- `pip install -e ".[all]"` — or a lean subset, e.g. `".[msense]"` / `".[qb2,pupil]"`
|
|
@@ -94,7 +101,7 @@ plugins: `msense`, `qb2`, `pupil`, `shimmer`, `obs` (and `all`).
|
|
|
94
101
|
- [x] linux aarch64 build — `PLASMA_Linux_arm64` for Jetson Orin (JetPack 6); CI job `build-linux-arm64`
|
|
95
102
|
- [ ] infrequent stream (e.g., PLASMA journaler) shows green after recording stop
|
|
96
103
|
- [ ] doc for msense workflow with better screenshots
|
|
97
|
-
- [
|
|
104
|
+
- [x] memo `stage` transition logic optimization (e.g., timing of "ready to start" msg wrt sensor init status)
|
|
98
105
|
|
|
99
106
|
## developing a sensor plugin
|
|
100
107
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|