Skip to content

Commit 9c962f7

Browse files
committed
New optimization
1 parent 482a840 commit 9c962f7

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"chemcalc": "^3.0.6"
3737
},
3838
"dependencies": {
39-
"ml-optimize-lorentzian": "0.0.2",
39+
"ml-optimize-lorentzian": "0.1.1",
4040
"ml-stat": "^1.1.0",
4141
"xy-parser": "^1.2.0",
4242
"ml-savitzky-golay-generalized": "1.1.0",

src/optimize.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ function joinBroadPeaks(peakList, options){
197197
if(count>2){
198198
var fitted = Opt.optimizeSingleLorentzian(candidates,
199199
{x: broadLines[maxI].x, y:max, width: Math.abs(candidates[0][0]-candidates[candidates.length-1][0])});
200-
//console.log(fitted)
201200
peakList.push({x:fitted[0][0],y:fitted[1][0],width:fitted[2][0],soft:false});
202201

203202
}

test/ethylvinylether.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('Global spectra deconvolution NMR spectra', function () {
1515
realTopDetection:true,
1616
sgOptions:{windowSize:5, polynomial:3}
1717
});
18+
//console.log(spectrum[1][13223]);
1819
//console.log(result);
1920
result.length.should.equal(21);
2021
});

test/ubiquitin.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ var peakPicking = require("../src/index");
77
//var optimizePeaks = require("../src/optimize");
88
var parser = require('xy-parser');
99
var Stat = require('ml-stat');
10+
var Opt = require("ml-optimize-lorentzian");
11+
12+
1013

1114

1215
describe('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

Comments
 (0)