spectrum-generator
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,11 @@ | ||
<a name="1.0.1"></a> | ||
## [1.0.1](https://github.com/cheminfo/spectrum-generator/compare/v1.0.0...v1.0.1) (2018-03-09) | ||
### Bug Fixes | ||
* fix bug when start not 0 and pointsPerUnit not 1 ([a41d3db](https://github.com/cheminfo/spectrum-generator/commit/a41d3db)) | ||
<a name="1.0.0"></a> | ||
@@ -2,0 +12,0 @@ # 1.0.0 (2017-11-09) |
@@ -31,3 +31,3 @@ 'use strict'; | ||
* @param {number} [options.end=1000] - Last x value (inclusive) | ||
* @param {number} [options.pointsPerUnit=5] - Number of values between each x | ||
* @param {number} [options.pointsPerUnit=5] - Number of values between each unit of the x axis | ||
* @param {function} [options.getWidth] - Returns the width of a peak for a given value. Defaults to (1 + 3 * value / 1000) | ||
@@ -101,3 +101,3 @@ */ | ||
for (var j = firstPoint; j <= lastPoint; j++) { | ||
var index = j - this[kStart]; | ||
var index = j - this[kStart] * this[kPointsPerUnit]; | ||
if (index >= 0 && index < this[kSize]) { | ||
@@ -104,0 +104,0 @@ var gaussianIndex = Math.floor(gaussianWidth / width * (j - middlePoint) / this[kPointsPerUnit] + gaussianFactor * gaussianWidth / 2); |
{ | ||
"name": "spectrum-generator", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "generate a spectrum from discrete peaks", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -31,2 +31,15 @@ import {generateSpectrum} from '..'; | ||
describe('generateSpectrum with one peak and small window', () => { | ||
it('should work from zero', () => { | ||
const spectrum = generateSpectrum([[12, 1]], { | ||
start: 11, | ||
end: 13, | ||
pointsPerUnit: 10, | ||
getWidth: () => 0.1 | ||
}); | ||
expect(Math.max(...spectrum.y)).toBe(1); | ||
}); | ||
}); | ||
function assertSimple({start, end, peak}) { | ||
@@ -33,0 +46,0 @@ const spectrum = generateSpectrum([[peak, 1]], {start, end, pointsPerUnit: 1, getWidth: simpleGetWidth}); |
@@ -27,3 +27,3 @@ const gaussianFactor = 5; // after 5 the value is nearly 0, nearly no artifacts | ||
* @param {number} [options.end=1000] - Last x value (inclusive) | ||
* @param {number} [options.pointsPerUnit=5] - Number of values between each x | ||
* @param {number} [options.pointsPerUnit=5] - Number of values between each unit of the x axis | ||
* @param {function} [options.getWidth] - Returns the width of a peak for a given value. Defaults to (1 + 3 * value / 1000) | ||
@@ -97,3 +97,3 @@ */ | ||
for (var j = firstPoint; j <= lastPoint; j++) { | ||
var index = j - this[kStart]; | ||
var index = j - this[kStart] * this[kPointsPerUnit]; | ||
if (index >= 0 && index < this[kSize]) { | ||
@@ -100,0 +100,0 @@ var gaussianIndex = Math.floor(gaussianWidth / width * (j - middlePoint) / this[kPointsPerUnit] + gaussianFactor * gaussianWidth / 2); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
20946
454
1