Skip to content

DLTPulseGenerator - A library for the simulation of lifetime spectra based on realistically modelled detector-output pulses

License

Notifications You must be signed in to change notification settings

dpscience/DLTPulseGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DLTPulseGenerator

Copyright (c) 2016-2018 Danny Petschke ([email protected]). All rights reserved.

DLTPulseGenerator - A library for the simulation of lifetime spectra based on detector-output pulses

Introduction

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 lifetime spectra according to the measurement setup: i.e. the kind of detectors (PMTs - Photomultiplier, Diodes, such as APDs - Avalanche Photodiodes) and the acquisition hardware (mostly the combination of ADC and FPGA). The simulation is based on pairs of non-TTL detector pulses which require the Constant Fraction Principle (CFD) for the determination of the exact timing signal.

DLTPulseGenerator library provides the optional compilation as static or linked library to make it easy accessible from other programming languages, e.g.

How to cite this 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.

DLTPulseGenerator v1.0

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

DLTPulseGenerator v1.1

This release v1.1 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).

DLTPulseGenerator v1.2

This release v1.2 was modified to allow the simulation of lifetime spectra consisting of non-Gaussian distributed and linearly combined Instrument Response Functions for the PDS A/B and MU.

Example using C

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 and using the provided callback function: see DLTPulseGeneratorApp.h/.cpp.

Example using Python

A library wrapper in Python (pyDLTPulseGenerator.py) which demonstrates the usage of ctypes-library by calling the functions from DLTPulseGenerator.dll (x86/x64) is provided.
pyDLTPulseGeneratorApp.py calls functions from the library wrapper pyDLTPulseGenerator.py and displayes the generated pulse pairs. Additionally, the Pulse Height Spectra (PHS) are determined and displayed.

requirements:

WinPython meets all requirements.

Generated Pulses

License (BSD-3-Clause)

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice
    this list of conditions and the following disclaimer.

  2. 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.

  3. 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