Skip to content

Commit

Permalink
fix: update jcampconverter (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
jobo322 authored Oct 21, 2024
1 parent 68eb98e commit d849523
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"dependencies": {
"cheminfo-types": "^1.7.2",
"file-collection": "^0.2.0",
"jcampconverter": "^9.6.2",
"ml-spectra-processing": "^14.2.1"
"ml-spectra-processing": "^14.2.1",
"jcampconverter": "^10.0.1"
}
}
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from 'path';
import { DataXY } from 'cheminfo-types';
import { FileCollection } from 'file-collection';
import { convert } from 'jcampconverter';
import { xySortX } from 'ml-spectra-processing';
import { xEnsureFloat64, xySortX } from 'ml-spectra-processing';

const path = join(__dirname, '../data/');

Expand Down Expand Up @@ -42,6 +42,9 @@ export async function getParsedFile(name: string): Promise<ConvertResult> {

export async function getXY(name: string): Promise<DataXY> {
const parsed = await getParsedFile(name);
const firstSpectrum = parsed.flatten[0]?.spectra[0]?.data;
return xySortX(firstSpectrum);
const { x, y } = parsed.flatten[0].spectra[0].data;
return xySortX({
x: xEnsureFloat64(x),
y: xEnsureFloat64(y),
});
}

0 comments on commit d849523

Please sign in to comment.