OpenMS
Loading...
Searching...
No Matches
TransformationDescription.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: Timo Sachsenberg $
6// $Authors: Clemens Groepl, Hendrik Weisser $
7// --------------------------------------------------------------------------
8
9#pragma once
10
14#include <iosfwd>
15#include <map>
16#include <memory>
17
18namespace OpenMS
19{
37 class OPENMS_DLLAPI TransformationDescription
38 {
39 // friend class MapAlignmentAlgorithm;
40
41public:
42
48 {
49 // default constructor
51
52 // copy constructor
54
55 // copy assignment
57
58 std::vector<Size> percents = {100, 99, 95, 90, 75, 50, 25}; // TODO: use constexpr array
59 double xmin = 0;
60 double xmax = 0;
61 double ymin = 0;
62 double ymax = 0;
63
64 std::map<Size, double> percentiles_before;
65 std::map<Size, double> percentiles_after;
66 };
67
68
73
76
79
82
87
89 void fitModel(const String& model_type, const Param& params = Param());
90
97 double apply(double value) const;
98
100 const String& getModelType() const;
101
103 static void getModelTypes(StringList& result);
104
110 void setDataPoints(const DataPoints& data);
111
117 void setDataPoints(const std::vector<std::pair<double, double> >& data);
118
120 const DataPoints& getDataPoints() const;
121
123 const Param& getModelParameters() const;
124
126 void invert();
127
135 void getDeviations(std::vector<double>& diffs, bool do_apply = false,
136 bool do_sort = true) const;
137
140
142 void printSummary(std::ostream& os) const;
143
183 double estimateWindow(double quantile = 0.99,
184 bool invert = true,
185 bool full_window = true,
186 double padding_factor = 1.0) const;
187
188protected:
194 std::unique_ptr<TransformationModel> model_;
195 };
196
197} // end of namespace OpenMS
198
Management and storage of parameters / INI files.
Definition Param.h:46
A more convenient string class.
Definition String.h:34
Generic description of a coordinate transformation.
Definition TransformationDescription.h:38
const String & getModelType() const
Gets the type of the fitted model.
void setDataPoints(const DataPoints &data)
Sets the data points.
TransformationDescription()
Default constructor.
void getDeviations(std::vector< double > &diffs, bool do_apply=false, bool do_sort=true) const
Get the deviations between the data pairs.
TransformationStatistics getStatistics() const
Get summary statistics (ranges and errors before/after)
void printSummary(std::ostream &os) const
Print summary statistics for the transformation.
std::unique_ptr< TransformationModel > model_
Owned model instance (std::unique_ptr)
Definition TransformationDescription.h:194
String model_type_
Type of model.
Definition TransformationDescription.h:192
DataPoints data_
Data points.
Definition TransformationDescription.h:190
static void getModelTypes(StringList &result)
Gets the possible types of models.
const DataPoints & getDataPoints() const
Returns the data points.
double apply(double value) const
Applies the transformation to value.
TransformationDescription(const DataPoints &data)
Constructor from data.
void setDataPoints(const std::vector< std::pair< double, double > > &data)
Sets the data points (backwards-compatible overload)
void fitModel(const String &model_type, const Param &params=Param())
Fits a model to the data.
void invert()
Computes an (approximate) inverse of the transformation.
TransformationModel::DataPoint DataPoint
Coordinate pair.
Definition TransformationDescription.h:70
const Param & getModelParameters() const
Non-mutable access to the model parameters.
TransformationDescription(const TransformationDescription &rhs)
Copy constructor.
double estimateWindow(double quantile=0.99, bool invert=true, bool full_window=true, double padding_factor=1.0) const
Estimate a coordinate-transformation, residual-based extraction window.
TransformationModel::DataPoints DataPoints
Vector of coordinate pairs.
Definition TransformationDescription.h:72
TransformationDescription & operator=(const TransformationDescription &rhs)
Assignment operator.
std::vector< DataPoint > DataPoints
Vector of coordinate pairs.
Definition TransformationModel.h:65
std::vector< String > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Summary statistics before/after applying the transformation. For deviations before/after transformati...
Definition TransformationDescription.h:48
TransformationStatistics & operator=(const TransformationStatistics &rhs)=default
std::map< Size, double > percentiles_after
percentiles of x/y deviations after transformation
Definition TransformationDescription.h:65
TransformationStatistics(const TransformationStatistics &rhs)=default
std::map< Size, double > percentiles_before
percentiles of x/y deviations before transformation
Definition TransformationDescription.h:64
Coordinate pair (with optional annotation)
Definition TransformationModel.h:33