Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spectrum-generator

Package Overview
Dependencies
Maintainers
6
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spectrum-generator - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

10

History.md

@@ -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)

4

lib/index.js

@@ -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);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc