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

Function cmpDataIntensity

src/tests/class_tests/openms/source/SqMassFile_test.cpp:27–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27void cmpDataIntensity(const MSExperiment& exp1, const MSExperiment& exp2, double abs_tol = 1e-5, double rel_tol = 1+1e-5)
28{
29 // Logic of comparison: if the absolute difference criterion is fulfilled,
30 // the relative one does not matter. If the absolute difference is larger
31 // than allowed, the test does not fail if the relative difference is less
32 // than allowed.
33 // Note that the sample spectrum intensity has a very large range, from
34 // 0.00013 to 183 838 intensity and encoding both values with high accuracy
35 // is difficult.
36
37 TOLERANCE_ABSOLUTE(abs_tol)
38 TOLERANCE_RELATIVE(rel_tol)
39 for (Size i = 0; i < exp1.getNrSpectra(); i++)
40 {
41 TEST_EQUAL(exp1.getSpectra()[i].size(), exp2.getSpectra()[i].size())
42 for (Size k = 0; k < exp1.getSpectra()[i].size(); k++)
43 {
44 // slof is no good for values smaller than 5
45 // if (exp.getSpectrum(i)[k].getIntensity() < 1.0) {continue;}
46 auto a = exp1.getSpectra()[i][k].getIntensity();
47 auto b = exp2.getSpectra()[i][k].getIntensity();
48 // avoid the console clutter if nothing interesing happens
49 if (!TEST::isRealSimilar(a, b)) TEST_REAL_SIMILAR(a, b)
50 }
51 }
52
53 for (Size i = 0; i < exp1.getNrChromatograms(); i++)
54 {
55 TEST_EQUAL(exp1.getChromatograms()[i].size() == exp2.getChromatograms()[i].size(), true)
56 for (Size k = 0; k < exp1.getChromatograms()[i].size(); k++)
57 {
58 auto a = exp1.getChromatograms()[i][k].getIntensity();
59 auto b = exp2.getChromatograms()[i][k].getIntensity();
60 // avoid the console clutter if nothing interesing happens
61 if (!TEST::isRealSimilar(a, b)) TEST_REAL_SIMILAR(a, b)
62 }
63 }
64}
65
66void cmpDataMZ(const MSExperiment& exp1, const MSExperiment& exp2, double abs_tol = 1e-5, double rel_tol = 1+1e-5)
67{

Callers 1

START_SECTIONFunction · 0.70

Calls 7

TEST_EQUALFunction · 0.85
isRealSimilarFunction · 0.85
getChromatogramsMethod · 0.80
getNrSpectraMethod · 0.45
sizeMethod · 0.45
getIntensityMethod · 0.45
getNrChromatogramsMethod · 0.45

Tested by

no test coverage detected