Skip to content

Commit 32d993a

Browse files
committed
Fix bugs
1 parent e3d4062 commit 32d993a

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

script/parse.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var OSP = require('..');
55

66
var options= {
77
smooth: 8,
8+
normalize: true,
89
name: "My first spectrum"
910
}
1011

@@ -17,7 +18,7 @@ FS.readFile('./data/rgba.txt', 'utf8', function (err,data) {
1718
return console.log(err);
1819
}
1920
var spectra=OSP.parse(data, options);
20-
var annotations=OSP.annotations(spectra.R, options);
21+
var annotations=OSP.annotations(spectra.R);
2122
var chart=OSP.getChart(spectra);
2223

2324
console.log(JSON.stringify(chart));

src/annotations.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ function getAnnotation(pixel, color, height) {
1818
};
1919
}
2020

21-
module.exports=function(spectrum, options) {
21+
module.exports=function(spectrum) {
2222
var annotations=[];
23-
annotations.push(getAnnotation(options.nMred,"red",15));
24-
annotations.push(getAnnotation(options.nMblue,"blue",15));
25-
annotations.push(getAnnotation(options.nMgreen,"green",15));
23+
annotations.push(getAnnotation(spectrum.nMRed,"red",15));
24+
annotations.push(getAnnotation(spectrum.nMBlue,"blue",15));
25+
annotations.push(getAnnotation(spectrum.nMGreen,"green",15));
2626

2727
var x=spectrum.x;
2828
for (var i=0; i<x.length; i++) {

src/parse.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ function addAbsorbanceTransmittance(spectra) {
126126
}
127127
}
128128

129-
function addX(spectra, options) {
129+
function addX(spectra) {
130130
for (var key in spectra) {
131131
var spectrum=spectra[key];
132-
console.log(spectrum);
133132
var diffPoints=spectrum.redPoint-spectrum.bluePoint;
134133
var diffNM=(spectrum.nMRed-spectrum.nMBlue)/(diffPoints-1);
135134
var length=spectrum.y.length;
@@ -167,7 +166,7 @@ module.exports = function (text, options) {
167166
addAbsorbanceTransmittance(spectra);
168167
addInfo(spectra, options);
169168
process(spectra, options);
170-
addX(spectra,options);
169+
addX(spectra);
171170

172171
return spectra;
173172
}

src/process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports=function(spectra, options) {
5050
smooth(spectra[key], options.smooth);
5151
}
5252
if (options.normalize) {
53-
normalize(spectra[key].data);
53+
normalize(spectra[key]);
5454
}
5555
}
5656
}

0 commit comments

Comments
 (0)