jcampconverter
Advanced tools
Comparing version 2.6.0 to 2.7.0
{ | ||
"name": "jcampconverter", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "Parse and convert JCAMP data", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -436,5 +436,13 @@ 'use strict'; | ||
function getMedian(data) { | ||
data = data.sort(compareNumbers); | ||
var l = data.length; | ||
return data[Math.floor(l / 2)]; | ||
} | ||
function compareNumbers(a, b) { | ||
return a - b; | ||
} | ||
function convertTo3DZ(spectra) { | ||
var noise = 0; | ||
var minZ = spectra[0].data[0][0]; | ||
@@ -453,5 +461,2 @@ var maxZ = minZ; | ||
if (value > maxZ) maxZ = value; | ||
if (i !== 0 && j !== 0) { | ||
noise += Math.abs(value - z[i][j - 1]) + Math.abs(value - z[i - 1][j]); | ||
} | ||
} | ||
@@ -467,3 +472,3 @@ } | ||
maxZ: maxZ, | ||
noise: noise / ((ySize - 1) * (xSize - 1) * 2) | ||
noise: getMedian(z[0].map(Math.abs)) | ||
}; | ||
@@ -470,0 +475,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48489
923