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

brukerconverter

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brukerconverter - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

bower.json
{
"name": "brukerconverter",
"version": "1.0.0",
"version": "1.0.1",
"main": "build/brukerconverter.js",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/cheminfo-js/brukerconverter",

{
"name": "brukerconverter",
"version": "1.0.0",
"version": "1.0.1",
"description": "Parse and convert Bruker raw data",

@@ -25,4 +25,4 @@ "main": "./src/brukerconverter.js",

"devDependencies": {
"mocha-better-spec-reporter": "^3.0.1",
"mocha": "^2.4.5",
"mocha-better-spec-reporter": "3.0.1",
"mocha": "2.4.5",
"should": "^8.2.2",

@@ -29,0 +29,0 @@ "cheminfo-tools": "1.3.4"

@@ -50,3 +50,5 @@ "use strict";

var brukerFiles = {};
if(name.indexOf("pdata")>=0){
brukerFiles['acqus'] = zip.file(name.replace(/pdata\/[0-9]\//,"acqus")).asText();
}
for(var j = 0; j < currFiles.length; ++j) {

@@ -117,5 +119,14 @@ var idx = currFiles[j].name.lastIndexOf('/');

function convert1D(files, options) {
var result = parseData(files["procs"], options);
var temp = parseData(files['acqus'], options);
var keys = Object.keys(temp.info);
for (var i = 0; i < keys.length; i++) {
var currKey = keys[i];
if(result.info[currKey] === undefined) {
result.info[currKey] = temp.info[currKey];
}
}
if(files['1r'] || files['1i']) {
var result = parseData(files["procs"], options);
if(files['1r']) {

@@ -128,3 +139,12 @@ setXYSpectrumData(files['1r'], result, '1r', true);

} else if(files['fid']) {
result = parseData(files['procs'], options);
setFIDSpectrumData(files['fid'], result)
}
return result;
}
function convert2D(files, options) {
var SF,SW_p,SW,offset;
if(files['2rr']) {
var result = parseData(files['procs'], options);
var temp = parseData(files['acqus'], options);

@@ -139,12 +159,4 @@

}
setFIDSpectrumData(files['fid'], result)
}
return result;
}
function convert2D(files, options) {
var SF,SW_p,offset;
if(files['2rr']) {
var result = parseData(files['procs'], options);
var temp = parseData(files['proc2s'], options);
temp = parseData(files['proc2s'], options);
result.info.nbSubSpectra = temp.info['$SI'] = parseInt(temp.info['$SI']);

@@ -160,7 +172,11 @@ SF = temp.info['$SF'] = parseFloat(temp.info['$SF']);

result.info['$SI'] = parseInt(result.info['$TD']);
SW_p = temp.info['$SWH'] = parseFloat(temp.info['$SWH']);
//SW_p = temp.info['$SWH'] = parseFloat(temp.info['$SWH']);
SW_p = temp.info["$SW"];
result.info["$SWP"]=result.info["$SWH"];
result.info["$SF"]=parseFloat(temp.info['$SFO1']);
result.info['$OFFSET']=0;
SF = temp.info['$SFO2'] = parseFloat(temp.info['$SFO2']);
SF = temp.info['$SFO1'] = parseFloat(temp.info['$SFO1']);
SF = 1;
offset=0;

@@ -183,3 +199,3 @@ result.info['$AXNUC']=result.info['$NUC1'];

} else if(files['ser']) {
setXYSpectrumData(files['ser'], result, 'ser', true);
setFIDSpectrumData(files['ser'], result, 'ser', true);
}

@@ -190,7 +206,2 @@

result.spectra[i].pageValue=pageValue;
if(files['2rr']) {
result.spectra[i].setYUnits = 'PPM';
} else if(files['ser']) {
result.spectra[i].setYUnits = 'HZ';
}
}

@@ -304,4 +315,2 @@

//console.log(DW+" "+SW+" "+td);
var endian = parseInt(spectra.info["$BYTORDP"]);

@@ -315,3 +324,6 @@ endian = endian ? 0 : 1;

for(var i = 0; i < 2; ++i) {
var nbSubSpectra = spectra.info.nbSubSpectra ? spectra.info.nbSubSpectra : 1;
spectra.spectra = new Array(nbSubSpectra);
for(var j = 0; j < nbSubSpectra/2; j++) {
var toSave = {

@@ -324,3 +336,3 @@ dataType : "NMR FID",

nucleus : spectra.info["$NUC1"] ? spectra.info["$NUC1"] : undefined,
xUnit : "Hz",
xUnit : "Sec",
yUnit : "Arbitrary",

@@ -333,33 +345,46 @@ data:[new Array(2*td)],//[{x:new Array(td),y:new Array(td)}],

};
spectra.spectra.push(toSave);
}
spectra.spectra[j*2] = toSave;
var x = 0;
toSave = {
dataType : "NMR FID",
dataTable : "(X++(I..I))",
nbPoints : td,
firstX : 0,
lastX : AQ,
nucleus : spectra.info["$NUC1"] ? spectra.info["$NUC1"] : undefined,
xUnit : "Sec",
yUnit : "Arbitrary",
data:[new Array(2*td)],//[{x:new Array(td),y:new Array(td)}],
isXYdata:true,
observeFrequency:SF,
title:spectra.info['TITLE'],
deltaX:DW
};
spectra.spectra[j*2+1] = toSave;
var x = 0;
var y;
for(var i = 0; file.available(8)&&i<td; i++, x = i*DW) {
y = file.readInt32();
if(y===null || isNaN(y)){
y=0;
}
spectra.spectra[j*2].data[0][2*i+1] = y;
spectra.spectra[j*2].data[0][2*i] = x;
y = file.readInt32();
if(y===null || isNaN(y)){
y=0;
}
spectra.spectra[j*2+1].data[0][2*i+1] = y;
spectra.spectra[j*2+1].data[0][2*i] = x;
var y;
for(i = 0; file.available(8); ++i, x += DW) {
y = file.readInt32();
if(y===null || isNaN(y)){
y=0;
}
spectra.spectra[0].data[0][2*i+1] = y;
spectra.spectra[0].data[0][2*i] = x;
y = file.readInt32();
if(y===null || isNaN(y)){
y=0;
for(; i < td; i++, x = i*DW) {
spectra.spectra[j*2].data[0][2*i+1] = 0;
spectra.spectra[j*2].data[0][2*i] = x;
spectra.spectra[j*2+1].data[0][2*i+1] = 0;
spectra.spectra[j*2+1].data[0][2*i] = x;
}
if(y===null || isNaN(y)){
y=0;
}
spectra.spectra[1].data[0][2*i+1] = y;
spectra.spectra[1].data[0][2*i] = x;
}
for(; i < td; ++i, x += DW) {
spectra.spectra[0].data[0][2*i+1] = 0;
spectra.spectra[0].data[0][2*i] = x;
spectra.spectra[1].data[0][2*i+1] = 0;
spectra.spectra[1].data[0][2*i] = x;
}
}

@@ -366,0 +391,0 @@

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