Skip to content

Commit 9a2d3e8

Browse files
committed
if input does not have time axis but it does have ch axis and ch locations, use scatter widget by default
1 parent 39aebc0 commit 9a2d3e8

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ sigmon = [
5757
"pandas",
5858
"ezmsg-qt",
5959
]
60+
viewer = [
61+
"PySide6>=6.7",
62+
"typer>=0.15.1",
63+
"phosphor>=0.4",
64+
"ezmsg-qt",
65+
]
6066

6167
[project.scripts]
6268
ezmsg-performance-monitor = "ezmsg.tools.perfmon.cli:main"

src/ezmsg/tools/sigmon/cli.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def __init__(
9898
shortcut.activated.connect(self._toggle_scatter)
9999

100100
def _on_node_selected(self, topic: str) -> None:
101+
# logger.debug("Switching to topic: %s", topic)
102+
print(f"Switching to topic: {topic}")
101103
self._data_sub.set_topic(topic)
102104
self._first_message = True
103105
self._channel_labels = None
@@ -147,6 +149,13 @@ def _create_plot_widget(self, msg) -> None:
147149
)
148150
widget = SpectrumWidget(config)
149151

152+
elif "ch" in msg.dims and self._channel_positions is not None:
153+
# ch but no time or freq; assume scatter
154+
config = ScatterConfig(
155+
positions=self._channel_positions,
156+
channel_labels=labels,
157+
)
158+
widget = ScatterWidget(config)
150159
else:
151160
logger.warning("Unknown AxisArray dims: %s — defaulting to sweep", msg.dims)
152161
n_samples = msg.shape[0]
@@ -159,7 +168,7 @@ def _create_plot_widget(self, msg) -> None:
159168
widget = SweepWidget(config)
160169

161170
self._primary_config = config
162-
self._showing_scatter = False
171+
self._showing_scatter = isinstance(widget, ScatterWidget)
163172
self._replace_plot_widget(widget)
164173

165174
def _toggle_scatter(self) -> None:
@@ -191,6 +200,10 @@ def _replace_plot_widget(self, widget: QWidget) -> None:
191200
sizes = self._splitter.sizes()
192201
old = self._splitter.widget(1)
193202
if old is not None:
203+
# Stop the render loop before destroying the Qt widget,
204+
# otherwise fastplotlib keeps painting a deleted canvas.
205+
if hasattr(old, "_figure"):
206+
old._figure.close()
194207
old.setParent(None)
195208
old.deleteLater()
196209
self._splitter.insertWidget(1, widget)

0 commit comments

Comments
 (0)