OpenMS
EGHTraceFitter.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Stephan Aiche $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 
39 namespace OpenMS
40 {
41 
54  class OPENMS_DLLAPI EGHTraceFitter :
55  public TraceFitter
56  {
57 public:
61  {
62 public:
63 
64  EGHTraceFunctor(int dimensions,
65  const TraceFitter::ModelData* data);
66 
67  ~EGHTraceFunctor() override;
68 
69  int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) override;
70 
71  // compute Jacobian matrix for the different parameters
72  int df(const Eigen::VectorXd& x, Eigen::MatrixXd& J) override;
73 
74 protected:
76  };
77 
79 
81 
83 
84  ~EGHTraceFitter() override;
85 
86  // override important methods
88 
89  double getLowerRTBound() const override;
90 
91  double getTau() const;
92 
93  double getUpperRTBound() const override;
94 
95  double getHeight() const override;
96 
97  double getSigma() const;
98 
99  double getCenter() const override;
100 
101  bool checkMaximalRTSpan(const double max_rt_span) override;
102 
103  bool checkMinimalRTSpan(const std::pair<double, double>& rt_bounds, const double min_rt_span) override;
104 
105  double getValue(double rt) const override;
106 
107  double getArea() override;
108 
109  double getFWHM() const override;
110 
111  String getGnuplotFormula(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace& trace, const char function_name, const double baseline, const double rt_shift) override;
112 
113 protected:
114  double apex_rt_;
115  double height_;
116 
117  double sigma_;
118  double tau_;
119 
120  std::pair<double, double> sigma_5_bound_;
121 
123 
125  static const double EPSILON_COEFS_[];
126 
127  static const Size NUM_PARAMS_;
128 
134  std::pair<double, double> getAlphaBoundaries_(const double alpha) const;
135 
136  void getOptimizedParameters_(const Eigen::VectorXd& x_init) override;
137 
139 
140  void updateMembers_() override;
141  };
142 
143 } // namespace OpenMS
144 
Definition: EGHTraceFitter.h:61
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) override
EGHTraceFunctor(int dimensions, const TraceFitter::ModelData *data)
int df(const Eigen::VectorXd &x, Eigen::MatrixXd &J) override
const TraceFitter::ModelData * m_data
Definition: EGHTraceFitter.h:75
A RT Profile fitter using an Exponential Gaussian Hybrid background model.
Definition: EGHTraceFitter.h:56
double getLowerRTBound() const override
double getHeight() const override
std::pair< double, double > getAlphaBoundaries_(const double alpha) const
Return an ordered pair of the positions where the EGH reaches a height of alpha * height of the EGH.
bool checkMaximalRTSpan(const double max_rt_span) override
double tau_
Definition: EGHTraceFitter.h:118
double getTau() const
double getFWHM() const override
double getArea() override
double sigma_
Definition: EGHTraceFitter.h:117
void fit(FeatureFinderAlgorithmPickedHelperStructs::MassTraces &traces) override
double getUpperRTBound() const override
double getValue(double rt) const override
String getGnuplotFormula(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace &trace, const char function_name, const double baseline, const double rt_shift) override
double getCenter() const override
std::pair< double, double > sigma_5_bound_
Definition: EGHTraceFitter.h:120
void getOptimizedParameters_(const Eigen::VectorXd &x_init) override
double height_
Definition: EGHTraceFitter.h:115
double getSigma() const
~EGHTraceFitter() override
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
static const Size NUM_PARAMS_
Definition: EGHTraceFitter.h:127
double region_rt_span_
Definition: EGHTraceFitter.h:122
EGHTraceFitter(const EGHTraceFitter &other)
EGHTraceFitter & operator=(const EGHTraceFitter &source)
void setInitialParameters_(FeatureFinderAlgorithmPickedHelperStructs::MassTraces &traces)
bool checkMinimalRTSpan(const std::pair< double, double > &rt_bounds, const double min_rt_span) override
double apex_rt_
Definition: EGHTraceFitter.h:114
A more convenient string class.
Definition: String.h:60
Definition: TraceFitter.h:70
Abstract fitter for RT profile fitting.
Definition: TraceFitter.h:64
Definition: TraceFitter.h:175
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Definition: IsobaricIsotopeCorrector.h:43
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:80
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:111