Skip to content

Commit c39d7d4

Browse files
author
dpscience
committed
release of 1st stable version (1.2)
- input file revised - additional convolution with Gaussian kernel works as expected - graphical deconvolution for extracting mono-exponential decay provides additional smoothing using Sivitzky Golay filtering
1 parent 58f9801 commit c39d7d4

File tree

6 files changed

+734
-20249
lines changed

6 files changed

+734
-20249
lines changed

DReconvolutionInput.py

Lines changed: 71 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#*************************************************************************************************
22
#**
3-
#** DLTReconvolution v1.2 (17.01.2019)
3+
#** DLTReconvolution v1.2 (21.09.2019)
44
#**
55
#**
66
#** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved.
@@ -36,77 +36,100 @@
3636

3737
from DReconvolutionModel import ReconvolutionModel as reconvModel
3838

39-
#save output as *.txt file after success?
40-
__saveReconvolutionSpectrum = False
41-
__saveReconvolutionSpectrumPath = 'output/...*txt'
42-
__saveReconvolutionSpectrumResidualPath = 'output/...*txt'
39+
#NOTE: spectrum and IRF (or mono-exponential decay spectrum) data vectors require equal length!
4340

44-
#!note: IRF output is only saved if the model function is used, meaning--> (__bUsingModel = True)
45-
__saveReconvolutionIRF = False
46-
__saveReconvolutionIRFPath = 'output/...*txt'
47-
__saveReconvolutionIRFResidualPath = 'output/...*txt'
41+
#file path (and name) to the SPECTRUM data:
42+
__filePathSpec = 'testData/spectrum_5ps.dat'
43+
__specDataDelimiter = '\t'
4844

45+
#file path (and name) to the IRF data:
46+
__filePathIRF = 'testData/irf_5ps.dat'
47+
__irfDataDelimiter = '\t'
4948

49+
#if TRUE, the fitted model function according to '__modelType' will be used as IRF data
50+
__bUsingModel = False
51+
52+
#if using model function? choose type of model (defined in DReconvolutionModel.py):
53+
#------------------
54+
#Gaussian = 1
55+
#Lorentz_Cauchy = 2
56+
#Pseudovoigt1 = 3
57+
#Pearson7 = 4
58+
#------------------
59+
__modelType = reconvModel.Gaussian
60+
61+
#define the number of rows, which should be skipped during the import (e.g. for ignoring the header entries):
62+
__skipRows = 5;
5063

5164
#channel/bin resolution [ps]
5265
__channelResolutionInPs = 5.0
5366

5467
#binning factor:
55-
__binningFactor = 1;
68+
__binningFactor = 1;
5669

5770
#expected number of components (number of exponential decay functions - LIMITED to MAX: 4):
58-
__numberOfExpDec = 3
71+
__numberOfExpDec = 3
72+
73+
#expected discrete characteristic lifetimes (tau) -> start values in units of picoseconds [ps]
74+
#note: the values are considered in top-down order (e.g.: for __numberOfExpDec = 2 --> __expectedTau_1_in_ps AND __expectedTau_2_in_ps are considered)
75+
__expectedTau_1_in_ps = 110.0;
76+
__expectedTau_2_in_ps = 375.0;
77+
__expectedTau_3_in_ps = 2200.0;
78+
__expectedTau_4_in_ps = 160.0;
5979

60-
#expected lifetimes (tau) -> start values in [ps] (required for the levenberg marquardt fit using lmfit library)
61-
#note: only the first '__numberOfExpDec' related values are considered (e.g.: for __numberOfExpDec = 2 --> __expectedTau_1_in_ps AND __expectedTau_2_in_ps)
62-
__expectedTau_1_in_ps = 190.0;
63-
__expectedTau_2_in_ps = 385.0;
64-
__expectedTau_3_in_ps = 1200.0;
65-
__expectedTau_4_in_ps = 160.0;
80+
#fit weighting: y variance? w = 1/sqrt(y) <--- <assumption: poisson noise> otherwise the weighting is equally distributed: w = 1.0
81+
__bUsingYVarAsWeighting = True
6682

67-
#background estimation (right side of spectrum data):
68-
__bkgrd_startIndex = 8000;
69-
__bkgrd_count = 999;
83+
#background estimation:
84+
__bkgrd_startIndex = 8900;
85+
__bkgrd_count = 1000; # number of channels with respect to the 'startIndex'
7086

71-
#fixed background? (value of estimated background is used)
72-
__bkgrdFixed = False;
87+
#fixed background? >> if True, the value of the estimated background based on the calculated mean [__bkgrd_startIndex:__bkgrd_startIndex + __bkgrd_count] will be used
88+
__bkgrdFixed = False;
7389

7490

75-
#NOTE: Spectrum and IRF (or mono-exponential decay spectrum) data vectors require equal length!!!
91+
#set TRUE if the irf should be retrieved from a mono-exponential decay spectrum such as well annealed metals (Al, Fe, ..) or the 207-Bi isotope using the 'graphical deconvolution' technique presented by Koechlin & Raviart (1964) (in this case, the IRF data will be ignored):
92+
__bUsingMonoDecaySpecForIRF = False
7693

77-
#define the number of rows which should be skipped during the import:
78-
__skipRows = 5;
94+
#fixed mono-decay component in units of picoseconds [ps] (1/lambda = tau):
95+
__tau_monoDecaySpec_in_ps = 182.0 #[ps]
7996

80-
#file path which contains the SPECTRUM data:
81-
__filePathSpec = 'testData/bi207_ref/sn_5ps.dat'
82-
__specDataDelimiter = '\t'
97+
__filePathMonoDecaySpec = 'C:/Users/.../207_Bi.dat'
98+
__monoDecaySpecDataDelimiter = '\t'
8399

84-
#file path which contains the IRF data:
85-
__filePathIRF = 'path to irf data'
86-
__irfDataDelimiter = '\t'
100+
#data pre-processing for indirect IRF extraction from a mono-exponential decay spectrum using the 'graphical deconvolution' technique presented by Koechlin & Raviart (1964):
101+
#1. stage: re-binning >> 2. stage: smoothing
102+
#Note: re-binning is only applied in case of '__bSmoothMonoDecaySpecForIRF = True'
87103

104+
#1. stage: re-binning:
105+
__bReBinMonoDecaySpecForIRF = False
106+
__bReBinFacMonoDecaySpecForIRF = 4
88107

89-
#set TRUE if the irf is retrieved from a mono-exponential decay spectrum such as well annealed metals or 207-Bi (in this case, the IRF data will be ignored):
90-
__bUsingMonoDecaySpecForIRF = True
108+
#2. stage: smoothing by Savitzky-Golay filtering:
109+
__bSmoothMonoDecaySpecForIRF = False
110+
__SmoothingWindowDecaySpecForIRF = 11
111+
__SmoothingPolynomialOrderDecaySpecForIRF = 3
91112

92-
__tau_monoDecaySpec_in_ps = 182.0 #[ps] 207-Bi
93113

94-
__filePathMonoDecaySpec = 'testData/bi207_ref/bi207_5ps.dat'
95-
__monoDecaySpecDataDelimiter = '\t'
114+
#set TRUE if the irf data should be artificially broadened (~FWHM) applying an additional convolution using a Gaussian kernel (e.g. for compensation of energy differences)
115+
__bUsingAdditionalGaussianKernel = False
96116

117+
__gaussianKernelFWHM = 90.2 #[ps]
118+
__bVaryGaussianKernelFWHM = False #if TRUE, this values will be used a an additional fitting parameter
97119

98120

99-
#using model function for IRF?
100-
__bUsingModel = False
121+
#save output as *.txt file after success?
122+
__saveReconvolutionSpectrum = False
123+
__saveReconvolutionSpectrumPath = 'C:/Users/.../Bi_207_analytical_additionalConvKernel_fitdata.txt'
124+
__saveReconvolutionSpectrumResidualPath = 'C:/Users/.../Bi_207_analytical_additionalConvKernel_residuals.txt'
101125

102-
#fit weighting: y variance? w = 1/sqrt(y) <--- <poisson noise> otherwise the weighting is equally distributed: w = 1
103-
__bUsingYVarAsWeighting = True
126+
__saveIRFSpectrum = False
127+
__saveIRFSpectrumPath = 'C:/Users/.../Bi_207_analytical_additionalConvKernel_irfdata.txt'
104128

105-
#if using model function? choose type of model (defined in DReconvolutionModel.py):
106-
#------------------
107-
#Gaussian = 1
108-
#Lorentz_Cauchy = 2
109-
#Pseudovoigt1 = 3
110-
#Pearson7 = 4
111-
#------------------
112-
__modelType = reconvModel.Pearson7
129+
__saveReconvolutionResults = False
130+
__saveReconvolutionResultsPath = 'C:/Users/.../Bi_207_analytical_additionalConvKernel_results.txt'
131+
132+
#Note: IRF output is only saved if the model function is used, meaning--> (__bUsingModel = True)
133+
__saveReconvolutionIRF = False
134+
__saveReconvolutionIRFPath = 'output/...*txt'
135+
__saveReconvolutionIRFResidualPath = 'output/...*txt'

DReconvolutionModel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#*************************************************************************************************
22
#**
3-
#** DLTReconvolution v1.2 (17.01.2019)
3+
#** DLTReconvolution v1.2 (21.09.2019)
44
#**
55
#**
66
#** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved.

0 commit comments

Comments
 (0)