Skip to content

Commit 33960a8

Browse files
author
dpscience
committed
update: some new features...
- error in intensity calculation fixed - new: channel-binning, input-file row skipping, background fixing, ...
1 parent 83007ba commit 33960a8

4 files changed

Lines changed: 146 additions & 72 deletions

File tree

DReconvolutionInput.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,54 +34,64 @@
3434
from DReconvolutionModel import ReconvolutionModel as reconvModel
3535

3636
#save output as *.txt file after success?
37-
__saveReconvolutionSpectrum = True
37+
__saveReconvolutionSpectrum = False
3838
__saveReconvolutionSpectrumPath = 'testData/recovolutionSpectrumOutput.txt'
3939
__saveReconvolutionSpectrumResidualPath = 'testData/recovolutionSpectrumResidualsOutput.txt'
4040

41-
#!note: IRF output is only saved if a model function is used --> __bUsingModel = True
42-
__saveReconvolutionIRF = True
41+
#!note: IRF output is only saved if the model function is used, meaning--> (__bUsingModel = True)
42+
__saveReconvolutionIRF = False
4343
__saveReconvolutionIRFPath = 'testData/recovolutionIRFOutput.txt'
4444
__saveReconvolutionIRFResidualPath = 'testData/recovolutionIRFResidualsOutput.txt'
4545

46-
#expected number of components (number of exponential decay functions - LIMITED to MAX: 4):
47-
__numberOfExpDec = 2
4846

4947
#channel/bin resolution [ps]
5048
__channelResolutionInPs = 5.0
5149

52-
#expected lifetimes (tau) -> start values in [ps] (required for the levenberg marquardt fit)
50+
#binning factor:
51+
__binningFactor = 1;
52+
53+
#expected number of components (number of exponential decay functions - LIMITED to MAX: 4):
54+
__numberOfExpDec = 2
55+
56+
#expected lifetimes (tau) -> start values in [ps] (required for the levenberg marquardt fit using lmfit library)
5357
#note: only the first '__numberOfExpDec' related values are considered (e.g.: for __numberOfExpDec = 2 --> __expectedTau_1_in_ps AND __expectedTau_2_in_ps)
54-
__expectedTau_1_in_ps = 260.0;
55-
__expectedTau_2_in_ps = 1500.0;
56-
__expectedTau_3_in_ps = 160.0;
58+
__expectedTau_1_in_ps = 240.0;
59+
__expectedTau_2_in_ps = 1200.0;
60+
__expectedTau_3_in_ps = 2800.0;
5761
__expectedTau_4_in_ps = 160.0;
5862

59-
#background calculation (right side of spectrum data):
63+
#background estimation (right side of spectrum data):
6064
__bkgrd_startIndex = 8000;
61-
__bkgrd_count = 1500;
65+
__bkgrd_count = 999;
66+
67+
#fixed background? (value of estimated background is used)
68+
__bkgrdFixed = False;
69+
6270

6371
#NOTE: Spectrum and IRF data vectors require equal length!!!
6472

6573
#file path which contains the SPECTRUM data:
66-
__filePathSpec = 'testData/spectrum2_5ps.dat'
74+
__filePathSpec = 'testData/spectrum_5ps.dat'
6775
__specDataDelimiter = '\t'
6876

6977
#file path which contains the IRF data:
70-
__filePathIRF = 'testData/irf2_5ps.dat'
78+
__filePathIRF = 'testData/irf_5ps.dat'
7179
__irfDataDelimiter = '\t'
7280

81+
#define the number of rows which should be skipped during the import:
82+
__skipRows = 0;
7383

7484
#using model function for IRF?
75-
__bUsingModel = True
85+
__bUsingModel = False
7686

77-
#fit weighting: y variance? w = 1/sqrt(y)
87+
#fit weighting: y variance? w = 1/sqrt(y) <--- <poisson noise> otherwise the weighting is equally distributed: w = 1
7888
__bUsingYVarAsWeighting = True
7989

80-
#if using model function? choose type of model (also defined in DReconvolutionModel.py):
90+
#if using model function? choose type of model (defined in DReconvolutionModel.py):
8191
#------------------
8292
#Gaussian = 1
8393
#Lorentz_Cauchy = 2
8494
#Pseudovoigt1 = 3
8595
#Pearson7 = 4
8696
#------------------
87-
__modelType = reconvModel.Gaussian
97+
__modelType = reconvModel.Pearson7

DReconvolutionModel.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ def Pseudovoigt1(x, ampl, a, sigma, s, y0, x0, args=()):
5959
G=np.zeros(x.size)
6060
L=np.zeros(x.size)
6161

62-
#G=(2/sigma)*np.sqrt(np.log(2)/np.pi)*np.exp(-4*np.log(2)*((x-x0)/sigma)**2);
63-
#L=(2/np.pi)*sigma*(1/(4*(x-x0)**2+sigma**2));
64-
6562
G=(1.0/(sigma*np.sqrt(2*np.pi)))*np.exp(-0.5*((x-x0)/sigma)**2)
6663
L=s/(np.pi*((x-x0)**2 + s*s))
6764
return ampl*(a*G+(1-a)*L)+y0

0 commit comments

Comments
 (0)