1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
// --------------------------------------------------------------------------
24
// $Maintainer: Chris Bielow $
26
// --------------------------------------------------------------------------
28
#include <OpenMS/CONCEPT/ClassTest.h>
29
#include <OpenMS/FORMAT/DTAFile.h>
31
///////////////////////////
32
#include <OpenMS/FILTERING/NOISEESTIMATION/SignalToNoiseEstimatorMeanIterative.h>
33
///////////////////////////
35
using namespace OpenMS;
41
START_TEST(SignalToNoiseEstimatorMeanIterative, "$Id: SignalToNoiseEstimatorMeanIterative_test.C 8210 2011-03-28 13:19:52Z aiche $")
43
/////////////////////////////////////////////////////////////
44
/////////////////////////////////////////////////////////////
46
SignalToNoiseEstimatorMeanIterative< >* ptr = 0;
47
SignalToNoiseEstimatorMeanIterative< >* nullPointer = 0;
48
START_SECTION((SignalToNoiseEstimatorMeanIterative()))
49
ptr = new SignalToNoiseEstimatorMeanIterative<>;
50
TEST_NOT_EQUAL(ptr, nullPointer)
51
SignalToNoiseEstimatorMeanIterative<> sne;
56
START_SECTION((SignalToNoiseEstimatorMeanIterative& operator=(const SignalToNoiseEstimatorMeanIterative &source)))
57
MSSpectrum < > raw_data;
58
SignalToNoiseEstimatorMeanIterative<> sne;
60
SignalToNoiseEstimatorMeanIterative<> sne2 = sne;
64
START_SECTION((SignalToNoiseEstimatorMeanIterative(const SignalToNoiseEstimatorMeanIterative &source)))
65
MSSpectrum < > raw_data;
66
SignalToNoiseEstimatorMeanIterative<> sne;
68
SignalToNoiseEstimatorMeanIterative<> sne2(sne);
72
START_SECTION((virtual ~SignalToNoiseEstimatorMeanIterative()))
77
START_SECTION([EXTRA](virtual void init(const PeakIterator& it_begin, const PeakIterator& it_end)))
79
TOLERANCE_ABSOLUTE(0.5)
81
MSSpectrum < > raw_data;
82
MSSpectrum< >::const_iterator it;
84
dta_file.load(OPENMS_GET_TEST_DATA_PATH("SignalToNoiseEstimator_test.dta"), raw_data);
87
SignalToNoiseEstimatorMeanIterative<> sne;
89
p.setValue("win_len", 40.1);
90
p.setValue("noise_for_empty_window", 2.0);
91
p.setValue("min_required_elements", 10);
93
sne.init(raw_data.begin(),raw_data.end());
95
MSSpectrum < > stn_data;
98
MSSpectrum < > stn_data__;
101
dta_file.load(OPENMS_GET_TEST_DATA_PATH("SignalToNoiseEstimatorMeanIterative_test.out"), stn_data);
103
for (it=raw_data.begin();it!=raw_data.end(); ++it)
105
TEST_REAL_SIMILAR (stn_data[i].getIntensity(), sne.getSignalToNoise(it));
108
peak.setIntensity(stn_data[i].getIntensity() / sne.getSignalToNoise(it));
109
stn_data__.push_back(peak);
115
dta_file.store(OPENMS_GET_TEST_DATA_PATH("SignalToNoiseEstimatorMeanIterative_test.debug"), stn_data__);
121
/////////////////////////////////////////////////////////////
122
/////////////////////////////////////////////////////////////