Skip to content

Commit 7f19fe8

Browse files
committed
performance and UI enhancements
1 parent 7c26de1 commit 7f19fe8

11 files changed

+38
-21
lines changed

configs/exp_config_EDA.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["EDA"],
77
"channel_types": ["eda"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": false,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_EDA_Resp_PPG.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["EDA", "Resp", "PPG Ear"],
77
"channel_types": ["eda", "resp", "ppg"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": true,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_EDA_Resp_PPG1_PPG2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["EDA", "Resp", "PPG Finger", "PPG Ear"],
77
"channel_types": ["eda", "resp", "ppg", "ppg"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": true,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_PPG.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["PPG Finger"],
77
"channel_types": ["ppg"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": true,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_PPG1_PPG2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["PPG Finger", "PPG Ear"],
77
"channel_types": ["ppg", "ppg"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": true,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_Resp.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["Resp"],
77
"channel_types": ["resp"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": false,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_Resp_PPG.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["Resp", "PPG Ear"],
77
"channel_types": ["resp", "ppg"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": true,
910
"max_time_seconds": [180, 180],
1011
"datapath": "data",
1112
"event_codes": {

configs/exp_config_phys.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"channels": ["EDA", "Resp", "PPG Finger", "PPG Ear"],
77
"channel_types": ["eda", "resp", "ppg", "ppg"],
88
"timed_acquisition": true,
9+
"assess_signal_quality": true,
910
"max_time_seconds": [180, 180, 180, 180],
1011
"datapath": "data",
1112
"event_codes":{

src/PhysioKit2/form.ui

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,18 @@ Conditions</string>
638638
<verstretch>0</verstretch>
639639
</sizepolicy>
640640
</property>
641+
<property name="maximumSize">
642+
<size>
643+
<width>16777215</width>
644+
<height>40</height>
645+
</size>
646+
</property>
641647
<property name="text">
642648
<string/>
643649
</property>
650+
<property name="scaledContents">
651+
<bool>true</bool>
652+
</property>
644653
</widget>
645654
</item>
646655
</layout>

src/PhysioKit2/form_ui.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ def setupUi(self, PPG):
312312
self.label_sq_legend.setObjectName(u"label_sq_legend")
313313
sizePolicy4.setHeightForWidth(self.label_sq_legend.sizePolicy().hasHeightForWidth())
314314
self.label_sq_legend.setSizePolicy(sizePolicy4)
315+
self.label_sq_legend.setMaximumSize(QSize(16777215, 40))
316+
self.label_sq_legend.setScaledContents(True)
315317

316318
self.gridLayout.addWidget(self.label_sq_legend, 1, 0, 1, 1)
317319

src/PhysioKit2/main.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from copy import deepcopy
1919

2020
from PySide6.QtWidgets import QApplication, QWidget, QGraphicsScene, QFileDialog
21-
from PySide6.QtCore import QFile, QObject, Signal, QThread
21+
from PySide6.QtCore import QFile, QObject, Signal, QThread, Qt
2222
from PySide6.QtUiTools import QUiLoader
2323
from PySide6.QtGui import QPixmap, QImage
2424

@@ -53,7 +53,7 @@ def load_ui(self, args_parser):
5353
ui_file = QFile(path)
5454
ui_file.open(QFile.ReadOnly)
5555
self.ui = loader.load(ui_file, self)
56-
56+
self.ui.graphicsView.viewport().setAttribute(Qt.WidgetAttribute.WA_AcceptTouchEvents, False)
5757

5858
pixmap = QPixmap(files('PhysioKit2.images').joinpath('banner.png'))
5959
self.ui.label.setPixmap(pixmap)
@@ -69,13 +69,6 @@ def load_ui(self, args_parser):
6969
self.ext_sync_flag = False
7070
self.ui.baudrate = 115200
7171

72-
self.resp_lowcut = 0.1
73-
self.resp_highcut = 0.5
74-
self.ppg_lowcut = 0.5
75-
self.ppg_highcut = 5.0
76-
self.filt_order = 1
77-
self.eda_moving_average_window_size = int(config.SAMPLING_RATE/4.0)
78-
7972
self.ui.spObj = serialPort()
8073
self.ui.ser_port_names = []
8174
self.ui.ser_ports_desc = []
@@ -341,17 +334,6 @@ def load_exp_params(self):
341334
self.csv_header = self.ui.channels + ["event_code"]
342335
self.writer.writerow(self.csv_header)
343336

344-
self.filt_objs = {}
345-
self.eda_moving_average_window_size = int(config.SAMPLING_RATE/4.0)
346-
347-
for nCh in range(config.NCHANNELS):
348-
if self.ui.channel_types[nCh] == 'eda':
349-
self.filt_objs[str(nCh)] = lFilter_moving_average(window_size=self.eda_moving_average_window_size)
350-
elif self.ui.channel_types[nCh] == 'resp':
351-
self.filt_objs[str(nCh)] = lFilter(self.resp_lowcut, self.resp_highcut, config.SAMPLING_RATE, order=self.filt_order)
352-
elif self.ui.channel_types[nCh] == 'ppg':
353-
self.filt_objs[str(nCh)] = lFilter(self.ppg_lowcut, self.ppg_highcut, config.SAMPLING_RATE, order=self.filt_order)
354-
355337
# # Place the matplotlib figure
356338
gv_rect = self.ui.graphicsView.viewport().rect()
357339
gv_width = gv_rect.width()
@@ -362,7 +344,7 @@ def load_exp_params(self):
362344
ch_colors = self.ui.channel_plot_colors,
363345
sq_flag = self.ui.params_dict["exp"]["assess_signal_quality"],
364346
width = gv_width, height = gv_height)
365-
self.myAnim = PlotAnimation(config=config, figCanvas=self.figCanvas)
347+
self.myAnim = PlotAnimation(figCanvas=self.figCanvas)
366348
self.graphic_scene = QGraphicsScene()
367349
self.graphic_scene.addWidget(self.figCanvas)
368350
self.ui.graphicsView.setScene(self.graphic_scene)
@@ -649,6 +631,22 @@ def __init__(self, uiObj, parent):
649631

650632
self.ui = uiObj
651633
self.stop_flag = False
634+
self.filt_objs = {}
635+
self.eda_moving_average_window_size = int(config.SAMPLING_RATE/4.0)
636+
637+
self.resp_lowcut = 0.1
638+
self.resp_highcut = 0.5
639+
self.ppg_lowcut = 0.5
640+
self.ppg_highcut = 5.0
641+
self.filt_order = 1
642+
643+
for nCh in range(config.NCHANNELS):
644+
if self.ui.channel_types[nCh] == 'eda':
645+
self.filt_objs[str(nCh)] = lFilter_moving_average(window_size=self.eda_moving_average_window_size)
646+
elif self.ui.channel_types[nCh] == 'resp':
647+
self.filt_objs[str(nCh)] = lFilter(self.resp_lowcut, self.resp_highcut, config.SAMPLING_RATE, order=self.filt_order)
648+
elif self.ui.channel_types[nCh] == 'ppg':
649+
self.filt_objs[str(nCh)] = lFilter(self.ppg_lowcut, self.ppg_highcut, config.SAMPLING_RATE, order=self.filt_order)
652650

653651

654652
def stop(self):

0 commit comments

Comments
 (0)