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

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

badge-OS badge-OS

Support this project and keep always updated about recent software releases, bug fixes and major improvements by following on researchgate or github.

badge-researchGate

badge-followers badge-stars badge-forks

DLTPulseGenerator

badge-OS badge-language badge-language badge-license

Copyright (c) 2016-2022 Dr. Danny Petschke (danny.petschke@uni-wuerzburg.de). All rights reserved.

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

Software Applications using DLTPulseGenerator Library

DDRS4PALS software written by Danny Petschke.

Quickstart Guide

C++ Example Code

#define forever                 while(true)
#define DDELETE_SAFETY(__ptr__) { if (__ptr__) { delete __ptr__; __ptr__ = nullptr; } }

int main() {
  printf("let's go ...\n\n");

  /* 1a. define your virtual setup and desired spectrum to be simulated */
  
  DLTSetup setup                     = DLTSetup_DEMO; 
  DLTPulse pulse                     = DLTPulse_DEMO; 
  DLTPHS phs                         = DLTPHS_DEMO; 
  DLTSimulationInput simulationInput = DLTSimulationInput_DEMO; 
  
  /* 1b. set the trigger-levels for both detector branches A and B */
  
  const double triggerA_in_mV = 50.0;
  const double triggerB_in_mV = 50.0;
  
  /* 2. create an instance of DLTPulseGenerator class and pass your setup information and simulation input */
  
  DLTPulseGenerator *pulseGenerator = new DLTPulseGenerator(simulationInput, phs, setup, pulse, nullptr);
  
  /* pulses to be manipulated by calling 'emitPulses(..)' */
  
  DLTPulseF pulseA, pulseB;
  
  forever {
    /* receive the pulses */ 
    
    if (pulseGenerator->emitPulses(&pulseA, &pulseB, triggerA_in_mV, triggerB_in_mV)) {
    
      /* now its your turn ... use the generated pulses for whatever purposes ... for example ... */
      
      /* const double timingA = determineCFTiming(pulseA, level=50.);
	 const double timingB = determineCFTiming(pulseB, level=50.);

	 const double lifetime = calcTimeDifference(timingA, timingB);

	 ... add to the lifetime spectrum ... */
    }
    else
      break;
  }
  
  DDELETE_SAFETY(pulseGenerator)
}

Python Example Code

DLTPulseGenerator can be compiled as linked library enabling access from programming languages such as Python (or Matlab).

A library wrapper for Python (pyDLTPulseGenerator.py) demonstrating the usage of ctypes-library is provided (see pyDLTPulseGeneratorApp.py).

Examples can be found (here).

import pyDLTPulseGenerator as dpg # import 'pyDLTPulseGenerator' module
import matplotlib.pyplot as plt

numberOfPulses = 100000 # number of pulses to be generated ...

# set trigger levels for branches A & B [mV] ...
    
triggerA = -25. # [mV]
triggerB = -25. # [mV]

# define your simulation input (or apply the defaults) ...
    
lt          = dpg.DLTSimulationInput()
setupInfo   = dpg.DLTSetup()
pulseInfo   = dpg.DLTPulse()
phs         = dpg.DLTPHS()

# create an instance of DLTPulseGenerator ...
    
pulseGen = dpg.DLTPulseGenerator(phs,
                                 lt,
                                 setupInfo,
                                 pulseInfo,
                                 'dltpulsegenerator.dll')
				 			
# catch errors ...
    
if not pulseGen.printErrorDescription():
    quit() # kill process on error ...

pulseA = dpg.DLTPulseF() # pulse of detector A
pulseB = dpg.DLTPulseF() # pulse of detector B

for i in range(numberOfPulses):    
    if not pulseGen.emitPulses(pulseA,pulseB,triggerA,triggerB): # generate pulse pairs ...
        continue
	
    plt.plot(pulseA.getTime(),pulseA.getVoltage(),'r-',label="pulse-A")
    plt.plot(pulseB.getTime(),pulseB.getVoltage(),'b-',label="pulse-B")
    plt.show()
    
    // ...

Related Presentation & Publications

DLTPulseGenerator v1.0

DOI

This release v1.0 refers to the original paper by Petschke et al. published in SoftwareX (Elsevier, 2018)

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

and provides the simulation of lifetime spectra consisting of discrete characteristic lifetimes based on detector-output pulses modelled by a log-normal distribution function.

SoftX_1_0

DLTPulseGenerator v1.1

DOI

This release v1.1 refers to the update paper (v1.1) by Petschke et al. published in SoftwareX (Elsevier, 2018)

Update (v1.1) to DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses

and provides the simulation of lifetime spectra consisting of distributed characteristic lifetimes as can be found in porous materials such as polymers or glasses due to distributions in their pore-sizes.

SoftX_1_1

DLTPulseGenerator v1.2

DOI

This release v1.2 refers to the update paper (v1.2) by Petschke et al. published in SoftwareX (Elsevier, 2018)

Update (v1.2) to DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses

and enables 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.

SoftX_1_2

DLTPulseGenerator v1.3

DOI

This release v1.3 refers to the update paper (v1.3) by Petschke et al. published in SoftwareX (Elsevier, 2019)

Update (v1.3) to DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses

and provides the simulation of realistic 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 or the digitization depth.

SoftX_1_3

DLTPulseGenerator v1.4

DLTPulseGenerator v1.5

DLTPulseGenerator v1.4 and 1.5
DOI
This release v1.5 enables the incorporation of pulse height spectra (PHS) from real data or generated by Geant4, so that effects on the background contributing to the lifetime spectra with regard to the PHS window settings can be studied more realistically.

Presentation at 18th International Conference on Positron Annihilation (ICPA-18) in Orlando (Aug. 2018)

ICPA-18 (Orlando): DLTPulseGenerator - A C/C++ library for the simulation of lifetime spectra based on detector output-pulses

How to cite this Library?

  • You should at least cite the following publication.

DOI

DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses (SoftwareX 2018, Elsevier)

  • Additionally, you should cite the version of DLTPulseGenerator library used in your study.

You can cite all released software versions by using the DOI 10.5281/zenodo.7031107. This DOI represents all versions, and will always resolve to the latest one.

DOI

License of DLTPulseGenerator (BSD-3-Clause)

Copyright (c) 2016-2022 Dr. Danny Petschke (danny.petschke@uni-wuerzburg.de). All rights reserved.

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