ProteoWizard
convert2densetest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Witold Wolski <wewolski@gmail.com>
6//
7// Copyright : ETH Zurich
8//
9// Licensed under the Apache License, Version 2.0 (the "License");
10// you may not use this file except in compliance with the License.
11// You may obtain a copy of the License at
12//
13// http://www.apache.org/licenses/LICENSE-2.0
14//
15// Unless required by applicable law or agreed to in writing, software
16// distributed under the License is distributed on an "AS IS" BASIS,
17// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18// See the License for the specific language governing permissions and
19// limitations under the License.
20//
21
23
28
29namespace{
30
31 using namespace pwiz::util;
32 void testConvert()
33 {
34 std::pair<double, double> tmp;
35 tmp.first = 1000.;
36 tmp.second = 1010;
37 double ppm = 100;
39 c2d.defBreak(tmp,ppm);
40 std::vector<double> mids;
41 c2d.getMids(mids);
42 c2d.am_ = 0.1;
43
44 double mz[] = {1001. , 1001.5 , 1001.8 , 1004. , 1005., 1008. , 1009. , 1009.3};
45 size_t smz = sizeof(mz)/sizeof(double);
46 std::vector<double> intensity( smz, 10.), gg;
47 double all = std::accumulate(intensity.begin(),intensity.end(),0.);
48
49 c2d.convert2dense(mz,mz+smz,intensity.begin(),gg);
50
51 double bla = std::accumulate(gg.begin(),gg.end(),0.);
52 unit_assert_equal(bla, all - 10., 1e-10);
53
54 }
55
56}
57
58
59int main(int argc, char **argv) {
60 testConvert();
61}
int main(int argc, char **argv)
double mz(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition Ion.hpp:78
std::size_t defBreak(std::pair< double, double > &mzrange, double ppm)
computes split points of an map.
void getMids(std::vector< double > &mids)
void convert2dense(Tmass beginMass, Tmass endMass, Tintens intens, Tout ass)
Converts a sparse spec to a dense spec.
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99