Skip to content

Commit 01fd7d3

Browse files
committed
Plotting: when trying to plot empty monitors, give a useful message.
Better than showing an empty picture without context, or letting the error go through (as in the previous revision of the code).
1 parent da3c31b commit 01fd7d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dss/plot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,14 @@ def dss_monitor_plot(DSS: IDSS, params):
228228
monitor = DSS.ActiveCircuit.Monitors
229229
monitor.Name = params['ObjectName']
230230
data = monitor.AsMatrix()
231+
if data is None or len(data) == 0:
232+
raise ValueError("There is not data to plot in the monitor. Hint: check the solution mode, solve the circuit and retry.")
233+
231234
channels = params['Channels']
232235
num_ch = monitor.NumChannels
233236
channels = [ch for ch in channels if ch >= 1 and ch <= num_ch]
234237
if len(channels) == 0:
235-
raise IndexError(f"No valid channel numbers were specified.")
238+
raise IndexError("No valid channel numbers were specified.")
236239

237240
bases = params['Bases']
238241
header = monitor.Header

0 commit comments

Comments
 (0)