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

nmr-processing

Package Overview
Dependencies
Maintainers
8
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nmr-processing - npm Package Compare versions

Comparing version 0.2.1 to 0.2.3

16

package.json
{
"name": "nmr-processing",
"version": "0.2.1",
"version": "0.2.3",
"description": "",

@@ -42,12 +42,12 @@ "main": "lib/index.js",

"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@types/jest": "^25.2.1",
"cheminfo-build": "^1.1.1",
"eslint": "^7.2.0",
"eslint": "^7.4.0",
"eslint-config-cheminfo": "^3.0.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-prettier": "^3.1.4",
"esm": "^3.2.25",
"jest": "^26.0.1",
"jest": "^26.1.0",
"jest-matcher-deep-close-to": "^2.0.1",

@@ -57,3 +57,3 @@ "ml-array-median": "^1.1.3",

"prettier": "^2.0.5",
"rollup": "^2.17.0"
"rollup": "^2.21.0"
},

@@ -63,3 +63,3 @@ "dependencies": {

"ml-gsd": "^5.0.1",
"ml-matrix-peaks-finder": "^0.2.1",
"ml-matrix-peaks-finder": "^0.2.2",
"ml-simple-clustering": "^0.1.0",

@@ -66,0 +66,0 @@ "ml-spectra-processing": "^4.0.0"

@@ -1,3 +0,6 @@

// source: https://en.wikipedia.org/wiki/Gyromagnetic_ratio
// sources:
// https://en.wikipedia.org/wiki/Gyromagnetic_ratio
// TODO: can we have a better source and more digits ? @jwist
export const gyromagneticRatio = {

@@ -4,0 +7,0 @@ '1H': 267.52218744e6,

@@ -20,3 +20,11 @@ import { FFTUtils } from 'ml-fft';

export function xyzAutoPeaksPicking(spectraData, options = {}) {
let { thresholdFactor = 0.5, isHomoNuclear, nucleus, sfo1 } = options;
let {
thresholdFactor = 0.5,
isHomoNuclear,
nucleus = ['1H', '1H'],
observeFrequencies,
enhanceSymmetry = false,
clean = true,
maxPercentCutOff = 0.03,
} = options;

@@ -48,11 +56,13 @@ if (thresholdFactor === 0) {

let [nucleusX, nucleusY] = nucleus;
let [observeFrequencyX, observeFrequencyY] = sfo1;
let [observeFrequencyX, observeFrequencyY] = observeFrequencies;
let convolutedSpectrum = FFTUtils.convolute(
data,
smallFilter,
nbSubSpectra,
nbPoints,
);
let signals = [];
if (isHomoNuclear) {
let convolutedSpectrum = FFTUtils.convolute(
data,
smallFilter,
nbSubSpectra,
nbPoints,
);
let peaksMC1 = matrixPeakFinders.findPeaks2DRegion(data, {

@@ -63,3 +73,4 @@ filteredData: convolutedSpectrum,

nStdDev: nStdDev * thresholdFactor,
}); // )1.5);
});
let peaksMax1 = matrixPeakFinders.findPeaks2DMax(data, {

@@ -70,22 +81,20 @@ filteredData: convolutedSpectrum,

nStdDev: (nStdDev + 0.5) * thresholdFactor,
}); // 2.0);
});
for (let i = 0; i < peaksMC1.length; i++) {
peaksMax1.push(peaksMC1[i]);
}
return PeakOptimizer.enhanceSymmetry(
createSignals2D(peaksMax1, spectraData, {
tolerance: 24,
nucleusX,
nucleusY,
observeFrequencyX,
observeFrequencyY,
}),
);
signals = createSignals2D(peaksMax1, spectraData, {
tolerance: 24,
nucleusX,
nucleusY,
observeFrequencyX,
observeFrequencyY,
});
if (enhanceSymmetry) {
signals = PeakOptimizer.enhanceSymmetry(signals);
}
} else {
let convolutedSpectrum = FFTUtils.convolute(
data,
smallFilter,
nbSubSpectra,
nbPoints,
);
let peaksMC1 = matrixPeakFinders.findPeaks2DRegion(data, {

@@ -98,5 +107,8 @@ filteredData: convolutedSpectrum,

// Peak2D[] peaksMC1 = matrixPeakFinders.findPeaks2DMax(data, nbSubSpectra, nbPoints, (nStdDev+0.5)*thresholdFactor);
// Remove peaks with less than 3% of the intensity of the highest peak
return createSignals2D(PeakOptimizer.clean(peaksMC1, 0.03), spectraData, {
if (clean) {
// Remove peaks with less than x% of the intensity of the highest peak
peaksMC1 = PeakOptimizer.clean(peaksMC1, maxPercentCutOff);
}
signals = createSignals2D(peaksMC1, spectraData, {
tolerance: 24,

@@ -109,2 +121,4 @@ nucleusX,

}
return signals;
}

@@ -140,4 +154,5 @@

let dy = (lastY - firstY) / (spectraData.z[0].length - 1); //@TODO: check the dimensionality
let dx = (lastX - firstX) / (spectraData.z.length - 1);
let dy = (lastY - firstY) / (spectraData.z.length - 1); //@TODO: check the dimensionality
let dx = (lastX - firstX) / (spectraData.z[0].length - 1);
for (let i = peaks.length - 1; i >= 0; i--) {

@@ -144,0 +159,0 @@ peaks[i].x = firstX + dx * peaks[i].x;

Sorry, the diff of this file is too big to display

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