IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/22
The Integrative Modeling Platform
DecayLifetimeHandler.h
Go to the documentation of this file.
1 /**
2  * \file IMP/bff/DecayLifetimeHandler.h
3  * \brief Store and handle lifetime spectra
4  *
5  * This file defines the DecayLifetimeHandler class, which is responsible for storing and handling lifetime spectra.
6  * A lifetime spectrum consists of a set of lifetimes and their corresponding amplitudes.
7  * The class provides methods to set and retrieve the lifetime spectrum, as well as to manipulate it.
8  *
9  * \authors Thomas-Otavio Peulen
10  * Copyright 2007-2023 IMP Inventors. All rights reserved.
11  */
12 
13 #ifndef IMPBFF_DECAYLIFETIMEHANDLER_H
14 #define IMPBFF_DECAYLIFETIMEHANDLER_H
15 
16 #include <IMP/bff/bff_config.h>
17 #include <vector>
18 #include <limits>
19 #include <iostream>
20 #include <IMP/bff/DecayRoutines.h>
21 #include <IMP/Object.h>
22 #include <IMP/object_macros.h>
23 
24 IMPBFF_BEGIN_NAMESPACE
25 
26 //! Store and handle lifetime spectra
27 /** This is responsible for storing and handling lifetime spectra.
28  A lifetime spectrum consists of a set of lifetimes and their corresponding
29  amplitudes. The class provides methods to set and retrieve the lifetime
30  spectrum, as well as to manipulate it.
31  */
32 class IMPBFFEXPORT DecayLifetimeHandler : public Object {
33 private:
34  std::vector<double> _lifetime_spectrum = std::vector<double>(); //!< Lifetime spectrum / original
35  std::vector<double> lt_ = std::vector<double>(); //!< Lifetime spectrum / for getter
36  double amplitude_threshold = std::numeric_limits<double>::epsilon(); //!< Threshold used to discriminate lifetimes with small amplitudes
37  bool use_amplitude_threshold = false; //!< If true, lifetimes with small amplitudes are discriminated
38  bool abs_lifetime_spectrum = true; //!< If true, absolute values of lifetime spectrum are used to compute model function
39 
40 public:
41  /**
42  * Get the amplitude threshold used to discriminate lifetimes with small amplitudes.
43  * \return The amplitude threshold.
44  */
45  double get_amplitude_threshold();
46 
47  /**
48  * Set the amplitude threshold used to discriminate lifetimes with small amplitudes.
49  * \param v The amplitude threshold.
50  */
51  void set_amplitude_threshold(double v);
52 
53  /**
54  * Check if the amplitude threshold is being used to discriminate lifetimes with small amplitudes.
55  * \return True if the amplitude threshold is being used, false otherwise.
56  */
57  bool get_use_amplitude_threshold();
58 
59  /**
60  * Set whether to use the amplitude threshold to discriminate lifetimes with small amplitudes.
61  * \param v True to use the amplitude threshold, false otherwise.
62  */
63  void set_use_amplitude_threshold(bool v);
64 
65  /**
66  * Check if the absolute values of the lifetime spectrum are being used to compute the model function.
67  * \return True if the absolute values are being used, false otherwise.
68  */
69  bool get_abs_lifetime_spectrum() const;
70 
71  /**
72  * Set whether to use the absolute values of the lifetime spectrum to compute the model function.
73  * \param v True to use the absolute values, false otherwise.
74  */
75  void set_abs_lifetime_spectrum(bool v);
76 
77  /**
78  * Set the lifetime spectrum.
79  * \param v The lifetime spectrum to set.
80  */
81  void set_lifetime_spectrum(std::vector<double> v);
82 
83  /**
84  * Add a lifetime to the lifetime spectrum.
85  * \param amplitude The amplitude of the lifetime.
86  * \param lifetime The lifetime value.
87  */
88  void add_lifetime(double amplitude, double lifetime);
89 
90  /**
91  * Get a reference to the lifetime spectrum.
92  * \return A reference to the lifetime spectrum.
93  */
94  std::vector<double>& get_lifetime_spectrum();
95 
96  /**
97  * Get a view of the lifetime spectrum.
98  * \param output_view A pointer to the output view of the lifetime spectrum.
99  * \param n_output A pointer to the number of elements in the output view.
100  */
101  void get_lifetime_spectrum(double **output_view, int *n_output);
102 
103  /**
104  * Construct a DecayLifetimeHandler object.
105  * \param lifetime_spectrum The initial lifetime spectrum (default: empty).
106  * \param use_amplitude_threshold Whether to use the amplitude threshold (default: false).
107  * \param abs_lifetime_spectrum Whether to use the absolute values of the lifetime spectrum (default: false).
108  * \param amplitude_threshold The amplitude threshold (default: epsilon).
109  */
111  std::vector<double> lifetime_spectrum = std::vector<double>(),
112  bool use_amplitude_threshold = false,
113  bool abs_lifetime_spectrum = false,
114  double amplitude_threshold = std::numeric_limits<double>::epsilon()
115  );
116 
118 };
119 
120 IMPBFF_END_NAMESPACE
121 
122 #endif // IMPBFF_DECAYLIFETIMEHANDLER_H
Helper macros for implementing IMP Objects.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Decay routines (e.g. convolution, scaling, and lamp shift routines)
Common base class for heavy weight IMP objects.
Definition: Object.h:111
A shared base class to help in debugging and things.
Store and handle lifetime spectra.