Copyright (c) 2016-2019 Danny Petschke ([email protected]). All rights reserved.
DLTPulseGenerator - A library for the simulation of lifetime spectra based on detector-output pulses
The quantitative analysis of lifetime spectra relevant in both life and materials sciences presents one of the ill-posed inverse problems and leads to the most stringent requirements on the hardware specifications and analysis algorithms.
DLTPulseGenerator is written in native C 11 (ISO/IEC 14882:2011) and provides the simulation of (e.g. positron or fluorescence) lifetime spectra according to the measurement setup: i.e. the kind of detectors (photomultipliers (PMT) or (avalanche) diodes) and the acquisition hardware (mostly the combination of ADC and FPGA).
The simulation is based on pairs of non-TTL detector output pulses which require the constant fraction principle for the determination of the exact timing signal.
DLTPulseGenerator library provides the compilation as static or linked library to make it easily accessible from other programming languages such as ...
- matlab (for mex-library) or
- python (for ctypes-library).
Petschke D., Staab T.E.M. DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses. SoftwareX (2018), https://doi.org/10.1016/j.softx.2018.04.002.
This release v1.0 refers to the original paper (Petschke and Staab (2018)) and provides the simulation of lifetime spectra consisting of discrete specific lifetimes.
forked by SoftwareX (Elsevier): https://github.com/ElsevierSoftwareX/SOFTX-D-17-00077
This release v1.1 refers to the update paper (v1.1) (Petschke and Staab (2018)) and was extended to provide the simulation of lifetime spectra consisting of distributed specific lifetimes as can be found in porous materials (polymers, glasses) using positron annihilation lifetime spectroscopy (PALS).
This release v1.2 refers to the update paper (v1.2) (Petschke and Staab (2018)) and was modified to allow the simulation of lifetime spectra consisting of non-Gaussian or any-distributed and linearly combined Instrument Response Functions (IRF) for the PDS A/B and MU.
This release v1.3 provides the simulation of additional hardware influences mainly originating from the parts of the A/D converter such as baseline-offset jitter, random noise, fixed pattern and random aperture jitters on the time axis and the digitization depth [bit].
DDRS4PALS software written by Danny Petschke
int main() {
printf("How to easily implement DLTPulseGenerator library?\n\n");
/* 1a. Define structs: */
DLTSetup setup = DLTSetup_DEMO;
DLTPulse pulse = DLTPulse_DEMO;
DLTPHS phs = DLTPHS_DEMO;
DLTSimulationInput simulationInput = DLTSimulationInput_DEMO;
/* 1b. Set trigger-levels for branch A and B: */
const double triggerA_in_mV = 50.0;
const double triggerB_in_mV = 50.0;
/* 2. Initialize DLTPulseGenerator class: */
DLTPulseGenerator *pulseGenerator = new DLTPulseGenerator(simulationInput, phs, setup, pulse, nullptr);
/* 3. Receive pulses: */
DLTPulseF pulseA, pulseB;
while (1) {
if ( pulseGenerator->emitPulses(&pulseA, &pulseB, triggerA_in_mV, triggerB_in_mV) ) {
/* all algorithms for exact timing determination and lifetime calculation, respectively, have to be placed here! */
/* const double timingA = CFD(pulseA, level);
const double timingB = CFD(pulseB, level);
const double lifetime = calcDifference(timingA, timingB);
-> binning the lifetimes (MCA). */
}
else
break;
}
}
Errors can be handled by inheriting from class DLTPulseGenerator using the provided callback function: see DLTPulseGeneratorApp.h/.cpp.
A library wrapper in python (pyDLTPulseGenerator.py) demonstrating the usage of ctypes-library by calling the functions of DLTPulseGenerator.dll (x86/x64) is provided. pyDLTPulseGeneratorApp.py calls functions from the library (wrapper) pyDLTPulseGenerator.py. The generated pulse pairs and the pulse height spectrum are displayed for demonstration purposes.
WinPython meets all requirements.
Copyright (c) 2016-2019 Danny Petschke ([email protected]). All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice
this list of conditions and the following disclaimer. -
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. -
Neither the name of the copyright holder "Danny Petschke" nor the names of
its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
see also BSD-3-Clause License