Skip to content

Commit

Permalink
add name in serie
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Sep 5, 2018
1 parent f6fe004 commit ce16480
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/Chromatogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class Chromatogram {
throw new Error('The array size is not the same as the time size');
}
this.series[name] = serieFromArray(array);
this.series[name].name = name;
}

/**
Expand Down Expand Up @@ -230,6 +231,7 @@ export class Chromatogram {
* @param {boolean} [options.cache = false] - Retrieve from cache if exists
* @param {boolean} [options.force = false] - Force replacement of existing serie
* @param {number} [options.error=0.5] - Allowed error around the targetMass
* @return {Serie}
*/
calculateForMass(targetMass, options = {}) {
const {
Expand All @@ -251,6 +253,7 @@ export class Chromatogram {
* @param {boolean} [options.cache = false] - Retrieve from cache if exists
* @param {number} [options.error=0.5] - Allowed error around the targetMass
* @param {number} [options.ionizations='H+'] - List of allowed ionisation
* @return {Serie}
*/
calculateForMF(targetMF, options = {}) {
const {
Expand Down
11 changes: 5 additions & 6 deletions src/Serie.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
*/
export class Serie {
constructor(array, dimension, options = {}) {
let {
meta = {}
} = options;
let { meta = {} } = options;
if (new.target === Serie) {
throw new Error('You need to create either a 1D or 2D serie');
}
this.data = array;
this.dimension = dimension;
this.meta = meta;
this.name = '';
}

is1D() {
Expand All @@ -30,9 +29,9 @@ export class Serie {
}

/**
* Specify an array of index to keep
* @param {Array} array
*/
* Specify an array of index to keep
* @param {Array} array
*/
keep(array) {
let newData = [];
for (let i of array) {
Expand Down

0 comments on commit ce16480

Please sign in to comment.