@openchemistry/utils
Advanced tools
Comparing version 0.1.0 to 0.3.0
@@ -6,4 +6,4 @@ # Change Log | ||
<a name="0.1.0"></a> | ||
# [0.1.0](https://github.com/OpenChemistry/oc-web-components/compare/@openchemistry/utils@0.0.2...@openchemistry/utils@0.1.0) (2018-07-25) | ||
<a name="0.3.0"></a> | ||
# [0.3.0](https://github.com/OpenChemistry/oc-web-components/compare/@openchemistry/utils@0.0.2...@openchemistry/utils@0.3.0) (2018-07-27) | ||
@@ -13,2 +13,3 @@ | ||
* **utils:** Export visiblityOptions and volumeOptions funcions ([0a61df5](https://github.com/OpenChemistry/oc-web-components/commit/0a61df5)) | ||
* **utils:** Scale colors between 0 and 1 instead of 0 and 255 ([f84ae11](https://github.com/OpenChemistry/oc-web-components/commit/f84ae11)) | ||
@@ -19,3 +20,5 @@ | ||
* **utils:** Add a few colormaps ([96c3f8c](https://github.com/OpenChemistry/oc-web-components/commit/96c3f8c)) | ||
* **utils:** Add default volume display options ([ec113ca](https://github.com/OpenChemistry/oc-web-components/commit/ec113ca)) | ||
* **utils:** Add function to bin values of array ([8b61db3](https://github.com/OpenChemistry/oc-web-components/commit/8b61db3)) | ||
* **utils:** Add helper functions for color conversion and array ordering ([2c7177d](https://github.com/OpenChemistry/oc-web-components/commit/2c7177d)) | ||
@@ -26,2 +29,22 @@ | ||
<a name="0.2.0"></a> | ||
# [0.2.0](https://github.com/OpenChemistry/oc-web-components/compare/@openchemistry/utils@0.0.2...@openchemistry/utils@0.2.0) (2018-07-27) | ||
### Bug Fixes | ||
* **utils:** Export visiblityOptions and volumeOptions funcions ([0a61df5](https://github.com/OpenChemistry/oc-web-components/commit/0a61df5)) | ||
* **utils:** Scale colors between 0 and 1 instead of 0 and 255 ([f84ae11](https://github.com/OpenChemistry/oc-web-components/commit/f84ae11)) | ||
### Features | ||
* **utils:** Add a few colormaps ([96c3f8c](https://github.com/OpenChemistry/oc-web-components/commit/96c3f8c)) | ||
* **utils:** Add default volume display options ([ec113ca](https://github.com/OpenChemistry/oc-web-components/commit/ec113ca)) | ||
* **utils:** Add function to bin values of array ([8b61db3](https://github.com/OpenChemistry/oc-web-components/commit/8b61db3)) | ||
* **utils:** Add helper functions for color conversion and array ordering ([2c7177d](https://github.com/OpenChemistry/oc-web-components/commit/2c7177d)) | ||
<a name="0.0.2"></a> | ||
@@ -28,0 +51,0 @@ ## [0.0.2](https://github.com/OpenChemistry/oc-web-components/compare/@openchemistry/utils@0.0.1...@openchemistry/utils@0.0.2) (2018-07-05) |
export declare function rowMaj2colMaj3d(scalars: number[], dims: [number, number, number]): Float32Array; | ||
export declare function makeBins(scalars: number[], nBins?: number, range?: number[] | undefined): number[]; |
@@ -12,1 +12,22 @@ export function rowMaj2colMaj3d(scalars, dims) { | ||
} | ||
export function makeBins(scalars, nBins, range) { | ||
if (nBins === void 0) { nBins = 50; } | ||
if (range === void 0) { range = undefined; } | ||
var h = []; | ||
for (var i = 0; i <= nBins; ++i) { | ||
h.push(0); | ||
} | ||
if (!range) { | ||
range = [0, 0]; | ||
range[0] = Math.min.apply(Math, scalars); | ||
range[1] = Math.max.apply(Math, scalars); | ||
} | ||
var delta = range[1] - range[0]; | ||
for (var i = 0; i < scalars.length; ++i) { | ||
var idx = Math.floor(nBins * (scalars[i] - range[0]) / delta); | ||
if (idx <= nBins && idx > 0) { | ||
h[idx]++; | ||
} | ||
} | ||
return h; | ||
} |
export declare function color2rgb(color: string): [number, number, number]; | ||
export declare const viridis: [number, number, number][]; | ||
export declare const plasma: [number, number, number][]; | ||
export declare const gray: [number, number, number][]; | ||
export declare const grayInv: [number, number, number][]; | ||
export declare const redYelBlu: [number, number, number][]; |
@@ -21,1 +21,52 @@ // import { isNil } from 'lodash-es'; | ||
} | ||
export var viridis = [ | ||
[0.267004, 0.004874, 0.329415], | ||
[0.282327, 0.094955, 0.417331], | ||
[0.278826, 0.17549, 0.483397], | ||
[0.258965, 0.251537, 0.524736], | ||
[0.229739, 0.322361, 0.545706], | ||
[0.19943, 0.387607, 0.554642], | ||
[0.172719, 0.448791, 0.557885], | ||
[0.149039, 0.508051, 0.55725], | ||
[0.127568, 0.566949, 0.550556], | ||
[0.120638, 0.625828, 0.533488], | ||
[0.157851, 0.683765, 0.501686], | ||
[0.24607, 0.73891, 0.452024], | ||
[0.369214, 0.788888, 0.382914], | ||
[0.515992, 0.831158, 0.294279], | ||
[0.678489, 0.863742, 0.189503], | ||
[0.845561, 0.887322, 0.099702], | ||
[0.993248, 0.906157, 0.143936] | ||
]; | ||
export var plasma = [ | ||
[0.050383, 0.029803, 0.527975], | ||
[0.193374, 0.018354, 0.59033], | ||
[0.299855, 0.009561, 0.631624], | ||
[0.399411, 0.000859, 0.656133], | ||
[0.494877, 0.01199, 0.657865], | ||
[0.584391, 0.068579, 0.632812], | ||
[0.665129, 0.138566, 0.585582], | ||
[0.736019, 0.209439, 0.527908], | ||
[0.798216, 0.280197, 0.469538], | ||
[0.853319, 0.351553, 0.413734], | ||
[0.901807, 0.425087, 0.359688], | ||
[0.942598, 0.502639, 0.305816], | ||
[0.973416, 0.585761, 0.25154], | ||
[0.991365, 0.675355, 0.198453], | ||
[0.993033, 0.77172, 0.154808], | ||
[0.974443, 0.874622, 0.144061], | ||
[0.940015, 0.975158, 0.131326] | ||
]; | ||
export var gray = [ | ||
[0, 0, 0], | ||
[1, 1, 1] | ||
]; | ||
export var grayInv = [ | ||
[1, 1, 1], | ||
[0, 0, 0] | ||
]; | ||
export var redYelBlu = [ | ||
[1, 0, 0], | ||
[1, 1, 0], | ||
[0, 0, 1] | ||
]; |
@@ -1,4 +0,4 @@ | ||
import { IDisplayOptions, IIsoSurfaceOptions, IStyleOptions, INormalModeOptions } from '@openchemistry/types'; | ||
import { IDisplayOptions, IIsoSurfaceOptions, IStyleOptions, INormalModeOptions, IVolumeOptions, IVisibilityOptions } from '@openchemistry/types'; | ||
export { defaultDisplayOptions, defaultStyleOptions, defaultIsoSurfaces, defaultNormalModeOptions }; | ||
export { composeDisplayOptions, composeStyleOptions, composeNormalModeOptions, composeIsoSurfaces }; | ||
export { composeDisplayOptions, composeStyleOptions, composeNormalModeOptions, composeIsoSurfaces, composeVolumeOptions, composeVisibilityOptions }; | ||
declare const defaultIsoSurfaces: IIsoSurfaceOptions[]; | ||
@@ -11,2 +11,4 @@ declare const defaultStyleOptions: IStyleOptions; | ||
declare function composeStyleOptions(styleOptions: IStyleOptions | undefined): IStyleOptions; | ||
declare function composeVolumeOptions(volumeOptions: IVolumeOptions | undefined): IVolumeOptions; | ||
declare function composeVisibilityOptions(visibilityOptions: IVisibilityOptions | undefined): IVisibilityOptions; | ||
declare function composeDisplayOptions(displayOptions: IDisplayOptions | undefined): IDisplayOptions; |
@@ -10,3 +10,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
export { defaultDisplayOptions, defaultStyleOptions, defaultIsoSurfaces, defaultNormalModeOptions }; | ||
export { composeDisplayOptions, composeStyleOptions, composeNormalModeOptions, composeIsoSurfaces }; | ||
export { composeDisplayOptions, composeStyleOptions, composeNormalModeOptions, composeIsoSurfaces, composeVolumeOptions, composeVisibilityOptions }; | ||
import { isUndefined } from "lodash-es"; | ||
@@ -13,0 +13,0 @@ var defaultIsoSurfaces = [ |
{ | ||
"name": "@openchemistry/utils", | ||
"version": "0.1.0", | ||
"version": "0.3.0", | ||
"description": "Utilities to validate and convert cjson chemical data", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@openchemistry/types": "^0.4.0", | ||
"@openchemistry/types": "^0.3.0", | ||
"@types/lodash-es": "^4.17.0", | ||
@@ -28,0 +28,0 @@ "typescript": "^2.9.2" |
@@ -12,1 +12,24 @@ export function rowMaj2colMaj3d(scalars: number[], dims: [number, number, number]) : Float32Array { | ||
} | ||
export function makeBins(scalars: number[], nBins = 50, range: number[] | undefined = undefined) { | ||
let h = []; | ||
for (let i = 0; i <= nBins; ++i) { | ||
h.push(0); | ||
} | ||
if (!range) { | ||
range = [0, 0]; | ||
range[0] = Math.min(...scalars); | ||
range[1] = Math.max(...scalars); | ||
} | ||
let delta = range[1] - range[0]; | ||
for (let i = 0; i < scalars.length; ++i) { | ||
let idx = Math.floor(nBins * (scalars[i] - range[0]) / delta); | ||
if (idx <= nBins && idx > 0) { | ||
h[idx]++; | ||
} | ||
} | ||
return h; | ||
} |
@@ -27,1 +27,60 @@ // import { isNil } from 'lodash-es'; | ||
} | ||
export const viridis : [number, number, number][] = [ | ||
[0.267004, 0.004874, 0.329415], | ||
[0.282327, 0.094955, 0.417331], | ||
[0.278826, 0.17549, 0.483397], | ||
[0.258965, 0.251537, 0.524736], | ||
[0.229739, 0.322361, 0.545706], | ||
[0.19943, 0.387607, 0.554642], | ||
[0.172719, 0.448791, 0.557885], | ||
[0.149039, 0.508051, 0.55725], | ||
[0.127568, 0.566949, 0.550556], | ||
[0.120638, 0.625828, 0.533488], | ||
[0.157851, 0.683765, 0.501686], | ||
[0.24607, 0.73891, 0.452024], | ||
[0.369214, 0.788888, 0.382914], | ||
[0.515992, 0.831158, 0.294279], | ||
[0.678489, 0.863742, 0.189503], | ||
[0.845561, 0.887322, 0.099702], | ||
[0.993248, 0.906157, 0.143936] | ||
]; | ||
export const plasma : [number, number, number][] = [ | ||
[0.050383, 0.029803, 0.527975], | ||
[0.193374, 0.018354, 0.59033], | ||
[0.299855, 0.009561, 0.631624], | ||
[0.399411, 0.000859, 0.656133], | ||
[0.494877, 0.01199, 0.657865], | ||
[0.584391, 0.068579, 0.632812], | ||
[0.665129, 0.138566, 0.585582], | ||
[0.736019, 0.209439, 0.527908], | ||
[0.798216, 0.280197, 0.469538], | ||
[0.853319, 0.351553, 0.413734], | ||
[0.901807, 0.425087, 0.359688], | ||
[0.942598, 0.502639, 0.305816], | ||
[0.973416, 0.585761, 0.25154], | ||
[0.991365, 0.675355, 0.198453], | ||
[0.993033, 0.77172, 0.154808], | ||
[0.974443, 0.874622, 0.144061], | ||
[0.940015, 0.975158, 0.131326] | ||
]; | ||
export const gray : [number, number, number][] = [ | ||
[0, 0, 0], | ||
[1, 1, 1] | ||
]; | ||
export const grayInv : [number, number, number][] = [ | ||
[1, 1, 1], | ||
[0, 0, 0] | ||
]; | ||
export const redYelBlu : [number, number, number][] = [ | ||
[1, 0, 0], | ||
[1, 1, 0], | ||
[0, 0, 1] | ||
]; | ||
import { IDisplayOptions, IIsoSurfaceOptions, IStyleOptions, INormalModeOptions, IVolumeOptions, IVisibilityOptions } from '@openchemistry/types'; | ||
export { defaultDisplayOptions, defaultStyleOptions, defaultIsoSurfaces, defaultNormalModeOptions }; | ||
export { composeDisplayOptions, composeStyleOptions, composeNormalModeOptions, composeIsoSurfaces}; | ||
export { composeDisplayOptions, composeStyleOptions, composeNormalModeOptions, composeIsoSurfaces, composeVolumeOptions, composeVisibilityOptions}; | ||
@@ -6,0 +6,0 @@ import { isUndefined } from "lodash-es"; |
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
34676
842