Skip to content

Commit

Permalink
feat!: rename xyXShift to xyCalibrate
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Jan 19, 2021
1 parent 0765848 commit eb04e3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export * from './xy/xyReduce';
export * from './xy/xyRolling';
export * from './xy/xyToXYObject';
export * from './xy/xyToXYArray';
export * from './xy/xyXShift';
export * from './xy/xyCalibrate';
export * from './xy/xyUniqueX';
export * from './xy/xySortX';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { xyXShift } from '../xyXShift.js';
import { xyCalibrate } from '../xyCalibrate.js';

describe('xyXShift', function () {
describe('xyCalibrate', function () {
it('undefined params', () => {
let data = {
x: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
y: [1, 1, 5, 1, 1, 1, 700, 1, 1, 1, 1, 1, 1],
};

let xShift = xyXShift(data);
let xShift = xyCalibrate(data);

expect(xShift).toBe(0);
});
Expand All @@ -18,7 +18,7 @@ describe('xyXShift', function () {
y: [1, 1, 5, 1],
};

expect(() => xyXShift(data, { from: 1, to: 10 })).toThrow(
expect(() => xyCalibrate(data, { from: 1, to: 10 })).toThrow(
'Window size is higher than the data lengt',
);
});
Expand All @@ -39,7 +39,7 @@ describe('xyXShift', function () {
},
};

let xShift = xyXShift(
let xShift = xyCalibrate(
data,
{ from: 1, to: 10 },
{
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('xyXShift', function () {
},
};

let xShift = xyXShift(
let xShift = xyCalibrate(
data,
{ from: 1, to: 10 },
{
Expand Down
4 changes: 2 additions & 2 deletions src/xy/xyXShift.js → src/xy/xyCalibrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { gsd } from 'ml-gsd';
import { xFindClosestIndex } from '../x/xFindClosestIndex';

/**
* Aligns the data based on a range and means of peaks in this range
* Calibrates the data based on a range and means of peaks in this range
* Based on a range we will make a peak picking using global spectra deconvolution
* The selected nbPeaks will then be taken into account to calculate an average X value.
* The difference between the targetX and the averageX value will be returned
Expand All @@ -20,7 +20,7 @@ import { xFindClosestIndex } from '../x/xFindClosestIndex';
* @returns {number} difference between targetX and currentX
*/

export function xyXShift(data, range = {}, options = {}) {
export function xyCalibrate(data, range = {}, options = {}) {
const {
targetX = 0,
nbPeaks = 1,
Expand Down

0 comments on commit eb04e3d

Please sign in to comment.