Skip to content

Commit a15e9b0

Browse files
author
dpscience
committed
initial commit
initial commit
1 parent 61e0ba7 commit a15e9b0

9 files changed

Lines changed: 30405 additions & 10236 deletions

DReconvolutionInput.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,30 @@
3333

3434
from DReconvolutionModel import ReconvolutionModel as reconvModel
3535

36-
#channel resolution [ps] -> x:
37-
__channelResInPicoseconds = 5.0
38-
3936
#expected number of components (number of exponential decay functions - LIMITED to MAX: 4):
4037
__numberOfExpDec = 2
4138

39+
#channel/bin resolution [ps]
40+
__channelResolutionInPs = 5.0
41+
42+
#expected lifetimes (tau) -> start values (levenberg marquardt fit)
43+
__expectedTau_1_in_ps = 160.0;
44+
__expectedTau_2_in_ps = 455.0;
45+
__expectedTau_3_in_ps = 160.0;
46+
__expectedTau_4_in_ps = 160.0;
47+
48+
#background calculation (right side of spectrum data):
49+
__bkgrd_startIndex = 8000;
50+
__bkgrd_count = 1500;
4251

4352
#NOTE: Spectrum and IRF data vectors require equal length!!!
4453

4554
#file path which contains the SPECTRUM data:
46-
__filePathSpec = r"C:\Users\danny\Desktop\Elsevier - Data in Brief\reconvolution\test3\AB_1_5Mio.dat"
55+
__filePathSpec = 'testData/spectrum_5ps.dat'
4756
__specDataDelimiter = '\t'
4857

4958
#file path which contains the IRF data:
50-
__filePathIRF = r"C:\Users\danny\Desktop\Elsevier - Data in Brief\reconvolution\test3\irf_AB.dat"
59+
__filePathIRF = 'testData/irf_5ps.dat'
5160
__irfDataDelimiter = '\t'
5261

5362

@@ -64,4 +73,4 @@
6473
#Pseudovoigt1 = 3
6574
#Pearson7 = 4
6675
#------------------
67-
__modelType = reconvModel.Pearson7
76+
__modelType = reconvModel.Gaussian

DReconvolutionModel.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -68,82 +68,3 @@ def Pearson7(x, ampl, alpha, m, y0, x0, args=()):
6868
return ampl*h+y0
6969

7070

71-
def convolveData(a, b):
72-
return np.real(np.fft.ifft(np.fft.fft(a)*np.fft.fft(b)))
73-
74-
#1 component expontential distribution:
75-
def ExpDecay_1(x, ampl1, tau1, y0, x0, args=()):
76-
h = np.zeros(x.size)
77-
lengthVec = len(args)
78-
79-
shift_1 = np.remainder(np.remainder(x-np.floor(x0)-1, lengthVec) + lengthVec, lengthVec)
80-
shift_Incr1 = (1 - x0 + np.floor(x0))*args[shift_1.astype(int)]
81-
82-
shift_2 = np.remainder(np.remainder(x-np.ceil(x0)-1, lengthVec) + lengthVec, lengthVec)
83-
shift_Incr2 = (x0 - np.floor(x0))*args[shift_2.astype(int)]
84-
85-
irf_shifted = (shift_Incr1 + shift_Incr2)
86-
irf_norm = irf_shifted/sum(irf_shifted)
87-
88-
h = ampl1*np.exp(-(x)/tau1)
89-
hConvIrf_norm = convolveData(h, irf_norm) + y0
90-
return hConvIrf_norm
91-
92-
#2 component expontential distribution:
93-
def ExpDecay_2(x, ampl1, tau1, ampl2, tau2, y0, x0, args=()):
94-
h = np.zeros(x.size)
95-
lengthVec = len(x)
96-
97-
shift_1 = np.remainder(np.remainder(x-np.floor(x0)-1, lengthVec) + lengthVec, lengthVec)
98-
shift_Incr1 = (1 - x0 + np.floor(x0))*args[shift_1.astype(int)]
99-
100-
shift_2 = np.remainder(np.remainder(x-np.ceil(x0)-1, lengthVec) + lengthVec, lengthVec)
101-
shift_Incr2 = (x0 - np.floor(x0))*args[shift_2.astype(int)]
102-
103-
irf_shifted = (shift_Incr1 + shift_Incr2)
104-
irf_norm = irf_shifted/sum(irf_shifted)
105-
106-
h = ampl1*np.exp(-(x)/tau1) + ampl2*np.exp(-(x)/tau2)
107-
hConvIrf_norm = convolveData(h, irf_norm) + y0
108-
return hConvIrf_norm
109-
110-
#3 component expontential distribution:
111-
def ExpDecay_3(x, ampl1, tau1, ampl2, tau2, ampl3, tau3, y0, x0, args=()):
112-
h = np.zeros(x.size)
113-
lengthVec = len(args)
114-
115-
shift_1 = np.remainder(np.remainder(x-np.floor(x0)-1, lengthVec) + lengthVec, lengthVec)
116-
shift_Incr1 = (1 - x0 + np.floor(x0))*args[shift_1.astype(int)]
117-
118-
shift_2 = np.remainder(np.remainder(x-np.ceil(x0)-1, lengthVec) + lengthVec, lengthVec)
119-
shift_Incr2 = (x0 - np.floor(x0))*args[shift_2.astype(int)]
120-
121-
irf_shifted = (shift_Incr1 + shift_Incr2)
122-
irf_norm = irf_shifted/sum(irf_shifted)
123-
124-
h = ampl1*np.exp(-(x)/tau1) + ampl2*np.exp(-(x)/tau2) + ampl3*np.exp(-(x)/tau3)
125-
hConvIrf_norm = convolveData(h, irf_norm) + y0
126-
return hConvIrf_norm
127-
128-
#4 component expontential distribution:
129-
def ExpDecay_4(x, ampl1, tau1, ampl2, tau2, ampl3, tau3, ampl4, tau4, y0, x0, args=()):
130-
h = np.zeros(x.size)
131-
lengthVec = len(args)
132-
133-
shift_1 = np.remainder(np.remainder(x-np.floor(x0)-1, lengthVec) + lengthVec, lengthVec)
134-
shift_Incr1 = (1 - x0 + np.floor(x0))*args[shift_1.astype(int)]
135-
136-
shift_2 = np.remainder(np.remainder(x-np.ceil(x0)-1, lengthVec) + lengthVec, lengthVec)
137-
shift_Incr2 = (x0 - np.floor(x0))*args[shift_2.astype(int)]
138-
139-
irf_shifted = (shift_Incr1 + shift_Incr2)
140-
irf_norm = irf_shifted/sum(irf_shifted)
141-
142-
h = ampl1*np.exp(-(x)/tau1) + ampl2*np.exp(-(x)/tau2) + ampl3*np.exp(-(x)/tau3) + ampl4*np.exp(-(x)/tau4)
143-
hConvIrf_norm = convolveData(h, irf_norm) + y0
144-
return hConvIrf_norm
145-
146-
147-
148-
149-

0 commit comments

Comments
 (0)