Add a spectrum based on the data

addFromData(data: object, options: object): Spectrum
Parameters
data (object) {x, y}}
options (object = {})
Name Description
options.meta object (default {})
options.id object?
options.normalization object (default {})
options.normalized object?
Returns
Spectrum:

Add jcamp By default TITLE from the jcamp will be in the meta information

addFromJcamp(jcamp: string, options: object)
Parameters
jcamp (string)
options (object = {})
Name Description
options.meta object (default {})
options.meta.color string?
options.id object (default {})
options.force boolean (default false) replace existing spectrum (same ID)

Add from text By default TITLE from the jcamp will be in the meta information

addFromText(text: string, options: object)
Parameters
text (string)
options (object = {})
Name Description
options.parserOptions object (default {}) XY parser options
options.meta object (default {})
options.meta.color string?
options.id object (default {})
options.kind object?
options.force boolean (default false) replace existing spectrum (same ID)

Manager a large number of spectra with the possibility to normalize the data and skip the original data.

constructor(options: object)
Parameters
options (object = {})
Name Description
options.maxMemory boolean (default 64M)
options.normalization object (default {}) options to normalize the spectra before comparison
options.normalization.from number?
options.normalization.to number?
options.normalization.numberOfPoints number?
options.normalization.filters array<object>?
options.normalization.exclusions array<object>?

Checks if the ID of a spectrum exists in the SpectraProcessor

contains(id: string)
Parameters
id (string)

getAutocorrelation

src/SpectraProcessor.js

Returns an object {x:[], y:[]} containing the autocorrelation for the specified index

getAutocorrelation(index: any, options: object, integer: any)
Parameters
index (any)
options (object = {})
Name Description
options.ids array (default []) list of ids, by default all spectra
options.x array? x value if index is undefined
integer (any) |undefined] x index of the spectrum to autocorrelate

getAutocorrelationChart

src/SpectraProcessor.js

Returns a JSGraph chart object for all the spectra

getAutocorrelationChart(index: any, options: object): object
Parameters
index (any)
options (object = {})
Name Description
options.ids Array? ids of the spectra to select, by default all
Returns
object:

Returns a JSGraph annotation object for box plot

getBoxPlotChart(options: object): object
Parameters
options (object = {})
Name Description
options.ids array (default []) list of ids, by default all spectra
Returns
object:

Returns boxplot information

getBoxPlotData(options: object): object
Parameters
options (object = {})
Name Description
options.ids array (default []) list of ids, by default all spectra
Returns
object:

getCategoriesStats

src/SpectraProcessor.js
getCategoriesStats(options: object)
Parameters
options (object = {})
Name Description
options.propertyName string (default "category")

Returns a JSGraph chart object for all the spectra

getChart(options: any): object
Parameters
options (any)
Returns
object:
getClasses(options: object)
Parameters
options (object = {})
Name Description
options.ids Array? ids of the spectra to select, by default all
options.propertyName string (default "category")
getClassLabels(options: object)
Parameters
options (object = {})
Name Description
options.ids Array? ids of the spectra to select, by default all
options.propertyName string (default "category")

Returns an array of all the ids

getIDs(): array
Returns
array:

Returns a {x:[], y:[]} containg the average of specified spectra

getMeanData(options: object)
Parameters
options (object = {})
Name Description
options.ids array (default []) list of ids, by default all spectra

Returns the metadata for a set of spectra

getMetadata(options: object): object
Parameters
options (object = {})
Name Description
options.ids Array? ids of the spectra to select, by default all
Returns
object:

getNormalizedChart

src/SpectraProcessor.js

Returns a JSGraph chart object for all the normalized spectra

getNormalizedChart(options: object): object
Parameters
options (object = {})
Name Description
options.ids Array? ids of the spectra to select, by default all
options.xFilter object (default {})
options.xFilter.from array?
options.xFilter.to array?
options.xFilter.exclusions array (default [])
Returns
object:

getNormalizedCommonBoundary

src/SpectraProcessor.js

We provide the allowed from / to after normalization For the X axis we return the smallest common values For the Y axis we return the largest min / max

getNormalizedCommonBoundary()

getNormalizedData

src/SpectraProcessor.js

Returns an object contains 4 parameters with the normalized data

getNormalizedData(options: object): object
Parameters
options (object = {})
Name Description
options.ids Array? List of spectra ids to export, by default all
Returns
object: { ids:[], matrix:[Array], meta:[object], x:[] }

getNormalizedText

src/SpectraProcessor.js

Returns a tab separated value containing the normalized data

getNormalizedText(options: object): string
Parameters
options (object = {})
Name Description
options.ids Array? List of spectra ids to export, by default all
options.fs string (default '\t') field separator
options.rs string (default '\n') record (line) separator
Returns
string:

getPostProcessedChart

src/SpectraProcessor.js

Returns a JSGraph chart object for all the scaled normalized spectra

getPostProcessedChart(options: object): object
Parameters
options (object = {})
Name Description
options.ids Array? ids of the spectra to select, by default all
options.range object? from - to
options.targetID string (default spectra[0].id)
options.method string (default 'max') min, max, range, minMax
options.relative boolean (default false)
Returns
object:

getPostProcessedData

src/SpectraProcessor.js

Returns an object contains 4 parameters with the scaled data

getPostProcessedData(options: object): object
Parameters
options (object = {}) scale spectra based on various parameters
Name Description
options.range object? from - to
options.ids Array? ids of selected spectra, by default all
options.targetID string (default spectra[0].id)
options.method string (default 'max') min, max, range, minMax
options.relative boolean (default false)
Returns
object: { ids:[], matrix:[Array], meta:[object], x:[] }

getPostProcessedText

src/SpectraProcessor.js

Returns a tab separated value containing the post processed data

getPostProcessedText(options: object, postProcessing: object): string
Parameters
options (object = {})
Name Description
options.ids Array? List of spectra ids to export, by default all
options.fs string (default '\t') field separator
options.rs string (default '\n') record (line) separator
postProcessing (object = {})
Returns
string:

Returns an array of spectrum from their ids

getSpectra(ids: Array)
Parameters
ids (Array)

Returns the index of the spectrum in the spectra array

getSpectrum(id: string): number
Parameters
id (string)
Returns
number:

getSpectrumIndex

src/SpectraProcessor.js

Returns the index of the spectrum in the spectra array

getSpectrumIndex(id: string): number
Parameters
id (string)
Returns
number:

getTrackAnnotation

src/SpectraProcessor.js

Returns a JSGraph annotation object for the specified index

getTrackAnnotation(index: any, options: object): object
Parameters
index (any)
options (object = {})
Name Description
options.ids array (default [])
options.showSpectrumID array (default true)
options.sortY array (default true)
options.limit object (default 20) ids, showSpectrumID = true, sort = true, limit = 20
Returns
object:

removeSpectraNotIn

src/SpectraProcessor.js

Remove all the spectra not present in the list

removeSpectraNotIn(ids: Array?)
Parameters
ids (Array?) Array of ids of the spectra to keep

Remove the spectrum from the SpectraProcessor for the specified id

removeSpectrum(id: string)
Parameters
id (string)

setNormalization

src/SpectraProcessor.js

Recalculate the normalized data using the stored original data if available This will throw an error in the original data is not present

setNormalization(normalization: any)
Parameters
normalization (any = {})

fromNormalizedMatrix

src/SpectraProcessor.js

Create SpectraProcessor from normalized TSV

fromNormalizedMatrix(text: string, options: object)
Parameters
text (string)
options (object = {})
Name Description
options.separator object (default '\t')

Allows to calculate relative intensity between normalized spectra

cache
Parameters
spectraProcessor (SpectraProcessor)
options (object = {}) scale spectra based on various parameters
Name Description
options.ids Array? ids of selected spectra
options.filters Array (default []) Array of object containing {name:'', options:''}
options.scale object (default {}) object containing the options for rescaling
options.scale.targetID string (default spectra[0].id)
options.scale.method string (default 'max') min, max, integration, minMax
options.scale.range Array? from - to to apply the method and rescale
options.scale.relative boolean (default false)
options.ranges Array? Array of object containing {from:'', to:'', label:''}
options.calculations Array? Array of object containing {label:'', formula:''}
Returns
object: { ids:[], matrix:[Array], meta:[object], x:[], ranges:[object] }

Retrieve a chart with autocorrelation color

getAutocorrelationChart(spectraProcessor: SpectraProcessor?, index: number?, options: object)
Parameters
spectraProcessor (SpectraProcessor?)
index (number?)
options (object = {})
Name Description
options.autocorrelation Array? precalculated autocorrelation {x,y}
options.maxDataPoints Array?
options.ids Array? ids of the spectra to select, by default all
options.xFilter object (default {})
options.xFilter.from number?
options.xFilter.to number?
options.xFilter.exclusions array (default [])

Retrieve a chart with selected original data

getChart(spectra: any, options: object)
Parameters
spectra (any)
options (object = {})
Name Description
options.ids Array? List of spectra ids, by default all
options.yFactor Array (default 1)
getNormalizedChart(spectra: Array<Spectrum>, options: object)
Parameters
spectra (Array<Spectrum>)
options (object = {})
Name Description
options.xFilter object (default {})
options.xFilter.from number?
options.xFilter.to number?
options.xFilter.exclusions array (default [])
getPostProcessedChart(spectraProcessor: SpectraProcessor, options: object)
Parameters
spectraProcessor (SpectraProcessor)
options (object = {}) scale spectra based on various parameters
Name Description
options.ids Array? ids of selected spectra
options.filters Array (default []) Array of object containing {name:'', options:''}
options.scale object (default {}) object containing the options for rescaling
options.scale.targetID string (default spectra[0].id)
options.scale.method string (default 'max') min, max, integration, minMax
options.scale.range Array? from - to to apply the method and rescale
options.scale.relative boolean (default false)

Create a spectrum from a jcamp

jcamp(jcampText: string): Spectrum
Parameters
jcampText (string) String containing the JCAMP data
Returns
Spectrum: new instance of Spectrum with the provided data

Creates a g

matrix(text: string, options: object): object
Parameters
text (string) String containing the text data
options (object = {})
Name Description
options.fs string (default '\t') Field separator
Returns
object: {matrix, data, x, ids}

could implement a cache if all the options are identical and the normalized data is identical as well in order ot check if the normalized data are identical we should check if the normalized array of all the spectra are identical Because we don't make in-place modification when creating normalized array we can check if the 'pointer' to the object is identical

optionsHash

Class allowing manipulate one IR spectrum

new spectrum(json: object)
Parameters
json (object = {}) object containing a spectrum
Name Description
json.x Array (default []) x values
json.y Array (default []) y values

Create a spectrum from a text file

text(value: string, options: any): Spectrum
Parameters
value (string) String containing the JCAMP data
options (any = {})
Returns
Spectrum: new instance of Spectrum with the provided data