Skip to content

Commit 9815478

Browse files
author
dpscience
committed
added: irf can be retrieved from a mono-exponential decay sepctrum
The irf can be retrieved from a mono-exponential decay spectrum such as from well annealed pure metals or 207-Bi (182ps).
1 parent 4e34098 commit 9815478

6 files changed

Lines changed: 20065 additions & 19 deletions

File tree

DReconvolutionInput.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#*************************************************************************************************
22
#**
3-
#** Copyright (c) 2017, 2018 Danny Petschke. All rights reserved.
3+
#** DLTReconvolution v1.2 (17.01.2019)
4+
#**
5+
#**
6+
#** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved.
47
#**
58
#** Redistribution and use in source and binary forms, with or without modification,
69
#** are permitted provided that the following conditions are met:
@@ -35,13 +38,14 @@
3538

3639
#save output as *.txt file after success?
3740
__saveReconvolutionSpectrum = False
38-
__saveReconvolutionSpectrumPath = 'testData/recovolutionSpectrumOutput.txt'
39-
__saveReconvolutionSpectrumResidualPath = 'testData/recovolutionSpectrumResidualsOutput.txt'
41+
__saveReconvolutionSpectrumPath = 'output/...*txt'
42+
__saveReconvolutionSpectrumResidualPath = 'output/...*txt'
4043

4144
#!note: IRF output is only saved if the model function is used, meaning--> (__bUsingModel = True)
4245
__saveReconvolutionIRF = False
43-
__saveReconvolutionIRFPath = 'testData/recovolutionIRFOutput.txt'
44-
__saveReconvolutionIRFResidualPath = 'testData/recovolutionIRFResidualsOutput.txt'
46+
__saveReconvolutionIRFPath = 'output/...*txt'
47+
__saveReconvolutionIRFResidualPath = 'output/...*txt'
48+
4549

4650

4751
#channel/bin resolution [ps]
@@ -51,13 +55,13 @@
5155
__binningFactor = 1;
5256

5357
#expected number of components (number of exponential decay functions - LIMITED to MAX: 4):
54-
__numberOfExpDec = 2
58+
__numberOfExpDec = 3
5559

5660
#expected lifetimes (tau) -> start values in [ps] (required for the levenberg marquardt fit using lmfit library)
5761
#note: only the first '__numberOfExpDec' related values are considered (e.g.: for __numberOfExpDec = 2 --> __expectedTau_1_in_ps AND __expectedTau_2_in_ps)
58-
__expectedTau_1_in_ps = 240.0;
59-
__expectedTau_2_in_ps = 1200.0;
60-
__expectedTau_3_in_ps = 2800.0;
62+
__expectedTau_1_in_ps = 190.0;
63+
__expectedTau_2_in_ps = 385.0;
64+
__expectedTau_3_in_ps = 1200.0;
6165
__expectedTau_4_in_ps = 160.0;
6266

6367
#background estimation (right side of spectrum data):
@@ -68,18 +72,29 @@
6872
__bkgrdFixed = False;
6973

7074

71-
#NOTE: Spectrum and IRF data vectors require equal length!!!
75+
#NOTE: Spectrum and IRF (or mono-exponential decay spectrum) data vectors require equal length!!!
76+
77+
#define the number of rows which should be skipped during the import:
78+
__skipRows = 5;
7279

7380
#file path which contains the SPECTRUM data:
74-
__filePathSpec = 'testData/spectrum_5ps.dat'
81+
__filePathSpec = 'testData/bi207_ref/sn_5ps.dat'
7582
__specDataDelimiter = '\t'
7683

7784
#file path which contains the IRF data:
78-
__filePathIRF = 'testData/irf_5ps.dat'
85+
__filePathIRF = 'path to irf data'
7986
__irfDataDelimiter = '\t'
8087

81-
#define the number of rows which should be skipped during the import:
82-
__skipRows = 0;
88+
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
91+
92+
__tau_monoDecaySpec_in_ps = 182.0 #[ps] 207-Bi
93+
94+
__filePathMonoDecaySpec = 'testData/bi207_ref/bi207_5ps.dat'
95+
__monoDecaySpecDataDelimiter = '\t'
96+
97+
8398

8499
#using model function for IRF?
85100
__bUsingModel = False

DReconvolutionModel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#*************************************************************************************************
22
#**
3-
#** Copyright (c) 2017, 2018 Danny Petschke. All rights reserved.
3+
#** DLTReconvolution v1.2 (17.01.2019)
4+
#**
5+
#**
6+
#** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved.
47
#**
58
#** Redistribution and use in source and binary forms, with or without modification,
69
#** are permitted provided that the following conditions are met:

DReconvolutionProc.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#*************************************************************************************************
22
#**
3-
#** Copyright (c) 2017, 2018 Danny Petschke. All rights reserved.
3+
#** DLTReconvolution v1.2 (17.01.2019)
4+
#**
5+
#**
6+
#** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved.
47
#**
58
#** Redistribution and use in source and binary forms, with or without modification,
69
#** are permitted provided that the following conditions are met:
@@ -43,7 +46,22 @@
4346
print("....DLTReconvolution script started....");
4447

4548
xSpec,ySpec = np.loadtxt(userInput.__filePathSpec, delimiter=userInput.__specDataDelimiter, skiprows=userInput.__skipRows, unpack=True, dtype='float');
46-
xIRF,yIRF = np.loadtxt(userInput.__filePathIRF, delimiter=userInput.__irfDataDelimiter, skiprows=userInput.__skipRows, unpack=True, dtype='float');
49+
50+
if not userInput.__bUsingMonoDecaySpecForIRF:
51+
xIRF,yIRF = np.loadtxt(userInput.__filePathIRF, delimiter=userInput.__irfDataDelimiter, skiprows=userInput.__skipRows, unpack=True, dtype='float');
52+
else:
53+
xIRF,yMonoDecaySpec = np.loadtxt(userInput.__filePathMonoDecaySpec, delimiter=userInput.__monoDecaySpecDataDelimiter, skiprows=userInput.__skipRows, unpack=True, dtype='float');
54+
55+
if userInput.__tau_monoDecaySpec_in_ps <= 0:
56+
print("Input error: negative lifetime for mono-decay spectrum.");
57+
quit(); #kill the process on error.
58+
59+
yIRF = np.zeros(xSpec.size);
60+
61+
for i in range(1, len(xIRF)-1):
62+
yIRF[i] = yMonoDecaySpec[i] + (userInput.__tau_monoDecaySpec_in_ps/(2*userInput.__channelResolutionInPs))*(yMonoDecaySpec[i+1] - yMonoDecaySpec[i-1])
63+
64+
4765

4866
yIRFOrigin = yIRF;
4967

@@ -618,7 +636,7 @@ def ExpDecay_4(x, ampl1, tau1, ampl2, tau2, ampl3, tau3, ampl4, tau4, y0, x0, ar
618636

619637
if userInput.__numberOfExpDec == 3:
620638
print("\nrunning reconvolution with 3 components...\n")
621-
fitModelDecay = Model(deconv_ExpDecay_3);
639+
fitModelDecay = Model(ExpDecay_3);
622640
fitModelDecay.set_param_hint('ampl1', min=0.0);
623641
fitModelDecay.set_param_hint('tau1', min=0.00001);
624642
fitModelDecay.set_param_hint('ampl2', min=0.0);

LICENCE.txt renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************************
22
**
3-
** Copyright (c) 2017, 2018 Danny Petschke. All rights reserved.
3+
** Copyright (c) 2017 - 2019 Danny Petschke. All rights reserved.
44
**
55
** Redistribution and use in source and binary forms, with or without modification,
66
** are permitted provided that the following conditions are met:

0 commit comments

Comments
 (0)