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

Commit 4532fa1

Browse files
calculate both conditions, srv1=srv2 and srv1=0, while doing srv calculations
1 parent 5bf7e64 commit 4532fa1

2 files changed

Lines changed: 77 additions & 42 deletions

File tree

PythonGUI_apps/Lifetime_analysis/Lifetime_analysis_gui_layout.ui

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>1490</width>
10-
<height>1201</height>
10+
<height>1583</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -925,79 +925,112 @@
925925
</property>
926926
</widget>
927927
</item>
928+
<item row="0" column="1">
929+
<widget class="QDoubleSpinBox" name="average_lifetime_spinBox">
930+
<property name="decimals">
931+
<number>4</number>
932+
</property>
933+
<property name="maximum">
934+
<double>9999999.000000000000000</double>
935+
</property>
936+
</widget>
937+
</item>
938+
<item row="7" column="1">
939+
<widget class="QLabel" name="srv1_srv2_equal_label">
940+
<property name="text">
941+
<string>0</string>
942+
</property>
943+
</widget>
944+
</item>
928945
<item row="5" column="1">
929946
<widget class="QLabel" name="surface_lifetime_label">
930947
<property name="text">
931948
<string>0</string>
932949
</property>
933950
</widget>
934951
</item>
935-
<item row="6" column="0">
952+
<item row="7" column="0">
936953
<widget class="QLabel" name="label_42">
937954
<property name="text">
938955
<string>SRV (cm/s)</string>
939956
</property>
940957
</widget>
941958
</item>
959+
<item row="1" column="1">
960+
<widget class="QDoubleSpinBox" name="bulk_lifetime_spinBox">
961+
<property name="maximum">
962+
<double>100000.000000000000000</double>
963+
</property>
964+
<property name="value">
965+
<double>8000.000000000000000</double>
966+
</property>
967+
</widget>
968+
</item>
942969
<item row="3" column="0">
943970
<widget class="QLabel" name="label_39">
944971
<property name="text">
945972
<string>Diffusion Coefficient (cm2/s)</string>
946973
</property>
947974
</widget>
948975
</item>
949-
<item row="4" column="0">
950-
<widget class="QCheckBox" name="srv1_srv2_checkBox">
976+
<item row="5" column="0">
977+
<widget class="QLabel" name="label_40">
951978
<property name="text">
952-
<string>SRV1 = SRV2</string>
979+
<string>Surface Lifetime (ns)</string>
953980
</property>
954981
</widget>
955982
</item>
956-
<item row="7" column="0">
957-
<widget class="QPushButton" name="calculate_srv_pushButton">
983+
<item row="0" column="0">
984+
<widget class="QLabel" name="label_45">
958985
<property name="text">
959-
<string>Calculate</string>
986+
<string>Average Lifetime (ns)</string>
960987
</property>
961988
</widget>
962989
</item>
963-
<item row="1" column="1">
964-
<widget class="QDoubleSpinBox" name="bulk_lifetime_spinBox">
965-
<property name="maximum">
966-
<double>100000.000000000000000</double>
967-
</property>
968-
<property name="value">
969-
<double>8000.000000000000000</double>
990+
<item row="10" column="0">
991+
<widget class="QPushButton" name="calculate_srv_pushButton">
992+
<property name="text">
993+
<string>Calculate</string>
970994
</property>
971995
</widget>
972996
</item>
973-
<item row="5" column="0">
974-
<widget class="QLabel" name="label_40">
997+
<item row="9" column="0">
998+
<widget class="QLabel" name="label_46">
975999
<property name="text">
976-
<string>Surface Lifetime (ns)</string>
1000+
<string>SRV (cm/s)</string>
9771001
</property>
9781002
</widget>
9791003
</item>
980-
<item row="6" column="1">
981-
<widget class="QLabel" name="srv_label">
1004+
<item row="9" column="1">
1005+
<widget class="QLabel" name="srv1_zero_label">
9821006
<property name="text">
9831007
<string>0</string>
9841008
</property>
9851009
</widget>
9861010
</item>
987-
<item row="0" column="0">
988-
<widget class="QLabel" name="label_45">
1011+
<item row="6" column="0">
1012+
<widget class="QLabel" name="label_48">
1013+
<property name="font">
1014+
<font>
1015+
<weight>75</weight>
1016+
<bold>true</bold>
1017+
</font>
1018+
</property>
9891019
<property name="text">
990-
<string>Average Lifetime (ns)</string>
1020+
<string>SRV1 = SRV2</string>
9911021
</property>
9921022
</widget>
9931023
</item>
994-
<item row="0" column="1">
995-
<widget class="QDoubleSpinBox" name="average_lifetime_spinBox">
996-
<property name="decimals">
997-
<number>4</number>
1024+
<item row="8" column="0">
1025+
<widget class="QLabel" name="label_49">
1026+
<property name="font">
1027+
<font>
1028+
<weight>75</weight>
1029+
<bold>true</bold>
1030+
</font>
9981031
</property>
999-
<property name="maximum">
1000-
<double>9999999.000000000000000</double>
1032+
<property name="text">
1033+
<string>SRV1 = 0</string>
10011034
</property>
10021035
</widget>
10031036
</item>
@@ -1292,7 +1325,7 @@
12921325
<x>0</x>
12931326
<y>0</y>
12941327
<width>1490</width>
1295-
<height>21</height>
1328+
<height>38</height>
12961329
</rect>
12971330
</property>
12981331
<widget class="QMenu" name="menuFile">

PythonGUI_apps/Lifetime_analysis/Lifetime_plot_fit.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,11 @@ def calculate_srv (self):
476476
self.thickness = self.ui.thickness_spinBox.value()*1e-7 # convert to cm
477477
self.diffusion_coeffecient = self.ui.diffusion_coefficient_spinBox.value() # in cm2/s
478478

479-
if self.ui.srv1_srv2_checkBox.isChecked():
480-
self.srv = self.thickness / (2*((1e-9*self.surface_lifetime) - ((1/self.diffusion_coeffecient)*((self.thickness/np.pi)**2)) ))
481-
else:
482-
self.srv = self.thickness / ((1e-9*self.surface_lifetime) - ((4/self.diffusion_coeffecient)*((self.thickness/np.pi)**2)) )
479+
self.srv1_srv2_equal = self.thickness / (2*((1e-9*self.surface_lifetime) - ((1/self.diffusion_coeffecient)*((self.thickness/np.pi)**2)) ))
480+
self.srv1_zero = self.thickness / ((1e-9*self.surface_lifetime) - ((4/self.diffusion_coeffecient)*((self.thickness/np.pi)**2)) )
483481

484-
self.ui.srv_label.setText(str(self.srv))
482+
self.ui.srv1_srv2_equal_label.setText(str(self.srv1_srv2_equal))
483+
self.ui.srv1_zero_label.setText(str(self.srv1_zero))
485484

486485
def get_srv_string(self):
487486
""" Get info from SRV Calculation groupbox as string """
@@ -490,12 +489,13 @@ def get_srv_string(self):
490489
+ "\nBulk Lifetime (ns): " + str(self.ui.bulk_lifetime_spinBox.value()) \
491490
+ "\nThickness (nm): " + str(self.ui.thickness_spinBox.value()) \
492491
+ "\nDiffusion Coefficient (cm2/s): " + str(self.ui.diffusion_coefficient_spinBox.value())
493-
if self.ui.srv1_srv2_checkBox.isChecked():
494-
srv_string += "\nSRV1 = SRV2"
495-
else:
496-
srv_string += "\nSRV1 = 0"
497-
srv_string += "\nSurface Lifetime (ns): " + self.ui.surface_lifetime_label.text() \
498-
+ "\nSRV (cm/s): " + self.ui.srv_label.text()
492+
srv_string += "\nSurface Lifetime (ns): " + self.ui.surface_lifetime_label.text()
493+
494+
srv_string += "\nSRV1 = SRV2"\
495+
+ "\nSRV (cm/s): " + self.ui.srv1_srv2_equal_label.text()
496+
497+
srv_string += "\nSRV1 = 0"\
498+
+ "\nSRV (cm/s): " + self.ui.srv1_zero_label.text()
499499
return srv_string
500500

501501
def export_data(self):
@@ -530,8 +530,10 @@ def pub_ready_plot_export(self):
530530
plt.figure(figsize=(8,6))
531531
plt.tick_params(direction='out', length=8, width=3.5)
532532
if self.ui.save_w_fit_checkBox.isChecked():
533+
print("inside if")
533534
plt.plot(self.out[:,0],self.out[:,1]/np.max(self.out[:,1]),self.exportplotwindow.ui.traceColor_comboBox.currentText())
534535
plt.plot(self.out[:,0],self.out[:,2]/np.max(self.out[:,1]),self.exportplotwindow.ui.fitColor_comboBox.currentText())
536+
print("finished plotting")
535537
if self.exportplotwindow.ui.legend_checkBox.isChecked():
536538
plt.legend([self.exportplotwindow.ui.legend1_lineEdit.text(),self.exportplotwindow.ui.legend2_lineEdit.text()])
537539
else:
@@ -544,7 +546,7 @@ def pub_ready_plot_export(self):
544546
plt.ylabel("Intensity (norm.)", fontsize=20, fontweight='bold')
545547
plt.tight_layout()
546548
plt.xlim([self.exportplotwindow.ui.lowerX_spinBox.value(),self.exportplotwindow.ui.upperX_spinBox.value()])
547-
plt.ylim([10**(self.exportplotwindow.ui.lowerY_spinBox.value()),self.exportplotwindow.ui.upperY_doubleSpinBox.value()])
549+
plt.ylim([self.exportplotwindow.ui.lowerY_spinBox.value(),self.exportplotwindow.ui.upperY_doubleSpinBox.value()])
548550

549551
plt.savefig(filename[0],bbox_inches='tight', dpi=300)
550552
plt.close()

0 commit comments

Comments
 (0)