MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / unWeightDatum

Method unWeightDatum

src/openms/source/ANALYSIS/MAPMATCHING/TransformationModel.cpp:209–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 }
208
209 double TransformationModel::unWeightDatum(const double& datum, const String& weight) const
210 {
211 double datum_weighted = 0;
212 if (weight == "ln(x)")
213 {
214 datum_weighted = std::exp(datum);
215 }
216 else if (weight == "ln(y)")
217 {
218 datum_weighted = std::exp(datum);
219 }
220 else if (weight == "1/x")
221 {
222 datum_weighted = 1/std::abs(datum);
223 }
224 else if (weight == "1/y")
225 {
226 datum_weighted = 1/std::abs(datum);
227 }
228 else if (weight == "1/x2")
229 {
230 datum_weighted = std::sqrt(1/std::abs(datum));
231 }
232 else if (weight == "1/y2")
233 {
234 datum_weighted = std::sqrt(1/std::abs(datum));
235 }
236 else if (weight == "x" || weight == "y")
237 {
238 datum_weighted = datum;
239 }
240 else
241 {
242 datum_weighted = datum;
243 OPENMS_LOG_INFO << "weight " + weight + " not supported.";
244 OPENMS_LOG_INFO << "no weighting will be applied.";
245 }
246 return datum_weighted;
247 }
248
249}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected