jcampconverter
Advanced tools
Comparing version 2.0.4 to 2.0.5
{ | ||
"name": "jcampconverter", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "dist/jcampconverter.js", |
{ | ||
"name": "jcampconverter", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Parse and convert JCAMP data", | ||
@@ -33,2 +33,3 @@ "main": "./src/index.js", | ||
"devDependencies": { | ||
"benchmark": "^1.0.0", | ||
"browserify": "^8.1.3", | ||
@@ -44,6 +45,6 @@ "del": "^1.1.1", | ||
"should": "latest", | ||
"v8-profiler": "^5.2.3", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.0.0", | ||
"benchmark": "^1.0.0" | ||
"vinyl-source-stream": "^1.0.0" | ||
} | ||
} |
# JCAMP converter | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![David deps][david-image]][david-url] | ||
[![npm download][download-image]][download-url] | ||
Parse and convert JCAMP data | ||
## Installation | ||
### Node JS | ||
``` | ||
npm install jcampconverter | ||
``` | ||
`npm install jcampconverter` | ||
### Bower | ||
``` | ||
bower install jcampconverter | ||
``` | ||
`bower install jcampconverter` | ||
## Methods | ||
@@ -30,2 +35,3 @@ | ||
* keepSpectra - Generate array for 2D NMR spectra (default: false) | ||
* keepRecordsRegExp - regexp to select which records should be placed in the info field. By default: :/^[A-Za-z]+$/} | ||
@@ -58,2 +64,3 @@ ### Use as a module | ||
npm install | ||
npm test | ||
npm run build | ||
@@ -70,3 +77,3 @@ ``` | ||
MIT | ||
[MIT](./LICENSE) | ||
@@ -77,1 +84,5 @@ [npm-image]: https://img.shields.io/npm/v/jcampconverter.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/cheminfo/jcampconverter | ||
[david-image]: https://img.shields.io/david/cheminfo/jcampconverter.svg?style=flat-square | ||
[david-url]: https://david-dm.org/cheminfo/jcampconverter | ||
[download-image]: https://img.shields.io/npm/dm/jcampconverter.svg?style=flat-square | ||
[download-url]: https://npmjs.org/package/jcampconverter |
@@ -28,2 +28,6 @@ 'use strict'; | ||
options = options || {}; | ||
var keepRecordsRegExp=/^[A-Z]+$/; | ||
if (options.keepRecordsRegExp) keepRecordsRegExp=options.keepRecordsRegExp; | ||
var start = new Date(); | ||
@@ -222,3 +226,3 @@ | ||
spectrum[convertMSFieldToLabel(dataLabel)] = dataValue; | ||
} else if (dataLabel.match(/^[A-Z].*/)) { | ||
} else if (dataLabel.match(keepRecordsRegExp)) { | ||
result.info[dataLabel] = dataValue.trim(); | ||
@@ -470,11 +474,10 @@ } | ||
function convertTo3DZ(spectra) { | ||
//console.time('ConvertTo3DZ'); | ||
var z = []; | ||
var noise = 0; | ||
var minZ = spectra[0].data[0][0]; | ||
var maxZ = spectra[0].data[0][0]; | ||
var maxZ = minZ; | ||
var ySize = spectra.length; | ||
var xSize = spectra[0].data[0].length / 2; | ||
var z = new Array(ySize); | ||
for (var i = 0; i < ySize; i++) { | ||
z[i] = []; | ||
z[i] = new Array(xSize); | ||
for (var j = 0; j < xSize; j++) { | ||
@@ -489,3 +492,2 @@ z[i][j] = spectra[i].data[0][j * 2 + 1]; | ||
} | ||
//console.timeEnd('ConvertTo3DZ'); | ||
return { | ||
@@ -496,6 +498,6 @@ z: z, | ||
minY: spectra[0].pageValue, | ||
maxY: spectra[spectra.length - 1].pageValue, | ||
maxY: spectra[ySize - 1].pageValue, | ||
minZ: minZ, | ||
maxZ: maxZ, | ||
noise: noise / ((z.length - 1) * (z[0].length - 1) * 2) | ||
noise: noise / ((ySize - 1) * (xSize - 1) * 2) | ||
}; | ||
@@ -502,0 +504,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
37715
85
0
14