Skip to content

Commit a06ab4a

Browse files
committed
remove trailing whitespaces
1 parent a30407a commit a06ab4a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

wfdb/_plotwfdb.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
import matplotlib.pyplot as plt
33

44

5-
def plotwfdb(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
6-
""" Subplot and label each channel of a WFDB signal. Also subplot annotation locations on selected channels if present.
7-
8-
Usage: plotsigs(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
9-
10-
Input arguments:
11-
- sig (required): An nxm numpy array containing the signal to be plotted - first output argument of rdsamp
5+
def plotwfdb(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
6+
""" Subplot and label each channel of a WFDB signal. Also subplot annotation locations on selected channels if present.
7+
8+
Usage: plotsigs(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
9+
10+
Input arguments:
11+
- sig (required): An nxm numpy array containing the signal to be plotted - first output argument of rdsamp
1212
- fields (required): A dictionary of metadata about the record - second output argument of rdsamp
1313
- annsamp (optional): A 1d numpy array of annotation locations to be plotted on top of selected channels - first output argument of readannot.rdann().
14-
- annch (default=[0]): A list of channels on which to plot the annotations.
14+
- annch (default=[0]): A list of channels on which to plot the annotations.
1515
- title (optional): A string containing the title of the graph.
1616
- plottime (default=1) - Flag that specifies whether to plot the x axis as time (1) or samples (0). Defaults to samples if the input fields dictionary does not contain a value for fs.
17-
17+
1818
"""
19-
19+
2020
if len(fields)==3: # Multi-segment variable layout. Get the layout header fields.
2121
fields=fields[1]
22-
elif len(fields)==2: # Multi-segment fixed layout. Get the header fields of the first segment.
22+
elif len(fields)==2: # Multi-segment fixed layout. Get the header fields of the first segment.
2323
fields=fields[1][0]
24-
24+
2525
if (not fields["fs"])|(plottime==0): # x axis is index
2626
plottime=0
2727
t=np.array(range(0,sig.shape[0]))
@@ -31,17 +31,17 @@ def plotwfdb(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
3131
t=np.array(range(0,sig.shape[0]))/fields["fs"]
3232
if annsamp!=[]:
3333
annplott=annsamp/fields["fs"]
34-
34+
3535
f1=plt.figure()
3636
for ch in range(0, sig.shape[1]):
3737
plt.subplot(100*sig.shape[1]+11+ch)
3838
plt.plot(t, sig[:,ch]) # Plot signal channel
3939
if (annsamp!=[]) & (ch in annch): # If there are annotations to plot and the channel is specified
4040
plt.plot(annplott, sig[annsamp, ch], 'r+') # Plot annotations
41-
41+
4242
if (title!=[])&(ch==0):
4343
plt.title(title)
44-
44+
4545
# Axis Labels
4646
if plottime:
4747
plt.xlabel('time/s')
@@ -56,8 +56,8 @@ def plotwfdb(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
5656
else:
5757
unitlabel='NU'
5858
plt.ylabel(chanlabel+"/"+unitlabel)
59-
59+
6060
plt.show(f1)
61-
61+
6262
if __name__ == '__main__':
63-
plotwfdb(sys.argv)
63+
plotwfdb(sys.argv)

0 commit comments

Comments
 (0)