@@ -7,6 +7,9 @@ var peakPicking = require("../src/index");
77//var optimizePeaks = require("../src/optimize");
88var parser = require ( 'xy-parser' ) ;
99var Stat = require ( 'ml-stat' ) ;
10+ var Opt = require ( "ml-optimize-lorentzian" ) ;
11+
12+
1013
1114
1215describe ( 'Global spectra deconvolution HR mass spectra' , function ( ) {
@@ -18,14 +21,21 @@ describe('Global spectra deconvolution HR mass spectra', function () {
1821 //var spectrum=parser.parse(fs.readFileSync('./ubiquitin.txt', 'utf-8'), {arrayType: 'xxyy'});
1922 d = new Date ( ) ;
2023 //console.log("Parsing time: "+(d.getTime()-n));
21- var noiseLevel = Stat . array . max ( spectrum [ 1 ] ) * 0.015 ;
22-
23- var result = peakPicking . gsd ( spectrum [ 0 ] , spectrum [ 1 ] , { noiseLevel : noiseLevel , minMaxRatio :0 , broadRatio :0 , smoothY :false , realTopDetection :true } ) ;
24+ var noiseLevel = 0 ; //Stat.array.max(spectrum[1])*0.015;
25+
26+ var result = peakPicking . gsd ( spectrum [ 0 ] , spectrum [ 1 ] , { noiseLevel : noiseLevel ,
27+ minMaxRatio :0.0 ,
28+ broadRatio :0 ,
29+ smoothY :false ,
30+ realTopDetection :true ,
31+ sgOptions :{ windowSize : 7 , polynomial : 3 } } ) ;
32+
2433 //console.log(result);
2534 d = new Date ( ) ;
2635 //console.log("Parsing + gsd time: "+(d.getTime()-n));
27-
28- //result = peakPicking.optimize(result,spectrum[0],spectrum[1],1,"gaussian");
36+ var newResult = Opt . optimizeGaussianTrain ( spectrum , result , { percentage :0.2 } ) ;
37+ newResult [ 0 ] . opt . should . equal ( true ) ;
38+ newResult . length . should . equal ( result . length ) ;
2939 //d = new Date();
3040 //console.log("Parsing + gsd + optimization time: "+(d.getTime()-n));
3141
@@ -40,7 +50,6 @@ describe('Global spectra deconvolution HR mass spectra', function () {
4050 it ( 'Should provide the right result ...' , function ( ) {
4151 //var result = gsd(spectrum[0],spectrum[1], 0.001, 0.1);
4252 //console.log(result);
43-
4453 } ) ;
4554} ) ;
4655
0 commit comments