53 distributions_(D, nullptr)
55 this->setName(this->getProductName());
58 for (
UInt dim = 0; dim < D; ++dim)
61 this->subsections_.push_back(name);
62 this->defaults_.setValue(name,
"GaussModel",
"Name of the model used for this dimension");
66 this->defaults_.setValue(
"intensity_scaling", 1.0,
"Scaling factor used to adjust the model distribution to the intensities of the data");
67 this->defaultsToParam_();
73 distributions_(D, nullptr),
76 for (
UInt dim = 0; dim < D; ++dim)
79 if (source.distributions_[dim])
91 for (
Size dim = 0; dim < D; ++dim)
93 delete distributions_[dim];
100 if (&source ==
this)
return *
this;
103 scale_ = source.scale_;
105 for (
UInt dim = 0; dim < D; ++dim)
107 if (source.distributions_[dim])
115 distributions_[dim] =
nullptr;
127 for (
UInt dim = 0; dim < D; ++dim)
129 if (distributions_[dim] ==
nullptr)
133 intens *= distributions_[dim]->getIntensity(pos[dim]);
147 return String(
"ProductModel") + D +
"D";
160 if (dist ==
nullptr || dist == distributions_[dim])
165 delete distributions_[dim];
166 distributions_[dim] = dist;
170 this->param_.removeAll(name +
':');
171 this->param_.insert(name +
':', distributions_[dim]->getParameters());
172 this->param_.setValue(name, distributions_[dim]->getName());
180 return distributions_[dim];
192 this->setCutOff(this->getCutOff() / scale_);
194 this->param_.setValue(
"intensity_scaling", scale);
195 this->setCutOff(this->getCutOff() * scale_);
203 std::vector<Samples1D> samples(D);
205 for (
Size dim = 0; dim < D; ++dim)
207 distributions_[dim]->getSamples(samples[dim]);
211 std::vector<UInt> i(D, 0);
213 while (i[D - 1] < samples[D - 1].size())
215 for (
UInt dim = 0; dim < D; ++dim)
217 peak.getPosition()[dim] = samples[dim][i[dim]].getPosition()[0];
220 cont.push_back(peak);
223 for (
Size dim = 0; dim < D - 1; ++dim)
225 if (i[dim] >= samples[dim].size())
239 scale_ = (double)(this->param_.getValue(
"intensity_scaling"));
240 for (
UInt dim = 0; dim < D; ++dim)
243 if (this->param_.exists(name))
245 delete distributions_[dim];
247 Param copy = this->param_.
copy(name +
":",
true);
248 distributions_[dim]->setParameters(copy);
249 if (distributions_[dim]->getName().
hasSubstring(
"IsotopeModel"))
Abstract base class for all D-dimensional models.
Definition: BaseModel.h:25
DPeak< D >::Type PeakType
Definition: BaseModel.h:30
BaseModel & operator=(const BaseModel &source)
assignment operator
Definition: BaseModel.h:51
std::vector< PeakType > SamplesType
Definition: BaseModel.h:31
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
Definition: BaseModel.h:126
Representation of a coordinate in D-dimensional space.
Definition: DPosition.h:29
Exception base class.
Definition: Exception.h:65
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.
Definition: Factory.h:37
Isotope distribution approximated using linear interpolation.
Definition: IsotopeModel.h:34
EmpiricalFormula getFormula()
return the Averagine peptide formula (mass calculated from mean mass and charge – use ....
Stores the name and parameters of a model.
Definition: ModelDescription.h:28
BaseModel< D > * createModel()
Definition: ModelDescription.h:70
Management and storage of parameters / INI files.
Definition: Param.h:44
Param copy(const std::string &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
static char const * shortDimensionName(UInt const dim)
Short name of the dimension (abbreviated form)
IntensityType getScale() const
return the intensity scaling factor
Definition: ProductModel.h:184
std::vector< BaseModel< 1 > * > distributions_
Definition: ProductModel.h:257
IntensityType scale_
Definition: ProductModel.h:258
DPosition< D > PositionType
Definition: ProductModel.h:47
BaseModel< D >::SamplesType SamplesType
Definition: ProductModel.h:48
ProductModel()
Default constructor.
Definition: ProductModel.h:51
void setScale(IntensityType scale)
set the intensity scaling factor
Definition: ProductModel.h:190
static BaseModel< D > * create()
create new ProductModel object (needed by Factory)
Definition: ProductModel.h:139
virtual ProductModel & operator=(const ProductModel &source)
assignment operator
Definition: ProductModel.h:98
BaseModel< 1 > * getModel(UInt dim) const
Definition: ProductModel.h:177
IntensityType getIntensity(const PositionType &pos) const override
intensity equals product of intensities in each dimension
Definition: ProductModel.h:124
ProductModel & setModel(UInt dim, BaseModel< 1 > *dist)
set model dist for dimension dim
Definition: ProductModel.h:157
~ProductModel() override
destructor
Definition: ProductModel.h:89
ProductModel(const ProductModel &source)
copy constructor
Definition: ProductModel.h:71
void getSamples(SamplesType &cont) const override
get reasonable set of samples from the model (i.e. for printing)
Definition: ProductModel.h:199
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
Definition: ProductModel.h:236
double IntensityType
Definition: ProductModel.h:46
static const String getProductName()
Returns the name of the model.
Definition: ProductModel.h:145
A more convenient string class.
Definition: String.h:34
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:94
Class for product models i.e. models with D independent dimensions.
Definition: ProductModel.h:34
static bool hasSubstring(const String &this_s, const String &string)
Definition: StringUtilsSimple.h:112
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22