Skip to content

Instantly share code, notes, and snippets.

@flinhong
Created March 9, 2022 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flinhong/903909f6d7acb50b3526edbe6c48047a to your computer and use it in GitHub Desktop.
Save flinhong/903909f6d7acb50b3526edbe6c48047a to your computer and use it in GitHub Desktop.
QY Calculation
"""
# date: Wed Mar 9 HKT 2022
# naming conventions: 'La.dat', 'Lb.dat', 'Lc.dat', 'Pb.dat', 'Pc.dat'
# package requirement: numpy, scipy, matplotlib
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
files = ['La.dat', 'Lb.dat', 'Lc.dat', 'Pb.dat', 'Pc.dat']
int_array = [0, 0, 0, 0, 0]
i = 0
for file in files:
data = np.loadtxt(file, delimiter='\t', skiprows=1)
xData, yData = np.hsplit(data, 2)
y = yData.reshape((1, len(yData)))
int_y = integrate.simps(y)
int_array[i] = int_y[0]
print(file.replace('.dat', '') + ' => ' + str(int_array[i]))
i += 1
plt.plot(xData, yData)
# https://doi.org/10.1002/adma.19970090308
A = 1 - (int_array[2]/int_array[1])
QY = (int_array[4]-(1-A)*int_array[3]) / (int_array[0] * A)
print('\nA = 1 - (Lc/Lb)')
print('QY = [Pc - (1-A)*Pb] / [La * A]')
print(' = ' + str(QY * 100) + ' %')
plt.xlabel('Wavelength / nm')
plt.ylabel('PL counts / a.u.')
plt.yscale('log')
plt.legend(files)
plt.title('PLQY: ' + str(QY * 100) + ' %', {'color': 'red', 'fontsize': '18'})
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment