Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 7110331

Browse files
added option to smooth traces using simple boxcar width smoothening
1 parent 72b5457 commit 7110331

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

PythonGUI_apps/Lifetime_analysis/Lifetime_analysis_gui_layout.ui

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,36 @@
12511251
</property>
12521252
</widget>
12531253
</item>
1254+
<item row="6" column="0">
1255+
<widget class="QCheckBox" name="smoothData_checkBox">
1256+
<property name="font">
1257+
<font>
1258+
<pointsize>12</pointsize>
1259+
</font>
1260+
</property>
1261+
<property name="text">
1262+
<string>Smooth Data</string>
1263+
</property>
1264+
</widget>
1265+
</item>
1266+
<item row="6" column="1">
1267+
<widget class="QSpinBox" name="smoothData_spinBox">
1268+
<property name="enabled">
1269+
<bool>false</bool>
1270+
</property>
1271+
<property name="font">
1272+
<font>
1273+
<pointsize>12</pointsize>
1274+
</font>
1275+
</property>
1276+
<property name="minimum">
1277+
<number>1</number>
1278+
</property>
1279+
<property name="maximum">
1280+
<number>1000</number>
1281+
</property>
1282+
</widget>
1283+
</item>
12541284
</layout>
12551285
</widget>
12561286
</item>

PythonGUI_apps/Lifetime_analysis/Lifetime_plot_fit.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def __init__(self):
7777
self.ui.separate_irf_checkBox.stateChanged.connect(self.switch_open_irf)
7878
self.ui.export_data_pushButton.clicked.connect(self.export_data)
7979
self.ui.clear_export_data_pushButton.clicked.connect(self.clear_export_data)
80+
self.ui.smoothData_checkBox.stateChanged.connect(self.smooth_trace_enabled)
8081

8182
#set up plot color button
8283
self.plot_color_button = pg.ColorButton(color=(255,0,0))
@@ -187,6 +188,13 @@ def plot_color_changed(self):
187188
""" Grab new plot_color when color button value is changed """
188189
self.plot_color = self.plot_color_button.color()
189190

191+
def smooth_trace_enabled(self):
192+
"""Enable smooth spin box when smooth data is checked"""
193+
if self.ui.smoothData_checkBox.isChecked():
194+
self.ui.smoothData_spinBox.setEnabled(True)
195+
else:
196+
self.ui.smoothData_spinBox.setEnabled(False)
197+
190198
def acquire_settings(self, mode="data"):
191199
"""
192200
Acquire data or irf from channel specified in spinbox.
@@ -215,6 +223,9 @@ def acquire_settings(self, mode="data"):
215223

216224
length = np.shape(y)[0]
217225
x = np.arange(0, length, 1) * self.resolution
226+
227+
if self.ui.smoothData_checkBox.isChecked() and mode=="data":
228+
y = np.convolve(y, np.ones(self.ui.smoothData_spinBox.value())/self.ui.smoothData_spinBox.value(), mode="same")
218229
return x,y
219230

220231
except Exception as e:

0 commit comments

Comments
 (0)