multiplet-analysis
Advanced tools
Comparing version 0.0.0 to 0.0.2
@@ -263,5 +263,17 @@ 'use strict'; | ||
} | ||
// end refine | ||
// end refine | ||
if (topValue > critFoundJ) { | ||
// ugly force value for tests | ||
if ( | ||
forceFirstDeconvolutionToThisValue > 0 && | ||
loopoverJvalues === 1 && | ||
gotJValue === false | ||
) { | ||
topPosJ = Math.floor( | ||
forceFirstDeconvolutionToThisValue / resolutionHz, | ||
); | ||
topValue = 1.1; | ||
} | ||
if (debug) console.log(`J:: ${topPosJ * resolutionHz}`); | ||
@@ -435,15 +447,22 @@ | ||
// prepare input for fft apply fftshift | ||
let an = [...Array(y.length)].map((x) => Array(2).fill(0)); // n x 2 array | ||
let halfNumPt = y.length / 2; | ||
let nextPowerTwoAn = Math.pow( | ||
2, | ||
Math.round(Math.log(y.length - 1) / Math.log(2.0) + 0.5), | ||
); | ||
let an = [...Array(nextPowerTwoAn)].map(() => Array(2).fill(0)); // n x 2 array | ||
const halfNumPt = y.length / 2; | ||
const shiftMult = Math.floor((nextPowerTwoAn - y.length) / 2.0); | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
an[loop + halfNumPt][0] = y[loop]; //Re | ||
an[loop + halfNumPt][1] = 0; //Im | ||
an[2 * shiftMult + loop + halfNumPt][0] = y[loop]; //Re | ||
an[2 * shiftMult + loop + halfNumPt][1] = 0; //Im | ||
an[loop][0] = y[loop + halfNumPt]; //Re | ||
an[loop][1] = 0; //Im | ||
} | ||
let out = fftJs.ifft(an); | ||
out[0][0] = out[0][0] / 2; // divide first point by 2 Re | ||
out[0][1] = out[0][1] / 2; // divide first point by 2 Im | ||
// move to larger array... | ||
let an2 = [...Array(nextPowerTwo)].map((x) => Array(2).fill(0)); // n x 2 array | ||
let an2 = [...Array(nextPowerTwo)].map(() => Array(2).fill(0)); // n x 2 array | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
@@ -460,14 +479,14 @@ an2[loop][0] = out[loop][0]; //* Math.cos((phase / 180) * Math.PI) + | ||
let out2 = fftJs.fft(an2); | ||
halfNumPt = nextPowerTwo / 2; | ||
const halfNumPt2 = nextPowerTwo / 2; | ||
// applies fftshift | ||
let phase = addPhaseInterpolation; | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
//spe[loop] = out2[loop + halfNumPt][0]; // only Re now... | ||
for (let loop = 0; loop < halfNumPt2; loop++) { | ||
//spe[loop] = out2[loop + halfNumPt2][0]; // only Re now... | ||
spe[loop] = | ||
out2[loop + halfNumPt][0] * Math.cos((phase / 180) * Math.PI) + | ||
out2[loop + halfNumPt][1] * Math.sin((phase / 180) * Math.PI); // only Re now... | ||
out2[loop + halfNumPt2][0] * Math.cos((phase / 180) * Math.PI) + | ||
out2[loop + halfNumPt2][1] * Math.sin((phase / 180) * Math.PI); // only Re now... | ||
} | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
//spe[loop + halfNumPt] = out2[loop][0]; // only Re now... | ||
spe[loop + halfNumPt] = | ||
for (let loop = 0; loop < halfNumPt2; loop++) { | ||
//spe[loop + halfNumPt2] = out2[loop][0]; // only Re now... | ||
spe[loop + halfNumPt2] = | ||
out2[loop][0] * Math.cos((phase / 180) * Math.PI) + | ||
@@ -474,0 +493,0 @@ out2[loop][1] * Math.sin((phase / 180) * Math.PI); // only Re now... |
110
package.json
{ | ||
"name": "multiplet-analysis", | ||
"version": "0.0.0", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"eslint": "eslint src", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepublishOnly": "rollup -c", | ||
"test": "npm run test-coverage && npm run eslint", | ||
"test-coverage": "jest --coverage", | ||
"test-only": "jest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cheminfo/multiplet-analysis.git" | ||
}, | ||
"keywords": [], | ||
"author": "Luc Patiny", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/cheminfo/multiplet-analysis/issues" | ||
}, | ||
"homepage": "https://github.com/cheminfo/multiplet-analysis#readme", | ||
"jest": { | ||
"testEnvironment": "node" | ||
}, | ||
"prettier": { | ||
"arrowParens": "always", | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.7.5", | ||
"eslint": "^6.8.0", | ||
"eslint-config-cheminfo": "^2.0.4", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-plugin-jest": "^23.4.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"esm": "^3.2.25", | ||
"jest": "^24.9.0", | ||
"nmr-simulation": "^1.0.19", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.29.0" | ||
}, | ||
"dependencies": { | ||
"fft-js": "0.0.12", | ||
"ml-fft": "^1.3.5" | ||
} | ||
"name": "multiplet-analysis", | ||
"version": "0.0.2", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"eslint": "eslint src", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepublishOnly": "rollup -c", | ||
"test": "npm run test-coverage && npm run eslint", | ||
"test-coverage": "jest --coverage", | ||
"test-only": "jest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cheminfo/multiplet-analysis.git" | ||
}, | ||
"keywords": [], | ||
"author": "Luc Patiny", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/cheminfo/multiplet-analysis/issues" | ||
}, | ||
"homepage": "https://github.com/cheminfo/multiplet-analysis#readme", | ||
"jest": { | ||
"testEnvironment": "node" | ||
}, | ||
"prettier": { | ||
"arrowParens": "always", | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.7.5", | ||
"eslint": "^6.8.0", | ||
"eslint-config-cheminfo": "^2.0.4", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-plugin-jest": "^23.4.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"esm": "^3.2.25", | ||
"jest": "^24.9.0", | ||
"nmr-simulation": "^1.0.19", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.29.0" | ||
}, | ||
"dependencies": { | ||
"fft-js": "0.0.12", | ||
"ml-fft": "^1.3.5" | ||
} | ||
} |
@@ -212,5 +212,17 @@ /** | ||
} | ||
// end refine | ||
// end refine | ||
if (topValue > critFoundJ) { | ||
// ugly force value for tests | ||
if ( | ||
forceFirstDeconvolutionToThisValue > 0 && | ||
loopoverJvalues === 1 && | ||
gotJValue === false | ||
) { | ||
topPosJ = Math.floor( | ||
forceFirstDeconvolutionToThisValue / resolutionHz, | ||
); | ||
topValue = 1.1; | ||
} | ||
if (debug) console.log(`J:: ${topPosJ * resolutionHz}`); | ||
@@ -384,15 +396,22 @@ | ||
// prepare input for fft apply fftshift | ||
let an = [...Array(y.length)].map((x) => Array(2).fill(0)); // n x 2 array | ||
let halfNumPt = y.length / 2; | ||
let nextPowerTwoAn = Math.pow( | ||
2, | ||
Math.round(Math.log(y.length - 1) / Math.log(2.0) + 0.5), | ||
); | ||
let an = [...Array(nextPowerTwoAn)].map(() => Array(2).fill(0)); // n x 2 array | ||
const halfNumPt = y.length / 2; | ||
const shiftMult = Math.floor((nextPowerTwoAn - y.length) / 2.0); | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
an[loop + halfNumPt][0] = y[loop]; //Re | ||
an[loop + halfNumPt][1] = 0; //Im | ||
an[2 * shiftMult + loop + halfNumPt][0] = y[loop]; //Re | ||
an[2 * shiftMult + loop + halfNumPt][1] = 0; //Im | ||
an[loop][0] = y[loop + halfNumPt]; //Re | ||
an[loop][1] = 0; //Im | ||
} | ||
let out = ifft(an); | ||
out[0][0] = out[0][0] / 2; // divide first point by 2 Re | ||
out[0][1] = out[0][1] / 2; // divide first point by 2 Im | ||
// move to larger array... | ||
let an2 = [...Array(nextPowerTwo)].map((x) => Array(2).fill(0)); // n x 2 array | ||
let an2 = [...Array(nextPowerTwo)].map(() => Array(2).fill(0)); // n x 2 array | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
@@ -409,14 +428,14 @@ an2[loop][0] = out[loop][0]; //* Math.cos((phase / 180) * Math.PI) + | ||
let out2 = fft(an2); | ||
halfNumPt = nextPowerTwo / 2; | ||
const halfNumPt2 = nextPowerTwo / 2; | ||
// applies fftshift | ||
let phase = addPhaseInterpolation; | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
//spe[loop] = out2[loop + halfNumPt][0]; // only Re now... | ||
for (let loop = 0; loop < halfNumPt2; loop++) { | ||
//spe[loop] = out2[loop + halfNumPt2][0]; // only Re now... | ||
spe[loop] = | ||
out2[loop + halfNumPt][0] * Math.cos((phase / 180) * Math.PI) + | ||
out2[loop + halfNumPt][1] * Math.sin((phase / 180) * Math.PI); // only Re now... | ||
out2[loop + halfNumPt2][0] * Math.cos((phase / 180) * Math.PI) + | ||
out2[loop + halfNumPt2][1] * Math.sin((phase / 180) * Math.PI); // only Re now... | ||
} | ||
for (let loop = 0; loop < halfNumPt; loop++) { | ||
//spe[loop + halfNumPt] = out2[loop][0]; // only Re now... | ||
spe[loop + halfNumPt] = | ||
for (let loop = 0; loop < halfNumPt2; loop++) { | ||
//spe[loop + halfNumPt2] = out2[loop][0]; // only Re now... | ||
spe[loop + halfNumPt2] = | ||
out2[loop][0] * Math.cos((phase / 180) * Math.PI) + | ||
@@ -423,0 +442,0 @@ out2[loop][1] * Math.sin((phase / 180) * Math.PI); // only Re now... |
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
46627
8
1282