ml-spectra-processing
Advanced tools
Comparing version 6.1.3 to 6.2.0
# Changelog | ||
## [6.2.0](https://www.github.com/mljs/spectra-processing/compare/v6.1.3...v6.2.0) (2021-04-30) | ||
### Features | ||
* add absolute option in xHisotgram and matrixHistogram ([f3ea8a3](https://www.github.com/mljs/spectra-processing/commit/f3ea8a337d6464816bf9d764ca34ce10207c7a40)) | ||
* add matrixMinMaxAbsoluteZ ([0b30854](https://www.github.com/mljs/spectra-processing/commit/0b30854e6e5e35ca6ad1461777ff178568f1e0d6)) | ||
* add matrixMinMaxAbsoluteZ ([e8662e7](https://www.github.com/mljs/spectra-processing/commit/e8662e7c2502615e398969224230f2a8f0b8ba71)) | ||
* allow absolute in matrixHistogram ([f4e266c](https://www.github.com/mljs/spectra-processing/commit/f4e266cb327af3e8c1459f5b622a914d1ede9c2b)) | ||
### [6.1.3](https://www.github.com/mljs/spectra-processing/compare/v6.1.2...v6.1.3) (2021-04-29) | ||
@@ -4,0 +14,0 @@ |
{ | ||
"name": "ml-spectra-processing", | ||
"version": "6.1.3", | ||
"version": "6.2.0", | ||
"description": "Various method to process spectra", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -122,2 +122,3 @@ /** | ||
export * from './matrix/matrixMinMaxZ'; | ||
export * from './matrix/matrixMinMaxAbsoluteZ'; | ||
export * from './matrix/matrixPQN'; | ||
@@ -124,0 +125,0 @@ export * from './matrix/matrixZRescale'; |
import { xHistogram } from '../x/xHistogram'; | ||
import { matrixMinMaxAbsoluteZ } from './matrixMinMaxAbsoluteZ'; | ||
import { matrixMinMaxZ } from './matrixMinMaxZ'; | ||
/** | ||
import { matrixMinMaxZ } from './matrixMinMaxZ'; | ||
import { xHistogram } from '../x/xHistogram'; | ||
import { matrixMinMaxAbsoluteZ } from './matrixMinMaxAbsoluteZ'; | ||
* Calculates an histogram of defined number of slots | ||
@@ -14,2 +17,3 @@ * @param {Array<Array<Number>>} [matrix] - matrix [rows][cols]. | ||
* @param {number} [options.logBaseY] We can apply a log on the resulting histogra | ||
* @param {boolean} [options.absolute] Take the absolute value | ||
* @param {number} [options.centerX=true] Center the X value. We will enlarge the first and | ||
@@ -21,3 +25,3 @@ * @return {DataXY} {x,y} of the histogram | ||
export function matrixHistogram(matrix, options = {}) { | ||
const { logBaseY } = options; | ||
const { logBaseY, absolute } = options; | ||
options = JSON.parse(JSON.stringify(options)); | ||
@@ -32,3 +36,5 @@ delete options.logBaseY; | ||
if (options.min === undefined || options.max === undefined) { | ||
const minMax = matrixMinMaxZ(matrix); | ||
const minMax = absolute | ||
? matrixMinMaxAbsoluteZ(matrix) | ||
: matrixMinMaxZ(matrix); | ||
if (options.min === undefined) options.min = minMax.min; | ||
@@ -35,0 +41,0 @@ if (options.max === undefined) options.max = minMax.max; |
import fill from 'ml-array-sequential-fill'; | ||
import { xAbsolute } from './xAbsolute'; | ||
import { xCheck } from './xCheck'; | ||
@@ -15,3 +16,4 @@ import { xMaxValue } from './xMaxValue'; | ||
* @param {number} [options.logBaseY] We can apply a log on the resulting histogram | ||
* @param {number} [options.centerX=true] Center the X value. We will enlarge the first and | ||
* @param {boolean} [options.absolute] Take the absolute value | ||
* @param {number} [options.centerX=true] Center the X value. We will enlarge the first and last values. | ||
* @param {DataXY} [options.histogram={x:[], y:[]}] Previously existing histogram to continue to fill | ||
@@ -29,4 +31,9 @@ * @return {DataXY} {x,y} of the histogram | ||
logBaseY, | ||
absolute = false, | ||
} = options; | ||
if (absolute) { | ||
array = xAbsolute(array); | ||
} | ||
if (logBaseX) { | ||
@@ -33,0 +40,0 @@ array = array.slice(); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242456
101
6539