34 using namespace pwiz::msdata;
35 using namespace pwiz::analysis;
36 using namespace pwiz::util;
37 using boost::logic::tribool;
45 os <<
"size: " << sl.
size() << endl;
47 for (
size_t i=0, end=sl.
size(); i<end; i++)
50 os << spectrum->index <<
" "
51 << spectrum->id <<
" "
52 <<
"ms" << spectrum->cvParam(
MS_ms_level).value <<
" "
54 <<
"scanTime:" << spectrum->scanList.scans[0].cvParam(
MS_scan_start_time).timeInSeconds() <<
" "
64 for (
size_t i=0; i<10; ++i)
72 vector<MZIntensityPair> mzint(i*2);
73 for (
size_t j=1.0; j<i*2; ++j)
84 spectrum->scanList.scans.push_back(
Scan());
101 spectrum->precursors.push_back(
Precursor(500, 3));
118 spectrum->precursors[0].activation.set(
MS_IRMPD);
126 spectrum->scanList.scans.push_back(
Scan());
129 sl->spectra.push_back(spectrum);
134 *
os_ <<
"original spectrum list:\n";
147 return spectrumIdentity.
index%2 == 0;
154 if (
os_) *
os_ <<
"testEven:\n";
166 for (
size_t i=0, end=filter.
size(); i<end; i++)
170 unit_assert(
id.
id ==
"scan=" + lexical_cast<string>(100+i*2));
174 unit_assert(spectrum->id ==
"scan=" + lexical_cast<string>(100+i*2));
183 if (spectrumIdentity.
index%2 != 0)
return false;
184 return boost::logic::indeterminate;
197 return (param.
valueAs<
int>() == 2);
204 if (
os_) *
os_ <<
"testEvenMS2:\n";
223 mutable bool pastMaxIndex;
229 if (spectrumIdentity.
index>5) pastMaxIndex =
true;
231 return (spectrumIdentity.
index==1 ||
232 spectrumIdentity.
index==3 ||
233 spectrumIdentity.
index==5);
245 if (
os_) *
os_ <<
"testSelectedIndices:\n";
271 return boost::logic::indeterminate;
277 return boost::logic::indeterminate;
285 if (
os_) *
os_ <<
"testHasBinaryData:\n";
290 shared_ptr<stringstream> ss(
new stringstream);
292 serializer.
write(*ss, msd);
295 serializer.
read(ss, msd2);
320 if (
os_) *
os_ <<
"testIndexSet:\n";
346 if (
os_) *
os_ <<
"testScanNumberSet:\n";
349 scanNumberSet.
insert(102,104);
350 scanNumberSet.
insert(107);
370 if (
os_) *
os_ <<
"testScanEventSet:\n";
397 if (
os_) *
os_ <<
"testScanTimeRange:\n";
399 const double low = 422.5;
400 const double high = 427.5;
421 if (
os_) *
os_ <<
"testMSLevelSet:\n";
462 if (
os_) *
os_ <<
"testMS2Activation:\n";
546 if (
os_) *
os_ <<
"testMassAnalyzerFilter:\n";
583 if (
os_) *
os_ <<
"testMZPresentFilter:\n";
588 std::set<double> mzSet;
592 double threshold = 10;
594 ThresholdFilter tf(ThresholdFilter::ThresholdingBy_Count, threshold, ThresholdFilter::Orientation_MostIntense, msLevels);
611 std::set<double> mzSet1;
612 mzSet1.insert(200.0);
613 mzSet1.insert(300.0);
614 double threshold1 = 5;
615 ThresholdFilter tf1(ThresholdFilter::ThresholdingBy_Count, threshold1, ThresholdFilter::Orientation_MostIntense, msLevels);
647 int main(
int argc,
char* argv[])
653 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;