OpenMS
Loading...
Searching...
No Matches
GaussFitter.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Andreas Bertsch, Chris Bielow $
7// --------------------------------------------------------------------------
8//
9
10#pragma once
11
15
16#include <cmath>
17#include <vector>
18
19namespace OpenMS
20{
21 namespace Math
22 {
34 class OPENMS_DLLAPI GaussFitter
35 {
36public:
37
39 struct OPENMS_DLLAPI GaussFitResult
40 {
41public:
43 : A(-1.0), x0(-1.0), sigma(-1.0) {}
44 GaussFitResult(double a, double x, double s)
45 : A(a), x0(x), sigma(s) {}
46
48 double A;
49
51 double x0;
52
54 double sigma;
55
56
64 double eval(double x) const;
65
73 double log_eval_no_normalize(double x) const;
74
75 private:
76 double halflogtwopi = 0.5*log(2.0*Constants::PI);
77 };
78
81
83 virtual ~GaussFitter();
84
87
95 GaussFitResult fit(std::vector<DPosition<2> > & points) const;
96
105 static std::vector<double> eval(const std::vector<double>& evaluation_points, const GaussFitResult& model);
106
107protected:
108
110
111private:
114
117 };
118 }
119}
120
Representation of a coordinate in D-dimensional space.
Definition DPosition.h:32
Implements a fitter for Gaussian functions.
Definition GaussFitter.h:35
void setInitialParameters(const GaussFitResult &result)
sets the initial parameters used by the fit method as initial guess for the Gaussian
GaussFitter & operator=(const GaussFitter &rhs)
Assignment operator (not implemented)
static std::vector< double > eval(const std::vector< double > &evaluation_points, const GaussFitResult &model)
Evaluate the current Gaussian model at the specified points.
virtual ~GaussFitter()
Destructor.
GaussFitResult fit(std::vector< DPosition< 2 > > &points) const
Fits a Gaussian distribution to the given data points.
GaussFitter(const GaussFitter &rhs)
Copy constructor (not implemented)
GaussFitResult init_param_
Definition GaussFitter.h:109
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
struct of parameters of a Gaussian distribution
Definition GaussFitter.h:40
double log_eval_no_normalize(double x) const
Evaluate the current log density of the Gaussian model at the specified point.
double A
parameter A of Gaussian distribution (amplitude)
Definition GaussFitter.h:48
double eval(double x) const
Evaluate the current density Gaussian model at the specified point.
GaussFitResult(double a, double x, double s)
Definition GaussFitter.h:44
double sigma
parameter sigma of Gaussian distribution (width)
Definition GaussFitter.h:54
GaussFitResult()
Definition GaussFitter.h:42
double x0
parameter x0 of Gaussian distribution (center position)
Definition GaussFitter.h:51