Skip to content

Commit 9ef5920

Browse files
committed
fix: input y is not modified within the function
1 parent 4e34bd4 commit 9ef5920

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/gsd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var sgDefOptions = {
99
};
1010

1111

12-
function gsd(x, y, options){
12+
function gsd(xIn, yIn, options){
1313
//options = extend({}, defaultOptions, options);
1414
var options=Object.create(options || {});
1515
if (options.minMaxRatio===undefined) options.minMaxRatio=0.00025;
@@ -46,7 +46,7 @@ function gsd(x, y, options){
4646
}
4747
}
4848
//console.log("options.noiseLevel "+options.noiseLevel);
49-
y=[].concat(y);
49+
var y=[].concat(yIn);
5050
var yCorrection = {m:1, b:options.noiseLevel};
5151
if(!options.maxCriteria){
5252
yCorrection.m =-1;
@@ -166,7 +166,7 @@ function gsd(x, y, options){
166166
signals.push({
167167
i:minddY[j],
168168
x: frequency,
169-
y: (Y[minddY[j]]-yCorrection.b)/yCorrection.m,
169+
y: (Y[minddY[j]]+yCorrection.b)/yCorrection.m,
170170
width:Math.abs(intervalR[possible] - intervalL[possible]),//widthCorrection
171171
soft:broadMask[j]
172172
})

0 commit comments

Comments
 (0)