Skip to content

Commit 5fb38c1

Browse files
author
Benjamin Moody
committed
plot_wfdb: if plotting digital values, show units as "adu".
If we are plotting digital (d_signal) values, then the values on the Y axis are ADC units, not physical units. Don't label the axes as physical units, and don't try to calculate grid lines as if ADC units were physical units.
1 parent 6a7b47b commit 5fb38c1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

wfdb/plot/plot.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,14 +857,19 @@ def get_wfdb_plot_items(record, annotation, plot_sym):
857857
if record:
858858
if record.p_signal is not None:
859859
signal = record.p_signal
860+
physical = True
860861
elif record.d_signal is not None:
861862
signal = record.d_signal
863+
physical = False
862864
else:
863865
raise ValueError('The record has no signal to plot')
864866

865867
fs = record.fs
866868
sig_name = [str(s) for s in record.sig_name]
867-
sig_units = [str(s) for s in record.units]
869+
if physical:
870+
sig_units = [str(s) for s in record.units]
871+
else:
872+
sig_units = ['adu'] * n_sig
868873
record_name = 'Record: %s' % record.record_name
869874
ylabel = ['/'.join(pair) for pair in zip(sig_name, sig_units)]
870875
else:

0 commit comments

Comments
 (0)