react-cheminfo 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/analysisSpectra.d.ts +23 -6
- package/lib/ir/core/analysisSpectra.d.ts.map +1 -1
- package/lib/ir/core/analysisSpectra.js.map +1 -1
- package/lib/ir/core/bandLabelPlan.d.ts.map +1 -1
- package/lib/ir/core/bandLabelPlan.js +11 -6
- package/lib/ir/core/bandLabelPlan.js.map +1 -1
- package/lib/ir/core/index.d.ts +13 -9
- package/lib/ir/core/index.d.ts.map +1 -1
- package/lib/ir/core/index.js +9 -6
- package/lib/ir/core/index.js.map +1 -1
- package/lib/ir/core/irBand.d.ts +45 -14
- package/lib/ir/core/irBand.d.ts.map +1 -1
- package/lib/ir/core/irBand.js +28 -6
- package/lib/ir/core/irBand.js.map +1 -1
- package/lib/ir/core/irCommands.d.ts +11 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -1
- package/lib/ir/core/irCommands.js +11 -1
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/core/irDomain.d.ts +4 -3
- package/lib/ir/core/irDomain.d.ts.map +1 -1
- package/lib/ir/core/irDomain.js +10 -7
- package/lib/ir/core/irDomain.js.map +1 -1
- package/lib/ir/core/irFormat.d.ts +14 -2
- package/lib/ir/core/irFormat.d.ts.map +1 -1
- package/lib/ir/core/irFormat.js +33 -4
- package/lib/ir/core/irFormat.js.map +1 -1
- package/lib/ir/core/irMode.d.ts +35 -8
- package/lib/ir/core/irMode.d.ts.map +1 -1
- package/lib/ir/core/irMode.js +38 -10
- package/lib/ir/core/irMode.js.map +1 -1
- package/lib/ir/core/irReducer.d.ts +0 -28
- package/lib/ir/core/irReducer.d.ts.map +1 -1
- package/lib/ir/core/irReducer.js +1 -24
- package/lib/ir/core/irReducer.js.map +1 -1
- package/lib/ir/core/irSpectrum.d.ts +52 -26
- package/lib/ir/core/irSpectrum.d.ts.map +1 -1
- package/lib/ir/core/irSpectrum.js +21 -15
- package/lib/ir/core/irSpectrum.js.map +1 -1
- package/lib/ir/core/irState.d.ts +40 -2
- package/lib/ir/core/irState.d.ts.map +1 -1
- package/lib/ir/core/irState.js +38 -1
- package/lib/ir/core/irState.js.map +1 -1
- package/lib/ir/core/irTechnique.d.ts +94 -0
- package/lib/ir/core/irTechnique.d.ts.map +1 -0
- package/lib/ir/core/irTechnique.js +87 -0
- package/lib/ir/core/irTechnique.js.map +1 -0
- package/lib/ir/core/irTechniqueCommands.d.ts +26 -0
- package/lib/ir/core/irTechniqueCommands.d.ts.map +1 -0
- package/lib/ir/core/irTechniqueCommands.js +68 -0
- package/lib/ir/core/irTechniqueCommands.js.map +1 -0
- package/lib/ir/core/pickBands.d.ts +6 -5
- package/lib/ir/core/pickBands.d.ts.map +1 -1
- package/lib/ir/core/pickBands.js +49 -26
- package/lib/ir/core/pickBands.js.map +1 -1
- package/lib/ir/core/ramanBands.d.ts +30 -0
- package/lib/ir/core/ramanBands.d.ts.map +1 -0
- package/lib/ir/core/ramanBands.js +83 -0
- package/lib/ir/core/ramanBands.js.map +1 -0
- package/lib/ir/core/spectrumJcamp.d.ts +10 -5
- package/lib/ir/core/spectrumJcamp.d.ts.map +1 -1
- package/lib/ir/core/spectrumJcamp.js +63 -15
- package/lib/ir/core/spectrumJcamp.js.map +1 -1
- package/lib/ir/core/toIrSpectrum.d.ts.map +1 -1
- package/lib/ir/core/toIrSpectrum.js +17 -2
- package/lib/ir/core/toIrSpectrum.js.map +1 -1
- package/lib/ir/ui/BandRow.d.ts +30 -0
- package/lib/ir/ui/BandRow.d.ts.map +1 -0
- package/lib/ir/ui/BandRow.js +42 -0
- package/lib/ir/ui/BandRow.js.map +1 -0
- package/lib/ir/ui/BandsPanel.d.ts +4 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -1
- package/lib/ir/ui/BandsPanel.js +14 -59
- package/lib/ir/ui/BandsPanel.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts +7 -0
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +16 -3
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +2 -2
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrChart.d.ts +2 -1
- package/lib/ir/ui/IrChart.d.ts.map +1 -1
- package/lib/ir/ui/IrChart.js +18 -21
- package/lib/ir/ui/IrChart.js.map +1 -1
- package/lib/ir/ui/IrCommandProvider.d.ts +7 -0
- package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -1
- package/lib/ir/ui/IrCommandProvider.js +2 -2
- package/lib/ir/ui/IrCommandProvider.js.map +1 -1
- package/lib/ir/ui/IrCommandTooltip.d.ts +7 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -1
- package/lib/ir/ui/IrCommandTooltip.js +3 -2
- package/lib/ir/ui/IrCommandTooltip.js.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.d.ts +8 -1
- package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js +30 -7
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -1
- package/lib/ir/ui/IrEditor.d.ts +3 -1
- package/lib/ir/ui/IrEditor.d.ts.map +1 -1
- package/lib/ir/ui/IrEditor.js +3 -20
- package/lib/ir/ui/IrEditor.js.map +1 -1
- package/lib/ir/ui/IrHeader.d.ts.map +1 -1
- package/lib/ir/ui/IrHeader.js +5 -1
- package/lib/ir/ui/IrHeader.js.map +1 -1
- package/lib/ir/ui/IrLogo.d.ts +11 -3
- package/lib/ir/ui/IrLogo.d.ts.map +1 -1
- package/lib/ir/ui/IrLogo.js +14 -5
- package/lib/ir/ui/IrLogo.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +23 -56
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrStatusBar.d.ts +3 -2
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -1
- package/lib/ir/ui/IrStatusBar.js +14 -9
- package/lib/ir/ui/IrStatusBar.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +3 -0
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +10 -3
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/IrTraces.d.ts +4 -1
- package/lib/ir/ui/IrTraces.d.ts.map +1 -1
- package/lib/ir/ui/IrTraces.js +2 -0
- package/lib/ir/ui/IrTraces.js.map +1 -1
- package/lib/ir/ui/RamanEditor.d.ts +46 -0
- package/lib/ir/ui/RamanEditor.d.ts.map +1 -0
- package/lib/ir/ui/RamanEditor.js +17 -0
- package/lib/ir/ui/RamanEditor.js.map +1 -0
- package/lib/ir/ui/SpectraPanel.d.ts.map +1 -1
- package/lib/ir/ui/SpectraPanel.js +2 -2
- package/lib/ir/ui/SpectraPanel.js.map +1 -1
- package/lib/ir/ui/SpectrumRow.d.ts +7 -0
- package/lib/ir/ui/SpectrumRow.d.ts.map +1 -1
- package/lib/ir/ui/SpectrumRow.js +4 -5
- package/lib/ir/ui/SpectrumRow.js.map +1 -1
- package/lib/ir/ui/VibrationalEditor.d.ts +48 -0
- package/lib/ir/ui/VibrationalEditor.d.ts.map +1 -0
- package/lib/ir/ui/VibrationalEditor.js +31 -0
- package/lib/ir/ui/VibrationalEditor.js.map +1 -0
- package/lib/ir/ui/bandsTsv.d.ts +19 -0
- package/lib/ir/ui/bandsTsv.d.ts.map +1 -0
- package/lib/ir/ui/bandsTsv.js +38 -0
- package/lib/ir/ui/bandsTsv.js.map +1 -0
- package/lib/ir/ui/irChartProps.d.ts +14 -4
- package/lib/ir/ui/irChartProps.d.ts.map +1 -1
- package/lib/ir/ui/irChartProps.js +3 -2
- package/lib/ir/ui/irChartProps.js.map +1 -1
- package/lib/ir/ui/irCommandContext.d.ts +8 -0
- package/lib/ir/ui/irCommandContext.d.ts.map +1 -1
- package/lib/ir/ui/irCommandContext.js +14 -3
- package/lib/ir/ui/irCommandContext.js.map +1 -1
- package/lib/ir/ui/useIrEditor.d.ts +3 -3
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.js +13 -4
- package/lib/ir/ui/useIrEditor.js.map +1 -1
- package/lib/ir/ui/useIrHandle.d.ts +14 -0
- package/lib/ir/ui/useIrHandle.d.ts.map +1 -0
- package/lib/ir/ui/useIrHandle.js +39 -0
- package/lib/ir/ui/useIrHandle.js.map +1 -0
- package/lib/ir/ui/useIrText.d.ts +40 -0
- package/lib/ir/ui/useIrText.d.ts.map +1 -0
- package/lib/ir/ui/useIrText.js +118 -0
- package/lib/ir/ui/useIrText.js.map +1 -0
- package/lib/ir/ui/useIrZoom.d.ts +7 -0
- package/lib/ir/ui/useIrZoom.d.ts.map +1 -1
- package/lib/ir/ui/useIrZoom.js +5 -4
- package/lib/ir/ui/useIrZoom.js.map +1 -1
- package/lib/ir/ui/useValueAxisZoom.d.ts +20 -0
- package/lib/ir/ui/useValueAxisZoom.d.ts.map +1 -0
- package/lib/ir/ui/useValueAxisZoom.js +54 -0
- package/lib/ir/ui/useValueAxisZoom.js.map +1 -0
- package/lib/ir.d.ts +3 -0
- package/lib/ir.d.ts.map +1 -1
- package/lib/ir.js +3 -0
- package/lib/ir.js.map +1 -1
- package/lib/locales/de.json +20 -1
- package/lib/locales/en.json +20 -1
- package/lib/locales/es.json +20 -1
- package/lib/locales/fr.json +20 -1
- package/lib/locales/it.json +20 -1
- package/lib/raman.d.ts +16 -0
- package/lib/raman.d.ts.map +1 -0
- package/lib/raman.js +12 -0
- package/lib/raman.js.map +1 -0
- package/package.json +2 -1
- package/src/ir/core/analysisSpectra.ts +26 -10
- package/src/ir/core/bandLabelPlan.ts +21 -10
- package/src/ir/core/index.ts +25 -5
- package/src/ir/core/irBand.ts +52 -14
- package/src/ir/core/irCommands.ts +15 -1
- package/src/ir/core/irDomain.ts +9 -7
- package/src/ir/core/irFormat.ts +39 -6
- package/src/ir/core/irMode.ts +42 -10
- package/src/ir/core/irReducer.ts +1 -49
- package/src/ir/core/irSpectrum.ts +59 -30
- package/src/ir/core/irState.ts +67 -2
- package/src/ir/core/irTechnique.ts +115 -0
- package/src/ir/core/irTechniqueCommands.ts +82 -0
- package/src/ir/core/pickBands.ts +63 -28
- package/src/ir/core/ramanBands.ts +105 -0
- package/src/ir/core/spectrumJcamp.ts +65 -16
- package/src/ir/core/toIrSpectrum.ts +20 -2
- package/src/ir/ui/BandRow.tsx +107 -0
- package/src/ir/ui/BandsPanel.tsx +32 -125
- package/src/ir/ui/IrAboutDialog.tsx +69 -28
- package/src/ir/ui/IrCanvas.tsx +2 -1
- package/src/ir/ui/IrChart.tsx +20 -24
- package/src/ir/ui/IrCommandProvider.tsx +10 -3
- package/src/ir/ui/IrCommandTooltip.tsx +11 -2
- package/src/ir/ui/IrDocumentationDialog.tsx +99 -55
- package/src/ir/ui/IrEditor.tsx +5 -36
- package/src/ir/ui/IrHeader.tsx +10 -3
- package/src/ir/ui/IrLogo.tsx +28 -9
- package/src/ir/ui/IrShell.tsx +27 -75
- package/src/ir/ui/IrStatusBar.tsx +17 -12
- package/src/ir/ui/IrToolbar.tsx +26 -15
- package/src/ir/ui/IrTraces.tsx +5 -1
- package/src/ir/ui/RamanEditor.tsx +53 -0
- package/src/ir/ui/SpectraPanel.tsx +2 -1
- package/src/ir/ui/SpectrumRow.tsx +14 -5
- package/src/ir/ui/VibrationalEditor.tsx +94 -0
- package/src/ir/ui/bandsTsv.ts +46 -0
- package/src/ir/ui/irChartProps.ts +14 -4
- package/src/ir/ui/irCommandContext.tsx +18 -3
- package/src/ir/ui/useIrEditor.ts +20 -8
- package/src/ir/ui/useIrHandle.ts +51 -0
- package/src/ir/ui/useIrText.ts +170 -0
- package/src/ir/ui/useIrZoom.ts +12 -3
- package/src/ir/ui/useValueAxisZoom.ts +67 -0
- package/src/ir.ts +3 -0
- package/src/locales/de.json +20 -1
- package/src/locales/en.json +20 -1
- package/src/locales/es.json +20 -1
- package/src/locales/fr.json +20 -1
- package/src/locales/it.json +20 -1
- package/src/raman.ts +19 -0
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What
|
|
2
|
+
* What a vibrational spectrum is once it has been read, whatever it was read
|
|
3
|
+
* from.
|
|
3
4
|
*
|
|
4
|
-
* One acquisition becomes one `IrSpectrum` carrying **both** value
|
|
5
|
-
* absorbance and percent transmittance — over one shared array of
|
|
6
|
-
* Both are held rather than one being derived on demand because
|
|
7
|
-
* already produces both when it reads a file: it adds an `a` and
|
|
8
|
-
* to every spectrum whichever of the two the instrument wrote, so
|
|
9
|
-
* happens once, in the one place that knows what the file's y
|
|
10
|
-
* the answer means switching what is drawn costs nothing,
|
|
11
|
-
* axes can never drift apart through a round trip.
|
|
5
|
+
* One infrared acquisition becomes one `IrSpectrum` carrying **both** value
|
|
6
|
+
* axes — absorbance and percent transmittance — over one shared array of
|
|
7
|
+
* wavenumbers. Both are held rather than one being derived on demand because
|
|
8
|
+
* `ir-spectrum` already produces both when it reads a file: it adds an `a` and
|
|
9
|
+
* a `t` variable to every spectrum whichever of the two the instrument wrote, so
|
|
10
|
+
* the conversion happens once, in the one place that knows what the file's y
|
|
11
|
+
* axis meant. Holding the answer means switching what is drawn costs nothing,
|
|
12
|
+
* and means the two axes can never drift apart through a round trip.
|
|
13
|
+
*
|
|
14
|
+
* A Raman acquisition carries its intensity instead, over its Raman shifts —
|
|
15
|
+
* also wavenumbers in cm⁻¹ — and neither infrared axis: there is no
|
|
16
|
+
* transmittance of scattered light to convert it to.
|
|
12
17
|
*
|
|
13
18
|
* The arrays are `Float64Array` and are replaced on a change, never written
|
|
14
|
-
* into, since every consumer holds the same object by reference.
|
|
19
|
+
* into, since every consumer holds the same object by reference. A vibrational
|
|
15
20
|
* spectrum is a few thousand points rather than a mass spectrum's few hundred
|
|
16
21
|
* thousand, so holding two value axes costs nothing worth counting.
|
|
17
22
|
*/
|
|
@@ -30,8 +35,11 @@ import type { ChartDomain } from '../../chart/core/chartDomain.ts';
|
|
|
30
35
|
*/
|
|
31
36
|
export type IrTrace = DataXY<Float64Array>;
|
|
32
37
|
|
|
33
|
-
/**
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The formats a spectrum can have been read from. `wdf` is Renishaw's Raman
|
|
40
|
+
* format, which a host reads with its own parser and hands over.
|
|
41
|
+
*/
|
|
42
|
+
export type IrFormat = 'jcamp' | 'spc' | 'text' | 'wdf' | 'calculated';
|
|
35
43
|
|
|
36
44
|
/**
|
|
37
45
|
* Where a spectrum came from, and what the file said about the acquisition.
|
|
@@ -87,8 +95,11 @@ export interface IrMeta {
|
|
|
87
95
|
fields: IrMetaField[];
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
/**
|
|
91
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Which value axis is being drawn and read: absorbance or percent
|
|
100
|
+
* transmittance for an infrared spectrum, intensity for a Raman one.
|
|
101
|
+
*/
|
|
102
|
+
export type IrMode = 'absorbance' | 'transmittance' | 'intensity';
|
|
92
103
|
|
|
93
104
|
/** One spectrum as the viewer holds it. */
|
|
94
105
|
export interface IrSpectrum {
|
|
@@ -99,19 +110,33 @@ export interface IrSpectrum {
|
|
|
99
110
|
/** The colour it is drawn in. */
|
|
100
111
|
color: string;
|
|
101
112
|
/**
|
|
102
|
-
* The wavenumbers in cm⁻¹, **ascending
|
|
113
|
+
* The wavenumbers in cm⁻¹, **ascending** — of the light absorbed for an
|
|
114
|
+
* infrared spectrum, the Raman shift for a Raman one.
|
|
103
115
|
*
|
|
104
|
-
* Ascending even though the axis is read from 4000 down to 400:
|
|
105
|
-
* numbers run on screen is the chart's business, and every
|
|
106
|
-
* every extent taken off index zero downstream wants them in
|
|
107
|
-
* the data instead would make the drawing simpler once and
|
|
108
|
-
* wrong.
|
|
116
|
+
* Ascending even though the infrared axis is read from 4000 down to 400:
|
|
117
|
+
* which way the numbers run on screen is the chart's business, and every
|
|
118
|
+
* binary search and every extent taken off index zero downstream wants them in
|
|
119
|
+
* order. Reversing the data instead would make the drawing simpler once and
|
|
120
|
+
* everything else wrong.
|
|
109
121
|
*/
|
|
110
122
|
wavenumber: Float64Array;
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Absorbance at each wavenumber, as `ir-spectrum` supplied it. An infrared
|
|
125
|
+
* spectrum carries it beside `transmittance`.
|
|
126
|
+
* @default undefined
|
|
127
|
+
*/
|
|
128
|
+
absorbance?: Float64Array;
|
|
129
|
+
/**
|
|
130
|
+
* Percent transmittance at each wavenumber, likewise.
|
|
131
|
+
* @default undefined
|
|
132
|
+
*/
|
|
133
|
+
transmittance?: Float64Array;
|
|
134
|
+
/**
|
|
135
|
+
* Intensity at each Raman shift, which a Raman spectrum carries instead of
|
|
136
|
+
* the two infrared axes.
|
|
137
|
+
* @default undefined
|
|
138
|
+
*/
|
|
139
|
+
intensity?: Float64Array;
|
|
115
140
|
/** What the file said about the acquisition, `null` when it said nothing. */
|
|
116
141
|
meta: IrMeta | null;
|
|
117
142
|
/** Where it came from. */
|
|
@@ -145,11 +170,15 @@ export type IrDomain = ChartDomain;
|
|
|
145
170
|
* render of every spectrum is a copy per frame for no gain.
|
|
146
171
|
* @param spectrum - The spectrum.
|
|
147
172
|
* @param mode - Which value axis is being drawn.
|
|
148
|
-
* @returns The trace, sharing the spectrum's own arrays
|
|
173
|
+
* @returns The trace, sharing the spectrum's own arrays, or `undefined` when the
|
|
174
|
+
* spectrum carries no such axis — a Raman spectrum has no absorbance.
|
|
149
175
|
*/
|
|
150
|
-
export function traceOf(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
176
|
+
export function traceOf(
|
|
177
|
+
spectrum: IrSpectrum,
|
|
178
|
+
mode: IrMode,
|
|
179
|
+
): IrTrace | undefined {
|
|
180
|
+
const values = spectrum[mode];
|
|
181
|
+
return values === undefined
|
|
182
|
+
? undefined
|
|
183
|
+
: { x: spectrum.wavenumber, y: values };
|
|
155
184
|
}
|
package/src/ir/core/irState.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
import type { IrSidePanelId } from './irSidePanels.ts';
|
|
17
17
|
import type { IrDomain, IrMode, IrSpectrum } from './irSpectrum.ts';
|
|
18
|
+
import type { IrTechnique } from './irTechnique.ts';
|
|
19
|
+
import { defaultIrMode, irModeFor, offersIrMode } from './irTechnique.ts';
|
|
18
20
|
import type { PickBandsOptions } from './pickBands.ts';
|
|
19
21
|
|
|
20
22
|
/** The document: what a file holds. */
|
|
@@ -48,7 +50,12 @@ export interface IrView {
|
|
|
48
50
|
|
|
49
51
|
/** The workspace: how every spectrum is drawn, whichever ones are open. */
|
|
50
52
|
export interface IrSettings {
|
|
51
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* What the spectra were measured with. Chosen when the viewer opens and fixed
|
|
55
|
+
* from then on: a change asking for another is ignored.
|
|
56
|
+
*/
|
|
57
|
+
technique: IrTechnique;
|
|
58
|
+
/** Which value axis the spectra are read in, always one the technique offers. */
|
|
52
59
|
mode: IrMode;
|
|
53
60
|
/** Whether the bands are picked at all. */
|
|
54
61
|
pickBands: boolean;
|
|
@@ -108,6 +115,7 @@ export const DEFAULT_PICKING: PickBandsOptions = {
|
|
|
108
115
|
|
|
109
116
|
/** The workspace a fresh viewer starts from. */
|
|
110
117
|
export const DEFAULT_SETTINGS: IrSettings = {
|
|
118
|
+
technique: 'infrared',
|
|
111
119
|
mode: 'transmittance',
|
|
112
120
|
pickBands: true,
|
|
113
121
|
picking: DEFAULT_PICKING,
|
|
@@ -116,6 +124,57 @@ export const DEFAULT_SETTINGS: IrSettings = {
|
|
|
116
124
|
assignmentTolerance: 5,
|
|
117
125
|
};
|
|
118
126
|
|
|
127
|
+
/** What a viewer opens on. */
|
|
128
|
+
export interface CreateIrStateOptions {
|
|
129
|
+
/**
|
|
130
|
+
* The spectra to open on.
|
|
131
|
+
* @default []
|
|
132
|
+
*/
|
|
133
|
+
spectra?: IrSpectrum[];
|
|
134
|
+
/**
|
|
135
|
+
* The workspace to open in. Its `technique` is fixed for the life of the
|
|
136
|
+
* viewer, and its `mode` falls back to the technique's first when the
|
|
137
|
+
* technique does not offer it.
|
|
138
|
+
* @default DEFAULT_SETTINGS
|
|
139
|
+
*/
|
|
140
|
+
settings?: Partial<IrSettings>;
|
|
141
|
+
/**
|
|
142
|
+
* The panels open to begin with.
|
|
143
|
+
* @default DEFAULT_SIDE_PANELS
|
|
144
|
+
*/
|
|
145
|
+
panelIds?: IrSidePanelId[];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The state a viewer opens with.
|
|
150
|
+
*
|
|
151
|
+
* The panel list is spread rather than stored by reference: a caller's array is
|
|
152
|
+
* the caller's to mutate, and a viewer holding it would find its open panels
|
|
153
|
+
* changing under it.
|
|
154
|
+
* @param options - What it opens on.
|
|
155
|
+
* @returns The state.
|
|
156
|
+
*/
|
|
157
|
+
export function createIrState(options: CreateIrStateOptions = {}): IrState {
|
|
158
|
+
const { spectra = [], settings, panelIds } = options;
|
|
159
|
+
const technique = settings?.technique ?? DEFAULT_SETTINGS.technique;
|
|
160
|
+
const opened: IrSettings = {
|
|
161
|
+
...DEFAULT_SETTINGS,
|
|
162
|
+
technique,
|
|
163
|
+
mode: defaultIrMode(technique),
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
data: { spectra: [...spectra] },
|
|
167
|
+
view: {
|
|
168
|
+
selectedId: spectra[0]?.id ?? null,
|
|
169
|
+
domain: null,
|
|
170
|
+
tool: 'read',
|
|
171
|
+
openPanelIds: [...(panelIds ?? DEFAULT_SIDE_PANELS)],
|
|
172
|
+
error: null,
|
|
173
|
+
},
|
|
174
|
+
settings: mergeIrSettings(opened, settings),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
119
178
|
/**
|
|
120
179
|
* Fold a change into the workspace, refusing what no chart survives.
|
|
121
180
|
*
|
|
@@ -123,7 +182,9 @@ export const DEFAULT_SETTINGS: IrSettings = {
|
|
|
123
182
|
* not yet a number — a lone minus sign, an empty box — and a limit of `NaN`
|
|
124
183
|
* silently stops every label being drawn. So each is checked, and the current
|
|
125
184
|
* value is kept where the new one is unusable rather than the field being
|
|
126
|
-
* fought with while it is being typed in.
|
|
185
|
+
* fought with while it is being typed in. The technique is never changed, and a
|
|
186
|
+
* mode it does not offer is refused the same way: a Raman spectrum has no
|
|
187
|
+
* absorbance to draw.
|
|
127
188
|
* @param current - The workspace in force.
|
|
128
189
|
* @param change - What to change about it.
|
|
129
190
|
* @returns The new workspace.
|
|
@@ -137,6 +198,10 @@ export function mergeIrSettings(
|
|
|
137
198
|
return {
|
|
138
199
|
...current,
|
|
139
200
|
...change,
|
|
201
|
+
technique: current.technique,
|
|
202
|
+
mode: offersIrMode(current.technique, change.mode)
|
|
203
|
+
? change.mode
|
|
204
|
+
: irModeFor(current.technique, current.mode),
|
|
140
205
|
picking: { ...current.picking, ...change.picking },
|
|
141
206
|
labelLimit: Number.isFinite(asked)
|
|
142
207
|
? Math.min(MAXIMUM_LABEL_LIMIT, Math.max(0, Math.round(asked)))
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything that differs between an infrared spectrum and a Raman one.
|
|
3
|
+
*
|
|
4
|
+
* Both are vibrational spectra over wavenumbers in cm⁻¹, and the viewer reads
|
|
5
|
+
* them the same way — one chart, one set of panels, one set of gestures — so
|
|
6
|
+
* what is left to differ is a handful of facts: which value axes a spectrum is
|
|
7
|
+
* read on, what the horizontal axis is called and which way it runs, whether the
|
|
8
|
+
* correlation table has anything to say about a band, and what a written file
|
|
9
|
+
* calls itself. They are gathered here for the reason `IR_MODE_RULES` gathers
|
|
10
|
+
* what differs between the value axes: a component that asked which technique
|
|
11
|
+
* it was drawing would be the first of many to ask, and they would come to
|
|
12
|
+
* disagree.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { IrMode } from './irSpectrum.ts';
|
|
16
|
+
|
|
17
|
+
/** What was measured: the light a sample absorbs, or the light it scatters. */
|
|
18
|
+
export type IrTechnique = 'infrared' | 'raman';
|
|
19
|
+
|
|
20
|
+
/** What is true of one technique. */
|
|
21
|
+
export interface IrTechniqueRules {
|
|
22
|
+
/** How it is written inside a sentence; a sentence opening on it capitalises it. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** The value axes a spectrum is read on, in the order a control offers them. */
|
|
25
|
+
modes: readonly IrMode[];
|
|
26
|
+
/** What the horizontal axis is called. */
|
|
27
|
+
xTitle: string;
|
|
28
|
+
/** Whether the horizontal axis runs from high at the left to low at the right. */
|
|
29
|
+
reverseX: boolean;
|
|
30
|
+
/** Whether the correlation table is asked what a band might be. */
|
|
31
|
+
assignments: boolean;
|
|
32
|
+
/** The `##DATA TYPE=` a written spectrum states when its file stated none. */
|
|
33
|
+
dataType: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The techniques, in the order a control would offer them. */
|
|
37
|
+
export const IR_TECHNIQUES: readonly IrTechnique[] = ['infrared', 'raman'];
|
|
38
|
+
|
|
39
|
+
/** How each technique behaves, every fact in one place. */
|
|
40
|
+
export const IR_TECHNIQUE_RULES = {
|
|
41
|
+
infrared: {
|
|
42
|
+
name: 'infrared',
|
|
43
|
+
modes: ['transmittance', 'absorbance'],
|
|
44
|
+
xTitle: 'wavenumber (cm⁻¹)',
|
|
45
|
+
/**
|
|
46
|
+
* 4000 at the left and 400 at the right, which is how every infrared
|
|
47
|
+
* spectrum has been printed since the instruments scanned that way.
|
|
48
|
+
*/
|
|
49
|
+
reverseX: true,
|
|
50
|
+
assignments: true,
|
|
51
|
+
dataType: 'INFRARED SPECTRUM',
|
|
52
|
+
},
|
|
53
|
+
raman: {
|
|
54
|
+
name: 'Raman',
|
|
55
|
+
/** One axis: a Raman spectrum is the light scattered, and nothing else. */
|
|
56
|
+
modes: ['intensity'],
|
|
57
|
+
xTitle: 'Raman shift (cm⁻¹)',
|
|
58
|
+
/** The shift grows away from the laser line, left to right. */
|
|
59
|
+
reverseX: false,
|
|
60
|
+
/**
|
|
61
|
+
* The table holds infrared group frequencies and infrared strengths. A
|
|
62
|
+
* vibration strong in one technique is often weak or silent in the other,
|
|
63
|
+
* so its candidates offered for a Raman band would claim what the table
|
|
64
|
+
* does not know.
|
|
65
|
+
*/
|
|
66
|
+
assignments: false,
|
|
67
|
+
dataType: 'RAMAN SPECTRUM',
|
|
68
|
+
},
|
|
69
|
+
} as const satisfies Record<IrTechnique, IrTechniqueRules>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The value axis a viewer of a technique opens on.
|
|
73
|
+
* @param technique - What was measured.
|
|
74
|
+
* @returns Its first mode.
|
|
75
|
+
*/
|
|
76
|
+
export function defaultIrMode(technique: IrTechnique): IrMode {
|
|
77
|
+
return IR_TECHNIQUE_RULES[technique].modes[0];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Whether a technique reads its spectra on a value axis.
|
|
82
|
+
* @param technique - What was measured.
|
|
83
|
+
* @param mode - The axis asked about; `undefined` is offered by none.
|
|
84
|
+
* @returns Whether the technique offers it.
|
|
85
|
+
*/
|
|
86
|
+
export function offersIrMode(
|
|
87
|
+
technique: IrTechnique,
|
|
88
|
+
mode: IrMode | undefined,
|
|
89
|
+
): mode is IrMode {
|
|
90
|
+
if (mode === undefined) return false;
|
|
91
|
+
const modes: readonly IrMode[] = IR_TECHNIQUE_RULES[technique].modes;
|
|
92
|
+
return modes.includes(mode);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The value axis to read a technique's spectra on, given the one asked for.
|
|
97
|
+
* @param technique - What was measured.
|
|
98
|
+
* @param mode - The axis asked for, if any.
|
|
99
|
+
* @returns It when the technique offers it, the technique's first otherwise.
|
|
100
|
+
*/
|
|
101
|
+
export function irModeFor(technique: IrTechnique, mode?: IrMode): IrMode {
|
|
102
|
+
return offersIrMode(technique, mode) ? mode : defaultIrMode(technique);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The technique that reads its spectra on a value axis.
|
|
107
|
+
*
|
|
108
|
+
* Every axis belongs to exactly one technique, so the axis a file was written
|
|
109
|
+
* on says what was measured.
|
|
110
|
+
* @param mode - The value axis.
|
|
111
|
+
* @returns The technique offering it.
|
|
112
|
+
*/
|
|
113
|
+
export function irModeTechnique(mode: IrMode): IrTechnique {
|
|
114
|
+
return offersIrMode('raman', mode) ? 'raman' : 'infrared';
|
|
115
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commands each technique's viewer offers.
|
|
3
|
+
*
|
|
4
|
+
* A Raman viewer offers the infrared table less the commands with nothing to
|
|
5
|
+
* act on — one value axis is nothing to toggle, and no assignment is nothing to
|
|
6
|
+
* name — and words the rest without the absorbance and transmittance it does
|
|
7
|
+
* not have. It is built from the infrared table, so a command added there
|
|
8
|
+
* reaches both.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { IrCommand, IrCommandId, IrCommandTable } from './irCommands.ts';
|
|
12
|
+
import { irCommands } from './irCommands.ts';
|
|
13
|
+
import type { IrTechnique } from './irTechnique.ts';
|
|
14
|
+
import { IR_TECHNIQUE_RULES } from './irTechnique.ts';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Whether a viewer of a technique offers a command at all.
|
|
18
|
+
* @param technique - What was measured.
|
|
19
|
+
* @param id - Which command.
|
|
20
|
+
* @returns False for the toggle of a technique with one value axis, and for
|
|
21
|
+
* the assignments of one the correlation table says nothing about.
|
|
22
|
+
*/
|
|
23
|
+
export function irCommandOffered(
|
|
24
|
+
technique: IrTechnique,
|
|
25
|
+
id: IrCommandId,
|
|
26
|
+
): boolean {
|
|
27
|
+
const { modes, assignments } = IR_TECHNIQUE_RULES[technique];
|
|
28
|
+
if (id === 'toggleMode') return modes.length > 1;
|
|
29
|
+
if (id === 'toggleAssignments') return assignments;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Everything a viewer of a technique offers, in the order it is reached for.
|
|
35
|
+
* @param technique - What was measured.
|
|
36
|
+
* @returns The table; for infrared, `irCommands` itself.
|
|
37
|
+
*/
|
|
38
|
+
export function irCommandsFor(technique: IrTechnique): IrCommandTable {
|
|
39
|
+
return COMMAND_TABLES[technique];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Where the chart is, for a gesture made anywhere on it. */
|
|
43
|
+
const OVER_THE_CHART = 'Over the chart';
|
|
44
|
+
|
|
45
|
+
/** How a Raman viewer words the commands it shares with infrared. */
|
|
46
|
+
const RAMAN_WORDING: Partial<Record<IrCommandId, Partial<IrCommand>>> = {
|
|
47
|
+
about: { title: 'About the Raman viewer' },
|
|
48
|
+
documentation: {
|
|
49
|
+
description: 'How the bands are read, and every gesture.',
|
|
50
|
+
},
|
|
51
|
+
readTool: {
|
|
52
|
+
description:
|
|
53
|
+
'A drag narrows the Raman shift axis. Released past the baseline, it takes the intensity axis with it.',
|
|
54
|
+
gestures: [{ title: OVER_THE_CHART, shortcuts: ['Drag'] }],
|
|
55
|
+
},
|
|
56
|
+
boxTool: {
|
|
57
|
+
description:
|
|
58
|
+
'A drag zooms to exactly the rectangle it sweeps out, both axes at once — for looking into a baseline or a shoulder rather than across the spectrum.',
|
|
59
|
+
},
|
|
60
|
+
zoomIn: {
|
|
61
|
+
description:
|
|
62
|
+
'Brings the weak bands up, scaling the intensity axis about zero.',
|
|
63
|
+
gestures: [{ title: OVER_THE_CHART, shortcuts: ['Scroll wheel'] }],
|
|
64
|
+
},
|
|
65
|
+
zoomOut: {
|
|
66
|
+
gestures: [{ title: OVER_THE_CHART, shortcuts: ['Scroll wheel'] }],
|
|
67
|
+
},
|
|
68
|
+
togglePicking: {
|
|
69
|
+
description:
|
|
70
|
+
'Finds the bands of the selected spectrum, marks them on the chart and lists them.',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** The command table of each technique. */
|
|
75
|
+
const COMMAND_TABLES: Record<IrTechnique, IrCommandTable> = {
|
|
76
|
+
infrared: irCommands,
|
|
77
|
+
raman: Object.fromEntries(
|
|
78
|
+
(Object.keys(irCommands) as IrCommandId[])
|
|
79
|
+
.filter((id) => irCommandOffered('raman', id))
|
|
80
|
+
.map((id) => [id, { ...irCommands[id], ...RAMAN_WORDING[id] }]),
|
|
81
|
+
),
|
|
82
|
+
};
|
package/src/ir/core/pickBands.ts
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Everything here is the two things that call needs and does not have: a
|
|
5
5
|
* `MeasurementXY` built out of the arrays the viewer holds, and the decision to
|
|
6
|
-
* pick on **absorbance** rather than on transmittance. That
|
|
7
|
-
* only judgement in the file and it is not a preference — peak
|
|
8
|
-
* maxima, and a band is a maximum in absorbance but a *minimum* in
|
|
9
|
-
* so picking on transmittance would return the flat baseline
|
|
10
|
-
* and miss every band there is.
|
|
6
|
+
* pick an infrared spectrum on **absorbance** rather than on transmittance. That
|
|
7
|
+
* second one is the only judgement in the file and it is not a preference — peak
|
|
8
|
+
* picking finds maxima, and a band is a maximum in absorbance but a *minimum* in
|
|
9
|
+
* transmittance, so picking on transmittance would return the flat baseline
|
|
10
|
+
* between the bands and miss every band there is. A Raman spectrum is picked on
|
|
11
|
+
* its intensity, by `ramanBands`, with the same picker.
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import type { MeasurementXY } from 'cheminfo-types';
|
|
@@ -15,7 +16,10 @@ import { autoPeakPicking } from 'ir-spectrum';
|
|
|
15
16
|
import { xMaxValue, xMinValue } from 'ml-spectra-processing';
|
|
16
17
|
|
|
17
18
|
import type { IrBand, IrBandStrength } from './irBand.ts';
|
|
19
|
+
import { bandHeight } from './irBand.ts';
|
|
18
20
|
import type { IrSpectrum } from './irSpectrum.ts';
|
|
21
|
+
import type { PeakPickingOptions } from './ramanBands.ts';
|
|
22
|
+
import { ramanBands } from './ramanBands.ts';
|
|
19
23
|
|
|
20
24
|
/** How the bands are picked. */
|
|
21
25
|
export interface PickBandsOptions {
|
|
@@ -86,20 +90,50 @@ export function pickBands(
|
|
|
86
90
|
} = options;
|
|
87
91
|
if (spectrum.wavenumber.length < 2) return [];
|
|
88
92
|
|
|
89
|
-
const
|
|
90
|
-
// Absorbance, because a band is a maximum there and a minimum in the other.
|
|
91
|
-
yVariable: 'a',
|
|
93
|
+
const picking: PeakPickingOptions = {
|
|
92
94
|
minMaxRatio: minRelativeHeight,
|
|
93
95
|
minPeakWidth,
|
|
94
96
|
...(from === undefined ? {} : { from }),
|
|
95
97
|
...(to === undefined ? {} : { to }),
|
|
96
|
-
}
|
|
98
|
+
};
|
|
99
|
+
// A spectrum carrying an intensity is a Raman one; any other is infrared.
|
|
100
|
+
const bands =
|
|
101
|
+
spectrum.intensity === undefined
|
|
102
|
+
? infraredBands(spectrum, picking)
|
|
103
|
+
: ramanBands(spectrum, spectrum.intensity, picking);
|
|
104
|
+
|
|
105
|
+
const kept =
|
|
106
|
+
limit === undefined || bands.length <= limit
|
|
107
|
+
? bands
|
|
108
|
+
: bands.toSorted(byDescendingHeight).slice(0, limit);
|
|
109
|
+
return kept.toSorted(byAscendingWavenumber);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The bands of an infrared spectrum, picked on its absorbance.
|
|
114
|
+
* @param spectrum - The spectrum to pick from.
|
|
115
|
+
* @param picking - Where to pick, and how finely.
|
|
116
|
+
* @returns The bands, in the order they were found; none when the spectrum
|
|
117
|
+
* carries only one of its two axes, since the strength is read off the other.
|
|
118
|
+
*/
|
|
119
|
+
function infraredBands(
|
|
120
|
+
spectrum: IrSpectrum,
|
|
121
|
+
picking: PeakPickingOptions,
|
|
122
|
+
): IrBand[] {
|
|
123
|
+
const { id, wavenumber, absorbance, transmittance } = spectrum;
|
|
124
|
+
if (absorbance === undefined || transmittance === undefined) return [];
|
|
125
|
+
|
|
126
|
+
const picked = autoPeakPicking(
|
|
127
|
+
measurementOf(wavenumber, absorbance, transmittance),
|
|
128
|
+
// Absorbance, because a band is a maximum there and a minimum in the other.
|
|
129
|
+
{ yVariable: 'a', ...picking },
|
|
130
|
+
);
|
|
97
131
|
|
|
98
132
|
const bands: IrBand[] = [];
|
|
99
133
|
for (const peak of picked) {
|
|
100
134
|
if (!Number.isFinite(peak.wavenumber)) continue;
|
|
101
135
|
bands.push({
|
|
102
|
-
spectrumId:
|
|
136
|
+
spectrumId: id,
|
|
103
137
|
wavenumber: peak.wavenumber,
|
|
104
138
|
absorbance: peak.absorbance,
|
|
105
139
|
// `ConvertedPeak.transmittance` is a fraction where the spectrum's own
|
|
@@ -109,12 +143,7 @@ export function pickBands(
|
|
|
109
143
|
strength: peak.kind as IrBandStrength,
|
|
110
144
|
});
|
|
111
145
|
}
|
|
112
|
-
|
|
113
|
-
const kept =
|
|
114
|
-
limit === undefined || bands.length <= limit
|
|
115
|
-
? bands
|
|
116
|
-
: bands.toSorted(byDescendingAbsorbance).slice(0, limit);
|
|
117
|
-
return kept.toSorted(byAscendingWavenumber);
|
|
146
|
+
return bands;
|
|
118
147
|
}
|
|
119
148
|
|
|
120
149
|
/**
|
|
@@ -124,17 +153,23 @@ export function pickBands(
|
|
|
124
153
|
* letter is worked out from: without them the conversion assumes a spectrum
|
|
125
154
|
* running the full 0 to 100 percent, and every band of a shallow ATR trace that
|
|
126
155
|
* never leaves the eighties comes back weak.
|
|
127
|
-
* @param
|
|
156
|
+
* @param wavenumber - The wavenumbers, ascending.
|
|
157
|
+
* @param absorbance - Absorbance at each.
|
|
158
|
+
* @param transmittance - Percent transmittance at each.
|
|
128
159
|
* @returns A measurement carrying all three variables.
|
|
129
160
|
*/
|
|
130
|
-
function measurementOf(
|
|
131
|
-
|
|
161
|
+
function measurementOf(
|
|
162
|
+
wavenumber: Float64Array,
|
|
163
|
+
absorbance: Float64Array,
|
|
164
|
+
transmittance: Float64Array,
|
|
165
|
+
): MeasurementXY {
|
|
166
|
+
const percent = {
|
|
132
167
|
label: 'Transmittance (%)',
|
|
133
168
|
units: '%',
|
|
134
169
|
symbol: 't' as const,
|
|
135
|
-
data:
|
|
136
|
-
min: xMinValue(
|
|
137
|
-
max: xMaxValue(
|
|
170
|
+
data: transmittance,
|
|
171
|
+
min: xMinValue(transmittance),
|
|
172
|
+
max: xMaxValue(transmittance),
|
|
138
173
|
};
|
|
139
174
|
return {
|
|
140
175
|
variables: {
|
|
@@ -142,20 +177,20 @@ function measurementOf(spectrum: IrSpectrum): MeasurementXY {
|
|
|
142
177
|
label: 'Wavenumber',
|
|
143
178
|
units: '1/cm',
|
|
144
179
|
symbol: 'x',
|
|
145
|
-
data:
|
|
180
|
+
data: wavenumber,
|
|
146
181
|
},
|
|
147
182
|
// `y` is required of every measurement, and stands for whichever axis was
|
|
148
183
|
// recorded. Nothing here reads it — the picking is told to use `a` and the
|
|
149
184
|
// strength letter is read off `t` — so it carries the transmittance rather
|
|
150
185
|
// than a third copy of anything.
|
|
151
|
-
y:
|
|
186
|
+
y: percent,
|
|
152
187
|
a: {
|
|
153
188
|
label: 'Absorbance',
|
|
154
189
|
units: '',
|
|
155
190
|
symbol: 'a',
|
|
156
|
-
data:
|
|
191
|
+
data: absorbance,
|
|
157
192
|
},
|
|
158
|
-
t:
|
|
193
|
+
t: percent,
|
|
159
194
|
},
|
|
160
195
|
};
|
|
161
196
|
}
|
|
@@ -166,8 +201,8 @@ function measurementOf(spectrum: IrSpectrum): MeasurementXY {
|
|
|
166
201
|
* @param second - The other.
|
|
167
202
|
* @returns The comparison.
|
|
168
203
|
*/
|
|
169
|
-
function
|
|
170
|
-
return second
|
|
204
|
+
function byDescendingHeight(first: IrBand, second: IrBand): number {
|
|
205
|
+
return bandHeight(second) - bandHeight(first);
|
|
171
206
|
}
|
|
172
207
|
|
|
173
208
|
/**
|