File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change 7
7
import pylsl
8
8
import neurokit2 as nk
9
9
import sys
10
- import argparse
11
10
12
11
class ECGMonitor (QMainWindow ):
13
- def __init__ (self , invert = False ): # Add the invert parameter
12
+ def __init__ (self ):
14
13
super ().__init__ ()
15
- self .invert = invert
16
14
17
15
self .setWindowTitle ("Real-Time ECG Monitor" ) # Set up GUI window
18
16
self .setGeometry (100 , 100 , 800 , 600 )
@@ -84,10 +82,6 @@ def update_plot(self):
84
82
85
83
filtered_ecg = filtfilt (self .b , self .a , self .ecg_data ) # Filter the signal
86
84
87
- # Invert the signal if the invert flag is set
88
- if self .invert :
89
- filtered_ecg = - filtered_ecg
90
-
91
85
self .ecg_curve .setData (self .time_data , filtered_ecg ) # Use current buffer for plotting
92
86
93
87
# Detect R-peaks and update heart rate
@@ -124,12 +118,7 @@ def plot_r_peaks(self, filtered_ecg):
124
118
self .r_peak_curve .setData (r_peak_times , r_peak_values ) # Plot R-peaks as red dots
125
119
126
120
if __name__ == "__main__" :
127
- parser = argparse .ArgumentParser (description = "Real-Time ECG Monitor" )
128
- parser .add_argument ("--invert" , action = "store_true" , help = "Invert the ECG signal plot" )
129
-
130
- args = parser .parse_args ()
131
-
132
121
app = QApplication (sys .argv )
133
- window = ECGMonitor (invert = args . invert ) # Pass the invert flag
122
+ window = ECGMonitor ()
134
123
window .show ()
135
124
sys .exit (app .exec_ ())
You can’t perform that action at this time.
0 commit comments