Skip to content

Commit 93ae6e8

Browse files
committed
Resolve the issue of x-axis variation in R3 & R4
1 parent bde6b17 commit 93ae6e8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

applications/heartbeat_ecg.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ def __init__(self):
3434
central_widget.setLayout(layout)
3535
self.setCentralWidget(central_widget)
3636

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-
4337
# Set up LSL stream inlet
4438
print("Looking for an ECG stream...")
4539
streams = pylsl.resolve_stream('name', 'BioAmpDataStream')
@@ -55,6 +49,13 @@ def __init__(self):
5549
sys.exit(0)
5650
print(f"Sampling rate: {self.sampling_rate} Hz")
5751

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+
5859
# Timer for updating the GUI
5960
self.timer = pg.QtCore.QTimer()
6061
self.timer.timeout.connect(self.update_plot)
@@ -65,7 +66,7 @@ def __init__(self):
6566

6667
# Plot configuration
6768
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
6970

7071
# Set y-axis limits based on sampling rate
7172
if self.sampling_rate == 250:

0 commit comments

Comments
 (0)