Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Sep 4, 2015
1 parent e3d4062 commit 32d993a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion script/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var OSP = require('..');

var options= {
smooth: 8,
normalize: true,
name: "My first spectrum"
}

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

console.log(JSON.stringify(chart));
Expand Down
8 changes: 4 additions & 4 deletions src/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function getAnnotation(pixel, color, height) {
};
}

module.exports=function(spectrum, options) {
module.exports=function(spectrum) {
var annotations=[];
annotations.push(getAnnotation(options.nMred,"red",15));
annotations.push(getAnnotation(options.nMblue,"blue",15));
annotations.push(getAnnotation(options.nMgreen,"green",15));
annotations.push(getAnnotation(spectrum.nMRed,"red",15));
annotations.push(getAnnotation(spectrum.nMBlue,"blue",15));
annotations.push(getAnnotation(spectrum.nMGreen,"green",15));

var x=spectrum.x;
for (var i=0; i<x.length; i++) {
Expand Down
5 changes: 2 additions & 3 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ function addAbsorbanceTransmittance(spectra) {
}
}

function addX(spectra, options) {
function addX(spectra) {
for (var key in spectra) {
var spectrum=spectra[key];
console.log(spectrum);
var diffPoints=spectrum.redPoint-spectrum.bluePoint;
var diffNM=(spectrum.nMRed-spectrum.nMBlue)/(diffPoints-1);
var length=spectrum.y.length;
Expand Down Expand Up @@ -167,7 +166,7 @@ module.exports = function (text, options) {
addAbsorbanceTransmittance(spectra);
addInfo(spectra, options);
process(spectra, options);
addX(spectra,options);
addX(spectra);

return spectra;
}
2 changes: 1 addition & 1 deletion src/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports=function(spectra, options) {
smooth(spectra[key], options.smooth);
}
if (options.normalize) {
normalize(spectra[key].data);
normalize(spectra[key]);
}
}
}

0 comments on commit 32d993a

Please sign in to comment.