@@ -34,12 +34,6 @@ def __init__(self):
34
34
central_widget .setLayout (layout )
35
35
self .setCentralWidget (central_widget )
36
36
37
- # Data and buffers
38
- self .ecg_data = deque (maxlen = 2500 ) # 10 seconds of data at 250 Hz
39
- self .time_data = deque (maxlen = 2500 )
40
- self .r_peaks = []
41
- self .heart_rate = None
42
-
43
37
# Set up LSL stream inlet
44
38
print ("Looking for an ECG stream..." )
45
39
streams = pylsl .resolve_stream ('name' , 'BioAmpDataStream' )
@@ -55,6 +49,13 @@ def __init__(self):
55
49
sys .exit (0 )
56
50
print (f"Sampling rate: { self .sampling_rate } Hz" )
57
51
52
+ self .sampling_rate = int (self .sampling_rate ) #Conversion into int
53
+ # Data and buffers
54
+ self .ecg_data = deque (maxlen = self .sampling_rate * 10 ) # 10 seconds of data at 250/500 Hz
55
+ self .time_data = deque (maxlen = self .sampling_rate * 10 ) #Sampling rate - 250/500
56
+ self .r_peaks = []
57
+ self .heart_rate = None
58
+
58
59
# Timer for updating the GUI
59
60
self .timer = pg .QtCore .QTimer ()
60
61
self .timer .timeout .connect (self .update_plot )
@@ -65,7 +66,7 @@ def __init__(self):
65
66
66
67
# Plot configuration
67
68
self .plot_window = 10 # Plot window of 10 seconds
68
- self .buffer_size = self .plot_window * self .sampling_rate # 10 seconds at 250 Hz sampling rate
69
+ self .buffer_size = self .plot_window * self .sampling_rate # 10 seconds at 250/500 Hz sampling rate
69
70
70
71
# Set y-axis limits based on sampling rate
71
72
if self .sampling_rate == 250 :
0 commit comments