|
1 | 1 | #************************************************************************************************* |
2 | 2 | #** |
3 | | -#** DLTReconvolution v1.2 (17.01.2019) |
| 3 | +#** DLTReconvolution v1.2 (21.09.2019) |
4 | 4 | #** |
5 | 5 | #** |
6 | 6 | #** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved. |
|
36 | 36 |
|
37 | 37 | from DReconvolutionModel import ReconvolutionModel as reconvModel |
38 | 38 |
|
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! |
43 | 40 |
|
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' |
48 | 44 |
|
| 45 | +#file path (and name) to the IRF data: |
| 46 | +__filePathIRF = 'testData/irf_5ps.dat' |
| 47 | +__irfDataDelimiter = '\t' |
49 | 48 |
|
| 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; |
50 | 63 |
|
51 | 64 | #channel/bin resolution [ps] |
52 | 65 | __channelResolutionInPs = 5.0 |
53 | 66 |
|
54 | 67 | #binning factor: |
55 | | -__binningFactor = 1; |
| 68 | +__binningFactor = 1; |
56 | 69 |
|
57 | 70 | #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; |
59 | 79 |
|
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 |
66 | 82 |
|
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' |
70 | 86 |
|
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; |
73 | 89 |
|
74 | 90 |
|
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 |
76 | 93 |
|
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] |
79 | 96 |
|
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' |
83 | 99 |
|
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' |
87 | 103 |
|
| 104 | +#1. stage: re-binning: |
| 105 | +__bReBinMonoDecaySpecForIRF = False |
| 106 | +__bReBinFacMonoDecaySpecForIRF = 4 |
88 | 107 |
|
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 |
91 | 112 |
|
92 | | -__tau_monoDecaySpec_in_ps = 182.0 #[ps] 207-Bi |
93 | 113 |
|
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 |
96 | 116 |
|
| 117 | +__gaussianKernelFWHM = 90.2 #[ps] |
| 118 | +__bVaryGaussianKernelFWHM = False #if TRUE, this values will be used a an additional fitting parameter |
97 | 119 |
|
98 | 120 |
|
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' |
101 | 125 |
|
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' |
104 | 128 |
|
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' |
0 commit comments