Skip to content

Commit 67a0c7f

Browse files
authored
Merge pull request #4 from ezmsg-org/dev
dev -> main for release
2 parents e5c098f + 545b1b4 commit 67a0c7f

20 files changed

Lines changed: 601 additions & 817 deletions

File tree

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
build:
1414
strategy:
1515
matrix:
16-
python-version: ["3.10.15", "3.11", "3.12", "3.13"]
16+
python-version: ["3.11", "3.12", "3.13"]
1717
os:
1818
- "ubuntu-latest"
1919
- "windows-latest"

README.md

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
A namespace package for [ezmsg](https://github.com/iscoe/ezmsg) to visualize running graphs and data.
44

5-
The data visualization is highly fragile. Expect bugs.
5+
Key features:
6+
7+
* **Graph visualization** - Visualize ezmsg graph topologies
8+
* **Data visualization** - Real-time data plotting and monitoring
9+
* **Debug tools** - Tools for debugging ezmsg pipelines
10+
11+
> The data visualization is highly fragile. Expect bugs.
612
713
## Installation
814

@@ -16,6 +22,18 @@ On Mac, you should use brew:
1622
* `export CFLAGS="-I $(brew --prefix graphviz)/include"`
1723
* `export LDFLAGS="-L $(brew --prefix graphviz)/lib"`
1824

25+
On Windows, follow the instructions [here](https://pygraphviz.github.io/documentation/stable/install.html#windows). Short version:
26+
27+
* Download and install [Visual C/C++](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
28+
* Download and install [graphviz](https://gitlab.com/graphviz/graphviz/-/releases). Get the most recent Windows x64 CMake releases.
29+
* Install pygraphviz in your environment:
30+
```
31+
python -m pip install --config-settings="--global-option=build_ext"
32+
--config-settings="--global-option=-IC:\Program Files\Graphviz\include"
33+
--config-settings="--global-option=-LC:\Program Files\Graphviz\lib"
34+
pygraphviz
35+
```
36+
1937
### Release
2038

2139
Install the latest release from pypi with: `pip install ezmsg-tools` (or `uv add ...` or `poetry add ...`).
@@ -24,26 +42,36 @@ More than likely, you will want to include at least one of the extras when insta
2442

2543
`pip install "ezmsg-tools[all]"`
2644

27-
### Development Version
45+
Or install the latest development version:
2846

29-
If you intend to edit `ezmsg-tools` then please refer to the [Developers](#developers) section below.
47+
`pip install "ezmsg-tools[all] @ git+https://github.com/ezmsg-org/ezmsg-tools.git@dev"`
3048

31-
You can add the development version of ezmsg-tools directly from GitHub:
49+
## Getting Started
3250

33-
* Using `pip`: `pip install git+https://github.com/ezmsg-org/ezmsg-tools.git@dev`
34-
* Using `poetry`: `poetry add "git+https://github.com/ezmsg-org/ezmsg-tools.git@dev"`
35-
* Using `uv`: `uv add git+https://github.com/ezmsg-org/ezmsg-tools --branch dev`
51+
This package includes some entrypoints with useful tools.
3652

37-
You probably want to include the extras when installing the development version:
53+
### ezmsg-signal-monitor
3854

39-
* `pip install "ezmsg-tools[all] @ git+https://github.com/ezmsg-org/ezmsg-tools.git@dev"`
55+
The pipeline must be running on a graph service exposed on the network. For example, first, run the GraphService on an open port:
4056

41-
## Getting Started
57+
`ezmsg --address 127.0.0.1:25978 start`
4258

43-
This package includes some entrypoints with useful tools.
59+
Then run your usual pipeline but make sure it attaches to the graph address by passing `graph_address=("127.0.0.1", 25978)` as a kwarg to `ez.run`.
60+
61+
While the pipeline is running, you can run the signal-monitor tool with (`uv run`) `ezmsg-signal-monitor --graph-addr 127.0.0.1:25978`.
62+
63+
This launches a window with graph visualized on the left. Click on a node's output box to get a live visualization on the right side of the screen plotting the data as it leaves that node. Use `a` to toggle auto-scaling. With auto-scaling off, use `-`, and `=` to zoom out and in, respectively. See the [phosphor docs](https://www.ezmsg.org/phosphor/) for the full list of keyboard shortcuts.
64+
65+
> Currently only 2-D outputs are supported!
66+
67+
Don't forget to shutdown your graph service when you are done, e.g.: `ezmsg --address 127.0.0.1:25978 shutdown`
4468

4569
### ezmsg-performance-monitor
4670

71+
**DEPRECATED**
72+
73+
> ezmsg will soon includes a built-in performance monitor that can be used instead of this tool.
74+
4775
This tool operates on logfiles created by ezmsg. Logfiles will automatically be created when running a pipeline containing nodes decorated with `ezmsg.sigproc.util.profile.profile_subpub`,
4876
and if the `EZMSG_LOGLEVEL` environment variable is set to DEBUG. The logfiles will be created in `~/.ezmsg/profile/ezprofiler.log` by default but this can be changed with the `EZMSG_PROFILE` environment variable.
4977

@@ -52,25 +80,11 @@ You can decorate other nodes with `ezmsg.sigproc.util.profile.profile_subpub` to
5280

5381
During a run with profiling enabled, the logfiles will be created in the specified location. You may wish to additionally create a graph file: (`uv run`) `EZMSG_LOGLEVEL=WARN ezmsg mermaid > ~/.ezmsg/profile/ezprofiler.mermaid`
5482

55-
During or after a pipeline run with profiling enabled, you can run (`uv run `) `performance-monitor` to visualize the performance of the nodes in the pipeline.
83+
During or after a pipeline run with profiling enabled, you can run (`uv run `) `ezmsg-performance-monitor` to visualize the performance of the nodes in the pipeline.
5684

5785
> Unlike `signal-monitor`, this tool does not require the pipeline to attach to an existing graph service because it relies exclusively on the logfile.
5886
59-
### ezmsg-signal-monitor
60-
61-
The pipeline must be running on a graph service exposed on the network. For example, first, run the GraphService on an open port:
62-
63-
`ezmsg --address 127.0.0.1:25978 start`
64-
65-
Then run your usual pipeline but make sure it attaches to the graph address by passing `graph_address=("127.0.0.1", 25978)` as a kwarg to `ez.run`.
66-
67-
While the pipeline is running, you can run the signal-monitor tool with (`uv run`) `signal-monitor --graph-addr 127.0.0.1:25978`.
68-
69-
This launches a window with graph visualized on the left. Click on a node's output box to get a live visualization on the right side of the screen plotting the data as it leaves that node. Use `a` to toggle auto-scaling. With auto-scaling off, use `-`, and `=` to zoom out and in, respectively.
70-
71-
> Currently only 2-D outputs are supported!
72-
73-
Don't forget to shutdown your graph service when you are done, e.g.: `ezmsg --address 127.0.0.1:25978 shutdown`
87+
> This performance monitor is soon to be deprecated in favor of monitoring tools built-in to ezmsg.
7488
7589
## Developers
7690

@@ -80,9 +94,9 @@ We use [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for devel
8094
2. Fork ezmsg-tools and clone your fork to your local computer.
8195
3. Open a terminal and `cd` to the cloned folder.
8296
4. Make sure `pygraphviz` [pre-requisites](#pre-requisites) are installed.
83-
* On mac: `export CFLAGS="-I $(brew --prefix graphviz)/include"` and `export LDFLAGS="-L $(brew --prefix graphviz)/lib"`
84-
5. `uv sync --all-extras --python 3.10` to create a .venv and install ezmsg-tools including dev and test dependencies.
85-
6. After editing code and making commits, Run the test suite before making a PR: `uv run pytest`
97+
5. `uv sync --all-extras` to create a .venv and install ezmsg-tools including dev and test dependencies.
98+
6. (Optional) Install pre-commit hooks: `uv run pre-commit install`
99+
7. After editing code and making commits, Run the test suite before making a PR: `uv run pytest`
86100

87101
## Troubleshooting
88102

docs/source/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```{include} ../../README.md
2+
```
3+
4+
## Documentation
5+
6+
```{toctree}
7+
:maxdepth: 2
8+
:caption: Contents:
9+
10+
api/index
11+
```
12+
13+
## Indices and tables
14+
15+
- {ref}`genindex`
16+
- {ref}`modindex`

docs/source/index.rst

Lines changed: 0 additions & 69 deletions
This file was deleted.

pyproject.toml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,29 @@ authors = [
66
]
77
license = "MIT"
88
readme = "README.md"
9-
requires-python = ">=3.10.15"
9+
requires-python = ">=3.11"
1010
dynamic = ["version"]
1111
dependencies = [
12-
"ezmsg>=3.6.1",
12+
"ezmsg>=3.6.2",
1313
"numpy>=1.26.0",
14+
"typer>=0.24.1",
1415
]
1516

1617
[dependency-groups]
1718
dev = [
1819
"pre-commit>=4.0.0",
1920
"scipy>=1.14.1",
20-
"ezmsg-sigproc>=2.0.0",
21+
"ezmsg-sigproc>=2.18.0",
22+
"ezmsg-simbiophys>=1.4.1",
2123
{include-group = "lint"},
2224
{include-group = "test"},
2325
]
2426
lint = [
2527
"ruff>=0.12.9",
2628
]
2729
test = [
28-
"ezmsg-sigproc>=1.6.0",
2930
"pytest>=8.3.3",
31+
"ezmsg-simbiophys>=1.4.1",
3032
]
3133
docs = [
3234
"sphinx>=7.0",
@@ -45,17 +47,20 @@ perfmon = [
4547
"typer>=0.15.1",
4648
"pygtail>=0.14.0",
4749
"dash-bootstrap-components>=1.6.0",
48-
"ezmsg-baseproc",
50+
"ezmsg-baseproc>=1.1.0",
4951
]
5052
sigmon = [
51-
"pygame>=2.6.1",
53+
"PySide6>=6.7",
5254
"pygraphviz>=1.14",
5355
"typer>=0.15.1",
56+
"phosphor>=0.2",
57+
"pandas",
58+
"ezmsg-qt",
5459
]
5560

5661
[project.scripts]
57-
ezmsg-performance-monitor = "ezmsg.tools.perfmon.main:main"
58-
ezmsg-signal-monitor = "ezmsg.tools.sigmon.main:main"
62+
ezmsg-performance-monitor = "ezmsg.tools.perfmon.cli:main"
63+
ezmsg-signal-monitor = "ezmsg.tools.sigmon.cli:main"
5964

6065
[build-system]
6166
requires = ["hatchling", "hatch-vcs"]
@@ -89,4 +94,5 @@ known-third-party = ["ezmsg"]
8994

9095
[tool.uv.sources]
9196
# Uncomment to use development version of ezmsg from git
92-
ezmsg = { git = "https://github.com/ezmsg-org/ezmsg.git", branch = "feature/profiling" }
97+
#ezmsg = { git = "https://github.com/ezmsg-org/ezmsg.git", branch = "dev" }
98+
ezmsg-qt = { git = "https://github.com/ezmsg-org/ezmsg-qt.git", branch = "dynamic_subscriber" }
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"""Test graph for sigmon development.
2+
3+
Generates synthetic EEG (time-domain) and routes a copy through
4+
Window + Spectrum to produce frequency-domain data. Both branches
5+
terminate at a no-op Sink so the topics exist in the graph for
6+
sigmon to subscribe to.
7+
8+
Usage:
9+
uv run python scripts/eeg_generator_graph.py
10+
"""
11+
12+
import ezmsg.core as ez
13+
from ezmsg.sigproc.spectrum import Spectrum, SpectrumSettings
14+
from ezmsg.sigproc.window import Window, WindowSettings
15+
from ezmsg.simbiophys import EEGSynth, EEGSynthSettings
16+
from ezmsg.util.messages.axisarray import AxisArray
17+
18+
19+
class Sink(ez.Unit):
20+
"""Consumes messages and does nothing."""
21+
22+
INPUT_SIGNAL = ez.InputStream(AxisArray)
23+
24+
@ez.subscriber(INPUT_SIGNAL)
25+
async def on_message(self, msg: AxisArray) -> None:
26+
pass
27+
28+
29+
def main() -> None:
30+
eeg = EEGSynth(
31+
EEGSynthSettings(
32+
fs=2000.0,
33+
n_time=100,
34+
n_ch=16,
35+
alpha_freq=10.5,
36+
)
37+
)
38+
39+
win = Window(
40+
WindowSettings(
41+
axis="time",
42+
window_dur=0.5,
43+
window_shift=0.2,
44+
)
45+
)
46+
47+
spec = Spectrum(
48+
SpectrumSettings(
49+
axis="time",
50+
)
51+
)
52+
53+
time_sink = Sink()
54+
freq_sink = Sink()
55+
56+
ez.run(
57+
components={
58+
"EEG": eeg,
59+
"WIN": win,
60+
"SPEC": spec,
61+
"TIME_SINK": time_sink,
62+
"FREQ_SINK": freq_sink,
63+
},
64+
connections=(
65+
(eeg.OUTPUT_SIGNAL, time_sink.INPUT_SIGNAL),
66+
(eeg.OUTPUT_SIGNAL, win.INPUT_SIGNAL),
67+
(win.OUTPUT_SIGNAL, spec.INPUT_SIGNAL),
68+
(spec.OUTPUT_SIGNAL, freq_sink.INPUT_SIGNAL),
69+
),
70+
)
71+
72+
73+
if __name__ == "__main__":
74+
main()

scripts_nbs/profiler/ecog_preproc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from ezmsg.sigproc.downsample import Downsample
88
from ezmsg.sigproc.scaler import AdaptiveStandardScaler
99
from ezmsg.sigproc.slicer import Slicer
10-
from ezmsg.sigproc.synth import EEGSynth
1110
from ezmsg.sigproc.wavelets import CWT, MinPhaseMode
1211
from ezmsg.sigproc.window import Anchor
12+
from ezmsg.simbiophys.eeg import EEGSynth
1313
from ezmsg.util.terminate import TerminateOnTotal
1414

1515

0 commit comments

Comments
 (0)