OpenMS
InterpolationModel Class Reference

Abstract class for 1D-models that are approximated using linear interpolation. More...

#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/InterpolationModel.h>

Inheritance diagram for InterpolationModel:
[legend]
Collaboration diagram for InterpolationModel:
[legend]

Public Types

typedef double IntensityType
 
typedef DPosition< 1 > PositionType
 
typedef double CoordinateType
 
using KeyType = double
 
typedef Math::LinearInterpolation< KeyTypeLinearInterpolation
 
- Public Types inherited from BaseModel< 1 >
typedef double IntensityType
 
typedef double CoordinateType
 
typedef DPosition< D > PositionType
 
typedef DPeak< D >::Type PeakType
 
typedef std::vector< PeakTypeSamplesType
 

Public Member Functions

 InterpolationModel ()
 Default constructor. More...
 
 InterpolationModel (const InterpolationModel &source)
 copy constructor More...
 
 ~InterpolationModel () override=default
 destructor More...
 
InterpolationModeloperator= (const InterpolationModel &source)
 assignment operator More...
 
IntensityType getIntensity (const PositionType &pos) const override
 access model predicted intensity at position pos More...
 
IntensityType getIntensity (CoordinateType coord) const
 access model predicted intensity at position pos More...
 
const LinearInterpolationgetInterpolation () const
 Returns the interpolation class. More...
 
CoordinateType getScalingFactor () const
 get the scaling for the model More...
 
virtual void setOffset (CoordinateType offset)
 set the offset of the model More...
 
void getSamples (SamplesType &cont) const override
 get reasonable set of samples from the model (i.e. for printing) More...
 
virtual CoordinateType getCenter () const
 "center" of the model, particular definition (depends on the derived model) More...
 
virtual void setSamples ()
 set sample/supporting points of interpolation wrt params. More...
 
void setInterpolationStep (CoordinateType interpolation_step)
 Set the interpolation step for the linear interpolation of the model. More...
 
void setScalingFactor (CoordinateType scaling)
 
- Public Member Functions inherited from BaseModel< 1 >
 BaseModel ()
 Default constructor. More...
 
 BaseModel (const BaseModel &source)
 copy constructor More...
 
 ~BaseModel () override
 Destructor. More...
 
BaseModeloperator= (const BaseModel &source)
 assignment operator More...
 
void registerChildren ()
 
void registerChildren ()
 
virtual IntensityType getIntensity (const PositionType &pos) const=0
 access model predicted intensity at position pos More...
 
virtual bool isContained (const PositionType &pos) const
 check if position pos is part of the model regarding the models cut-off. More...
 
void fillIntensity (PeakType &peak) const
 Convenience function to set the intensity of a peak to the predicted intensity at its current position, calling virtual void getIntensity(). More...
 
void fillIntensities (PeakIterator begin, PeakIterator end) const
 Convenience function that applies fillIntensity() to an iterator range. More...
 
virtual IntensityType getCutOff () const
 get cutoff value More...
 
virtual void setCutOff (IntensityType cut_off)
 set cutoff value More...
 
virtual void getSamples (std::ostream &os)
 fill stream with reasonable set of samples from the model (i.e. for printing) More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Protected Member Functions

void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
- Protected Member Functions inherited from BaseModel< 1 >
void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Protected Attributes

LinearInterpolation interpolation_
 
CoordinateType interpolation_step_
 
CoordinateType scaling_
 
- Protected Attributes inherited from BaseModel< 1 >
IntensityType cut_off_
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseModel< 1 >
static void registerChildren ()
 register all derived classes here (implemented in file BaseModel_impl.h) More...
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
 Writes all parameters to meta values. More...
 

Detailed Description

Abstract class for 1D-models that are approximated using linear interpolation.

Model wrapping LinearInterpolation for speed-up in calculation of predicted intensities Derived classes have to implement setSamples()

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
cutoff float0.0  Low intensity cutoff of the model. Peaks below this intensity are not considered part of the model.
interpolation_step float0.1  Sampling rate for the interpolation of the model function
intensity_scaling float1.0  Scaling factor used to adjust the model distribution to the intensities of the data

Note:
  • If a section name is documented, the documentation is displayed as tooltip.
  • Advanced parameter names are italic.

Member Typedef Documentation

◆ CoordinateType

typedef double CoordinateType

◆ IntensityType

typedef double IntensityType

◆ KeyType

using KeyType = double

◆ LinearInterpolation

◆ PositionType

typedef DPosition<1> PositionType

Constructor & Destructor Documentation

◆ InterpolationModel() [1/2]

InterpolationModel ( )
inline

Default constructor.

◆ InterpolationModel() [2/2]

InterpolationModel ( const InterpolationModel source)
inline

copy constructor

◆ ~InterpolationModel()

~InterpolationModel ( )
overridedefault

destructor

Member Function Documentation

◆ getCenter()

virtual CoordinateType getCenter ( ) const
inlinevirtual

"center" of the model, particular definition (depends on the derived model)

Reimplemented in IsotopeModel, GaussModel, ExtendedIsotopeModel, EmgModel, BiGaussModel, and EGHModel.

◆ getIntensity() [1/2]

IntensityType getIntensity ( const PositionType pos) const
inlineoverride

access model predicted intensity at position pos

◆ getIntensity() [2/2]

IntensityType getIntensity ( CoordinateType  coord) const
inline

access model predicted intensity at position pos

◆ getInterpolation()

const LinearInterpolation& getInterpolation ( ) const
inline

Returns the interpolation class.

◆ getSamples()

void getSamples ( SamplesType cont) const
inlineoverridevirtual

get reasonable set of samples from the model (i.e. for printing)

Implements BaseModel< 1 >.

◆ getScalingFactor()

CoordinateType getScalingFactor ( ) const
inline

get the scaling for the model

A scaling factor of scaling means that the area under the model equals scaling. Default is 1.

◆ operator=()

◆ setInterpolationStep()

void setInterpolationStep ( CoordinateType  interpolation_step)
inline

Set the interpolation step for the linear interpolation of the model.

For setting to take affect, call setSamples().

◆ setOffset()

virtual void setOffset ( CoordinateType  offset)
inlinevirtual

set the offset of the model

The whole model will be shifted to the new offset without being recomputed all over. Setting takes affect immediately.

Reimplemented in IsotopeModel, GaussModel, ExtendedIsotopeModel, EmgModel, BiGaussModel, and EGHModel.

◆ setSamples()

virtual void setSamples ( )
inlinevirtual

set sample/supporting points of interpolation wrt params.

Reimplemented in GaussModel, ExtendedIsotopeModel, EmgModel, BiGaussModel, EGHModel, and IsotopeModel.

◆ setScalingFactor()

void setScalingFactor ( CoordinateType  scaling)
inline

◆ updateMembers_()

void updateMembers_ ( )
inlineoverrideprotectedvirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented from DefaultParamHandler.

Reimplemented in IsotopeModel.

References BaseModel< D >::updateMembers_().

Member Data Documentation

◆ interpolation_

LinearInterpolation interpolation_
protected

◆ interpolation_step_

CoordinateType interpolation_step_
protected

◆ scaling_

CoordinateType scaling_
protected