@complat/react-spectra-editor 1.0.0-rc2 → 1.0.0-rc20.patch-1
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 +16 -0
- package/dist/__tests__/fixtures/aif_jcamp_1.js +136 -0
- package/dist/__tests__/fixtures/aif_jcamp_2.js +122 -0
- package/dist/__tests__/fixtures/backup/nmr1h_a.js +3518 -0
- package/dist/__tests__/fixtures/backup/xrd_jcamp_1.js +10705 -0
- package/dist/__tests__/fixtures/cds_jcamp.js +861 -0
- package/dist/__tests__/fixtures/compare_ir_1_jcamp.js +585 -0
- package/dist/__tests__/fixtures/compare_ir_2_jcamp.js +515 -0
- package/dist/__tests__/fixtures/compare_uv_vis_jcamp.js +640 -0
- package/dist/__tests__/fixtures/cyclic_voltammetry_1.js +778 -0
- package/dist/__tests__/fixtures/cyclic_voltammetry_2.js +758 -0
- package/dist/__tests__/fixtures/cyclic_voltammetry_3.js +759 -0
- package/dist/__tests__/fixtures/dls_acf_jcamp.js +148 -0
- package/dist/__tests__/fixtures/dls_intensity_jcamp.js +151 -0
- package/dist/__tests__/fixtures/emissions_jcamp.js +883 -0
- package/dist/__tests__/fixtures/hplc_uvvis_jcamp.js +638 -0
- package/dist/__tests__/fixtures/hplc_uvvis_jcamp_2.js +221 -0
- package/dist/__tests__/fixtures/ir_jcamp.js +148 -0
- package/dist/__tests__/fixtures/ir_result.js +46 -0
- package/dist/__tests__/fixtures/ir_svg.js +8 -0
- package/dist/__tests__/fixtures/ms_jcamp.js +64 -0
- package/dist/__tests__/fixtures/nmr13c_dept_jcamp.js +3543 -0
- package/dist/__tests__/fixtures/nmr13c_jcamp.js +1229 -0
- package/dist/__tests__/fixtures/nmr15n_jcamp.js +7177 -0
- package/dist/__tests__/fixtures/nmr19f_jcamp.js +6560 -0
- package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +2005 -0
- package/dist/__tests__/fixtures/nmr1h_jcamp.js +4516 -0
- package/dist/__tests__/fixtures/nmr29si_jcamp.js +3029 -0
- package/dist/__tests__/fixtures/nmr31p_jcamp.js +3418 -0
- package/dist/__tests__/fixtures/nmr_result.js +68 -0
- package/dist/__tests__/fixtures/nmr_svg.js +8 -0
- package/dist/__tests__/fixtures/phenylalanin.js +142 -0
- package/dist/__tests__/fixtures/qDescValue.js +65 -0
- package/dist/__tests__/fixtures/raman_jcamp.js +410 -0
- package/dist/__tests__/fixtures/sec_1_jcamp.js +425 -0
- package/dist/__tests__/fixtures/sec_2_jcamp.js +407 -0
- package/dist/__tests__/fixtures/sec_3_jcamp.js +408 -0
- package/dist/__tests__/fixtures/sec_4_jcamp.js +407 -0
- package/dist/__tests__/fixtures/tga_jcamp.js +4157 -0
- package/dist/__tests__/fixtures/uv_vis_jcamp.js +249 -0
- package/dist/__tests__/fixtures/xrd_jcamp_1.js +436 -0
- package/dist/__tests__/fixtures/xrd_jcamp_2.js +955 -0
- package/dist/__tests__/fixtures/xrd_jcamp_3.js +1871 -0
- package/dist/__tests__/units/components/panel/graph_selection.test.js +72 -0
- package/dist/__tests__/units/components/panel/peaks.test.js +87 -0
- package/dist/actions/curve.js +15 -14
- package/dist/actions/cyclic_voltammetry.js +40 -60
- package/dist/actions/edit_peak.js +8 -12
- package/dist/actions/forecast.js +16 -24
- package/dist/actions/integration.js +12 -18
- package/dist/actions/jcamp.js +16 -24
- package/dist/actions/layout.js +4 -6
- package/dist/actions/manager.js +20 -30
- package/dist/actions/meta.js +4 -6
- package/dist/actions/multiplicity.js +24 -36
- package/dist/actions/scan.js +12 -18
- package/dist/actions/shift.js +8 -12
- package/dist/actions/status.js +12 -18
- package/dist/actions/submit.js +16 -24
- package/dist/actions/threshold.js +20 -30
- package/dist/actions/ui.js +25 -31
- package/dist/actions/wavelength.js +4 -6
- package/dist/app.js +25 -23
- package/dist/components/cmd_bar/01_viewer.js +24 -34
- package/dist/components/cmd_bar/02_zoom.js +18 -28
- package/dist/components/cmd_bar/03_peak.js +50 -66
- package/dist/components/cmd_bar/04_integration.js +70 -84
- package/dist/components/cmd_bar/05_multiplicity.js +42 -56
- package/dist/components/cmd_bar/06_undo_redo.js +22 -36
- package/dist/components/cmd_bar/07_pecker.js +24 -34
- package/dist/components/cmd_bar/common.js +11 -7
- package/dist/components/cmd_bar/index.js +17 -23
- package/dist/components/cmd_bar/r01_layout.js +79 -56
- package/dist/components/cmd_bar/r02_scan.js +70 -87
- package/dist/components/cmd_bar/r03_threshold.js +54 -68
- package/dist/components/cmd_bar/r04_submit.js +71 -83
- package/dist/components/cmd_bar/r05_submit_btn.js +64 -72
- package/dist/components/cmd_bar/r06_predict_btn.js +142 -152
- package/dist/components/cmd_bar/r07_wavelength_btn.js +28 -36
- package/dist/components/cmd_bar/tri_btn.js +91 -113
- package/dist/components/common/chem.js +2 -3
- package/dist/components/common/comps.js +2 -2
- package/dist/components/common/draw.js +30 -11
- package/dist/components/d3_line/index.js +154 -176
- package/dist/components/d3_line/line_focus.js +595 -739
- package/dist/components/d3_multi/index.js +153 -174
- package/dist/components/d3_multi/multi_focus.js +725 -850
- package/dist/components/d3_rect/index.js +112 -134
- package/dist/components/d3_rect/rect_focus.js +163 -208
- package/dist/components/forecast/comps.js +60 -68
- package/dist/components/forecast/ir_comps.js +49 -56
- package/dist/components/forecast/ir_viewer.js +61 -68
- package/dist/components/forecast/nmr_comps.js +62 -72
- package/dist/components/forecast/nmr_viewer.js +59 -68
- package/dist/components/forecast/section_loading.js +39 -63
- package/dist/components/forecast_viewer.js +109 -119
- package/dist/components/multi_jcamps_viewer.js +97 -113
- package/dist/components/panel/compare.js +183 -192
- package/dist/components/panel/cyclic_voltamery_data.js +149 -165
- package/dist/components/panel/graph_selection.js +143 -132
- package/dist/components/panel/index.js +112 -144
- package/dist/components/panel/info.js +125 -132
- package/dist/components/panel/multiplicity.js +215 -223
- package/dist/components/panel/multiplicity_coupling.js +108 -136
- package/dist/components/panel/multiplicity_select.js +43 -51
- package/dist/components/panel/peaks.js +130 -132
- package/dist/constants/action_type.js +23 -39
- package/dist/constants/list_layout.js +7 -4
- package/dist/constants/list_shift.js +117 -103
- package/dist/constants/list_ui.js +3 -6
- package/dist/constants/list_wavelength.js +7 -8
- package/dist/fn.js +2 -3
- package/dist/helpers/brush.js +49 -65
- package/dist/helpers/calc.js +2 -4
- package/dist/helpers/carbonFeatures.js +22 -20
- package/dist/helpers/cfg.js +49 -67
- package/dist/helpers/chem.js +450 -393
- package/dist/helpers/compass.js +92 -83
- package/dist/helpers/converter.js +52 -65
- package/dist/helpers/extractParams.js +60 -52
- package/dist/helpers/extractPeaksEdit.js +29 -25
- package/dist/helpers/focus.js +2 -6
- package/dist/helpers/format.js +416 -361
- package/dist/helpers/init.js +41 -37
- package/dist/helpers/integration.js +18 -21
- package/dist/helpers/mount.js +57 -61
- package/dist/helpers/multiplicity.js +19 -24
- package/dist/helpers/multiplicity_calc.js +39 -50
- package/dist/helpers/multiplicity_complat.js +21 -47
- package/dist/helpers/multiplicity_manual.js +49 -55
- package/dist/helpers/multiplicity_verify_basic.js +108 -111
- package/dist/helpers/shift.js +15 -23
- package/dist/helpers/zoom.js +7 -11
- package/dist/index.js +680 -630
- package/dist/layer_content.js +40 -43
- package/dist/layer_init.js +162 -184
- package/dist/layer_prism.js +38 -41
- package/dist/reducers/index.js +2 -3
- package/dist/reducers/reducer_curve.js +35 -26
- package/dist/reducers/reducer_edit_peak.js +122 -98
- package/dist/reducers/reducer_forecast.js +57 -44
- package/dist/reducers/reducer_integration.js +135 -103
- package/dist/reducers/reducer_jcamp.js +49 -44
- package/dist/reducers/reducer_layout.js +5 -6
- package/dist/reducers/reducer_manager.js +5 -6
- package/dist/reducers/reducer_meta.js +5 -6
- package/dist/reducers/reducer_multiplicity.js +100 -77
- package/dist/reducers/reducer_scan.js +17 -20
- package/dist/reducers/reducer_shift.js +115 -70
- package/dist/reducers/reducer_simulation.js +7 -8
- package/dist/reducers/reducer_status.js +5 -6
- package/dist/reducers/reducer_submit.js +12 -15
- package/dist/reducers/reducer_threshold.js +5 -6
- package/dist/reducers/reducer_ui.js +5 -6
- package/dist/reducers/reducer_voltammetry.js +156 -96
- package/dist/reducers/reducer_wavelength.js +5 -6
- package/dist/reducers/undo_redo_config.js +3 -5
- package/dist/sagas/index.js +2 -15
- package/dist/sagas/saga_edit_peak.js +54 -68
- package/dist/sagas/saga_manager.js +86 -130
- package/dist/sagas/saga_meta.js +25 -31
- package/dist/sagas/saga_multi_entities.js +40 -103
- package/dist/sagas/saga_multiplicity.js +336 -406
- package/dist/sagas/saga_ui.js +296 -475
- package/dist/setupTests.js +8 -0
- package/dist/third_party/jAnalyzer.js +66 -67
- package/dist/third_party/peakInterval.js +34 -34
- package/package.json +14 -14
- package/dist/components/cmd_bar/03_peak_bk.js +0 -139
- package/dist/components/cmd_bar/04_integration_bk.js +0 -180
- package/dist/components/cmd_bar/05_multiplicity_bk.js +0 -131
- package/dist/components/cmd_bar/r01_layout_bk.js +0 -186
- package/dist/components/cmd_bar/r06_predict_btn_bk.js +0 -220
- package/dist/components/d3_line/line_focus_bk.js +0 -825
- package/dist/components/d3_multi/index_bk.js +0 -210
- package/dist/components/d3_multi/multi_focus_bk.js +0 -533
- package/dist/components/panel/compare_bk.js +0 -256
- package/dist/components/panel/cyclic_voltamery_data_bk.js +0 -292
- package/dist/components/panel/index_bk.js +0 -178
- package/dist/components/panel/info_bk.js +0 -235
- package/dist/components/panel/multiplicity_bk.js +0 -280
- package/dist/helpers/carbonFeatures_bk.js +0 -45
- package/dist/helpers/cfg_bk.js +0 -80
- package/dist/helpers/chem_bk.js +0 -787
- package/dist/helpers/compass_bk.js +0 -149
- package/dist/helpers/converter_bk.js +0 -96
- package/dist/helpers/extractPeaksEdit_bk.js +0 -53
- package/dist/helpers/format_bk.js +0 -497
- package/dist/index_bk.js +0 -640
- package/dist/layer_content_bk.js +0 -105
- package/dist/layer_init_bk.js +0 -235
- package/dist/layer_prism_bk.js +0 -133
- package/dist/reducers/reducer_edit_peak_bk.js +0 -108
- package/dist/reducers/reducer_integration_bk.js +0 -134
- package/dist/reducers/reducer_jcamp_bk.js +0 -71
- package/dist/reducers/reducer_multiplicity_bk.js +0 -126
- package/dist/reducers/reducer_shift_bk.js +0 -88
- package/dist/reducers/reducer_voltammetry_bk.js +0 -287
- package/dist/sagas/saga_edit_peak_bk.js +0 -73
- package/dist/sagas/saga_multi_entities_bk.js +0 -106
- package/dist/sagas/saga_multiplicity_bk.js +0 -351
- package/dist/sagas/saga_ui_bk.js +0 -453
|
@@ -5,15 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.calcMpyComplat = void 0;
|
|
7
7
|
var _multiplicity = require("./multiplicity");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var type = 'm';
|
|
16
|
-
var js = [];
|
|
8
|
+
const calcMpyComplat = origPeaks => {
|
|
9
|
+
const peaks = origPeaks.sort((a, b) => a.x - b.x);
|
|
10
|
+
const count = peaks.length;
|
|
11
|
+
const itvs = (0, _multiplicity.getInterval)(peaks);
|
|
12
|
+
const gitvs = (0, _multiplicity.groupInterval)(itvs);
|
|
13
|
+
let type = 'm';
|
|
14
|
+
let js = [];
|
|
17
15
|
switch (count) {
|
|
18
16
|
case 1:
|
|
19
17
|
type = 's';
|
|
@@ -22,57 +20,43 @@ var calcMpyComplat = function calcMpyComplat(origPeaks) {
|
|
|
22
20
|
case 2:
|
|
23
21
|
if (gitvs.length === 1) {
|
|
24
22
|
type = 'd';
|
|
25
|
-
js = gitvs.map(
|
|
26
|
-
return g.c;
|
|
27
|
-
});
|
|
23
|
+
js = gitvs.map(g => g.c);
|
|
28
24
|
break;
|
|
29
25
|
}
|
|
30
26
|
break;
|
|
31
27
|
case 3:
|
|
32
28
|
if (gitvs.length === 1) {
|
|
33
29
|
type = 't';
|
|
34
|
-
js = gitvs.map(
|
|
35
|
-
return g.c;
|
|
36
|
-
});
|
|
30
|
+
js = gitvs.map(g => g.c);
|
|
37
31
|
break;
|
|
38
32
|
}
|
|
39
33
|
break;
|
|
40
34
|
case 4:
|
|
41
35
|
if (gitvs.length === 1) {
|
|
42
36
|
type = 'q';
|
|
43
|
-
js = gitvs.map(
|
|
44
|
-
return g.c;
|
|
45
|
-
});
|
|
37
|
+
js = gitvs.map(g => g.c);
|
|
46
38
|
break;
|
|
47
39
|
} else if (gitvs.length === 2) {
|
|
48
40
|
type = 'dd';
|
|
49
|
-
js = gitvs.map(
|
|
50
|
-
return g.c;
|
|
51
|
-
});
|
|
41
|
+
js = gitvs.map(g => g.c);
|
|
52
42
|
break;
|
|
53
43
|
}
|
|
54
44
|
break;
|
|
55
45
|
case 5:
|
|
56
46
|
if (gitvs.length === 1) {
|
|
57
47
|
type = 'quint';
|
|
58
|
-
js = gitvs.map(
|
|
59
|
-
return g.c;
|
|
60
|
-
});
|
|
48
|
+
js = gitvs.map(g => g.c);
|
|
61
49
|
break;
|
|
62
50
|
}
|
|
63
51
|
break;
|
|
64
52
|
case 6:
|
|
65
53
|
if (gitvs.length === 1) {
|
|
66
54
|
type = 'h';
|
|
67
|
-
js = gitvs.map(
|
|
68
|
-
return g.c;
|
|
69
|
-
});
|
|
55
|
+
js = gitvs.map(g => g.c);
|
|
70
56
|
break;
|
|
71
57
|
} else if (gitvs.length === 2) {
|
|
72
58
|
type = 'dt';
|
|
73
|
-
js = gitvs.map(
|
|
74
|
-
return g.c;
|
|
75
|
-
});
|
|
59
|
+
js = gitvs.map(g => g.c);
|
|
76
60
|
break;
|
|
77
61
|
}
|
|
78
62
|
// td
|
|
@@ -80,15 +64,11 @@ var calcMpyComplat = function calcMpyComplat(origPeaks) {
|
|
|
80
64
|
case 7:
|
|
81
65
|
if (gitvs.length === 1) {
|
|
82
66
|
type = 'sept';
|
|
83
|
-
js = gitvs.map(
|
|
84
|
-
return g.c;
|
|
85
|
-
});
|
|
67
|
+
js = gitvs.map(g => g.c);
|
|
86
68
|
break;
|
|
87
69
|
} else if (gitvs.length === 3) {
|
|
88
70
|
type = 'ddd';
|
|
89
|
-
js = gitvs.map(
|
|
90
|
-
return g.c;
|
|
91
|
-
});
|
|
71
|
+
js = gitvs.map(g => g.c);
|
|
92
72
|
break;
|
|
93
73
|
}
|
|
94
74
|
// td
|
|
@@ -96,21 +76,15 @@ var calcMpyComplat = function calcMpyComplat(origPeaks) {
|
|
|
96
76
|
case 8:
|
|
97
77
|
if (gitvs.length === 1) {
|
|
98
78
|
type = 'o';
|
|
99
|
-
js = gitvs.map(
|
|
100
|
-
return g.c;
|
|
101
|
-
});
|
|
79
|
+
js = gitvs.map(g => g.c);
|
|
102
80
|
break;
|
|
103
81
|
} else if (gitvs.length === 2) {
|
|
104
82
|
type = 'dq';
|
|
105
|
-
js = gitvs.map(
|
|
106
|
-
return g.c;
|
|
107
|
-
});
|
|
83
|
+
js = gitvs.map(g => g.c);
|
|
108
84
|
break;
|
|
109
85
|
} else if (gitvs.length === 3) {
|
|
110
86
|
type = 'ddd';
|
|
111
|
-
js = gitvs.map(
|
|
112
|
-
return g.c;
|
|
113
|
-
});
|
|
87
|
+
js = gitvs.map(g => g.c);
|
|
114
88
|
break;
|
|
115
89
|
}
|
|
116
90
|
// td
|
|
@@ -119,8 +93,8 @@ var calcMpyComplat = function calcMpyComplat(origPeaks) {
|
|
|
119
93
|
break;
|
|
120
94
|
}
|
|
121
95
|
return {
|
|
122
|
-
type
|
|
123
|
-
js
|
|
96
|
+
type,
|
|
97
|
+
js
|
|
124
98
|
};
|
|
125
99
|
};
|
|
126
100
|
exports.calcMpyComplat = calcMpyComplat;
|
|
@@ -7,112 +7,106 @@ exports.calcMpyManual = void 0;
|
|
|
7
7
|
var _multiplicity = require("./multiplicity");
|
|
8
8
|
/* eslint-disable prefer-object-spread, default-param-last, no-mixed-operators */
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
js: []
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var outputTypeBasic = function outputTypeBasic(k, mpyType, ivs, freq) {
|
|
23
|
-
var numIvs = ivs.length || 1;
|
|
24
|
-
var js = [freq * ivs.reduce(function (sum, x) {
|
|
25
|
-
return sum + x;
|
|
26
|
-
}) / numIvs];
|
|
10
|
+
const isTypeM = mpyType => mpyType === 'm';
|
|
11
|
+
const isTypeBasic = mpyType => _multiplicity.mpyBasicPatterns.slice(1).indexOf(mpyType) >= 0;
|
|
12
|
+
const outputTypeM = k => Object.assign({}, k, {
|
|
13
|
+
mpyType: 'm',
|
|
14
|
+
js: []
|
|
15
|
+
});
|
|
16
|
+
const outputTypeBasic = (k, mpyType, ivs, freq) => {
|
|
17
|
+
const numIvs = ivs.length || 1;
|
|
18
|
+
const js = [freq * ivs.reduce((sum, x) => sum + x) / numIvs];
|
|
27
19
|
return Object.assign({}, k, {
|
|
28
|
-
mpyType
|
|
29
|
-
js
|
|
20
|
+
mpyType,
|
|
21
|
+
js
|
|
30
22
|
});
|
|
31
23
|
};
|
|
32
|
-
|
|
24
|
+
const outputTypeDD = (k, mpyType, ivs, freq) => {
|
|
33
25
|
if (ivs.length >= 2) {
|
|
34
|
-
|
|
26
|
+
const js = [freq * ivs[0], freq * (ivs[0] + ivs[1])];
|
|
35
27
|
return Object.assign({}, k, {
|
|
36
|
-
mpyType
|
|
37
|
-
js
|
|
28
|
+
mpyType,
|
|
29
|
+
js
|
|
38
30
|
});
|
|
39
31
|
}
|
|
40
32
|
return Object.assign({}, k, {
|
|
41
|
-
mpyType
|
|
33
|
+
mpyType,
|
|
42
34
|
js: []
|
|
43
35
|
});
|
|
44
36
|
};
|
|
45
|
-
|
|
37
|
+
const outputTypeDT = (k, mpyType, ivs, freq) => {
|
|
46
38
|
if (ivs.length >= 4) {
|
|
47
|
-
|
|
39
|
+
const js = [freq * ivs[0], freq * (ivs[1] + ivs[2] + ivs[3])];
|
|
48
40
|
return Object.assign({}, k, {
|
|
49
|
-
mpyType
|
|
50
|
-
js
|
|
41
|
+
mpyType,
|
|
42
|
+
js
|
|
51
43
|
});
|
|
52
44
|
}
|
|
53
45
|
return Object.assign({}, k, {
|
|
54
|
-
mpyType
|
|
46
|
+
mpyType,
|
|
55
47
|
js: []
|
|
56
48
|
});
|
|
57
49
|
};
|
|
58
|
-
|
|
50
|
+
const outputTypeTD = (k, mpyType, ivs, freq) => {
|
|
59
51
|
if (ivs.length >= 2) {
|
|
60
|
-
|
|
52
|
+
const js = [freq * ivs[0], freq * (ivs[0] + ivs[1])];
|
|
61
53
|
return Object.assign({}, k, {
|
|
62
|
-
mpyType
|
|
63
|
-
js
|
|
54
|
+
mpyType,
|
|
55
|
+
js
|
|
64
56
|
});
|
|
65
57
|
}
|
|
66
58
|
return Object.assign({}, k, {
|
|
67
|
-
mpyType
|
|
59
|
+
mpyType,
|
|
68
60
|
js: []
|
|
69
61
|
});
|
|
70
62
|
};
|
|
71
|
-
|
|
63
|
+
const outputTypeDQ = (k, mpyType, ivs, freq) => {
|
|
72
64
|
if (ivs.length >= 2) {
|
|
73
|
-
|
|
65
|
+
const js = [freq * ivs[0], freq * (ivs[0] + ivs[1])];
|
|
74
66
|
return Object.assign({}, k, {
|
|
75
|
-
mpyType
|
|
76
|
-
js
|
|
67
|
+
mpyType,
|
|
68
|
+
js
|
|
77
69
|
});
|
|
78
70
|
} // only consider J = ([1,2], [1,3]), not J = ([1,2], [1,5])
|
|
79
71
|
return Object.assign({}, k, {
|
|
80
|
-
mpyType
|
|
72
|
+
mpyType,
|
|
81
73
|
js: []
|
|
82
74
|
});
|
|
83
75
|
};
|
|
84
|
-
|
|
76
|
+
const outputTypeQD = (k, mpyType, ivs, freq) => {
|
|
85
77
|
if (ivs.length >= 2) {
|
|
86
|
-
|
|
78
|
+
const js = [freq * ivs[0], freq * (ivs[0] + ivs[1])];
|
|
87
79
|
return Object.assign({}, k, {
|
|
88
|
-
mpyType
|
|
89
|
-
js
|
|
80
|
+
mpyType,
|
|
81
|
+
js
|
|
90
82
|
});
|
|
91
83
|
}
|
|
92
84
|
return Object.assign({}, k, {
|
|
93
|
-
mpyType
|
|
85
|
+
mpyType,
|
|
94
86
|
js: []
|
|
95
87
|
});
|
|
96
88
|
};
|
|
97
|
-
|
|
89
|
+
const outputTypeDDD = (k, mpyType, ivs, freq) => {
|
|
98
90
|
if (ivs.length >= 3) {
|
|
99
|
-
|
|
91
|
+
const js = [freq * ivs[0], freq * (ivs[0] + ivs[1]), freq * (ivs[0] + ivs[1] + ivs[2] + ivs[3])];
|
|
100
92
|
return Object.assign({}, k, {
|
|
101
|
-
mpyType
|
|
102
|
-
js
|
|
93
|
+
mpyType,
|
|
94
|
+
js
|
|
103
95
|
});
|
|
104
96
|
}
|
|
105
97
|
return Object.assign({}, k, {
|
|
106
|
-
mpyType
|
|
98
|
+
mpyType,
|
|
107
99
|
js: []
|
|
108
100
|
});
|
|
109
101
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
const calcMpyManual = (k, mpyType, metaSt) => {
|
|
103
|
+
const {
|
|
104
|
+
observeFrequency
|
|
105
|
+
} = metaSt.peaks;
|
|
106
|
+
const freq = observeFrequency || 1.0;
|
|
107
|
+
const ivs = (0, _multiplicity.getInterval)(k.peaks);
|
|
114
108
|
if (ivs.length === 0) return Object.assign({}, k, {
|
|
115
|
-
mpyType
|
|
109
|
+
mpyType,
|
|
116
110
|
js: []
|
|
117
111
|
});
|
|
118
112
|
if (isTypeM(mpyType)) return outputTypeM(k);
|
|
@@ -124,7 +118,7 @@ var calcMpyManual = function calcMpyManual(k, mpyType, metaSt) {
|
|
|
124
118
|
if (mpyType === 'qd') return outputTypeQD(k, mpyType, ivs, freq);
|
|
125
119
|
if (mpyType === 'ddd') return outputTypeDDD(k, mpyType, ivs, freq);
|
|
126
120
|
return Object.assign({}, k, {
|
|
127
|
-
mpyType
|
|
121
|
+
mpyType,
|
|
128
122
|
js: []
|
|
129
123
|
});
|
|
130
124
|
};
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.verifyTypeT = exports.verifyTypeSept = exports.verifyTypeQuint = exports.verifyTypeQ = exports.verifyTypePeakCount = exports.verifyTypeO = exports.verifyTypeH = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
7
|
/* eslint-disable prefer-object-spread, default-param-last, no-mixed-operators */
|
|
10
8
|
// ---------------------------------------------------------------
|
|
11
9
|
// verifyTypePeakCount
|
|
12
10
|
// ---------------------------------------------------------------
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
limit *=
|
|
12
|
+
const verifyTypePeakCount = (type, peaks) => {
|
|
13
|
+
const isBasicWrong = type === 's' && peaks.length > 1 || type === 'd' && peaks.length > 2 || type === 't' && peaks.length > 3 || type === 'q' && peaks.length > 4 || type === 'quint' && peaks.length > 5 || type === 'h' && peaks.length > 6 || type === 'sept' && peaks.length > 7 || type === 'o' && peaks.length > 8 || type === 'n' && peaks.length > 9;
|
|
14
|
+
let limit = 1;
|
|
15
|
+
let mStr = type;
|
|
16
|
+
limit *= 5 ** (mStr.match(/quint/g) || []).length;
|
|
19
17
|
mStr = mStr.replace(/quint/g, '');
|
|
20
|
-
limit *=
|
|
18
|
+
limit *= 7 ** (mStr.match(/sept/g) || []).length;
|
|
21
19
|
mStr = mStr.replace(/sept/g, '');
|
|
22
|
-
limit *=
|
|
20
|
+
limit *= 2 ** (mStr.match(/d/g) || []).length;
|
|
23
21
|
mStr = mStr.replace(/d/g, '');
|
|
24
|
-
limit *=
|
|
22
|
+
limit *= 3 ** (mStr.match(/t/g) || []).length;
|
|
25
23
|
mStr = mStr.replace(/t/g, '');
|
|
26
|
-
limit *=
|
|
24
|
+
limit *= 4 ** (mStr.match(/q/g) || []).length;
|
|
27
25
|
mStr = mStr.replace(/q/g, '');
|
|
28
|
-
limit *=
|
|
26
|
+
limit *= 6 ** (mStr.match(/h/g) || []).length;
|
|
29
27
|
mStr = mStr.replace(/h/g, '');
|
|
30
|
-
limit *=
|
|
28
|
+
limit *= 8 ** (mStr.match(/o/g) || []).length;
|
|
31
29
|
mStr = mStr.replace(/o/g, '');
|
|
32
|
-
limit *=
|
|
30
|
+
limit *= 9 ** (mStr.match(/n/g) || []).length;
|
|
33
31
|
mStr = mStr.replace(/n/g, '');
|
|
34
|
-
|
|
32
|
+
const isAdvanWrong = peaks.length > limit;
|
|
35
33
|
return !(isBasicWrong || isAdvanWrong);
|
|
36
34
|
};
|
|
37
35
|
|
|
@@ -39,47 +37,41 @@ var verifyTypePeakCount = function verifyTypePeakCount(type, peaks) {
|
|
|
39
37
|
// Basic Multiplicity verification
|
|
40
38
|
// ---------------------------------------------------------------
|
|
41
39
|
exports.verifyTypePeakCount = verifyTypePeakCount;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var tolerance = Math.abs(tTolerance * faktor);
|
|
58
|
-
var roivs = oivs.map(function (oiv) {
|
|
59
|
-
return oiv / ref;
|
|
60
|
-
});
|
|
61
|
-
var rsivs = sivs.map(function (siv) {
|
|
62
|
-
return siv / ref;
|
|
63
|
-
});
|
|
40
|
+
const allowedTolerance = 0.15;
|
|
41
|
+
const faktor = 1.1;
|
|
42
|
+
const passRuleIntervalCounts = (oivs, limit) => oivs.length === limit;
|
|
43
|
+
const getRuleParams = (oivs, metaSt) => {
|
|
44
|
+
const {
|
|
45
|
+
deltaX,
|
|
46
|
+
observeFrequency
|
|
47
|
+
} = metaSt.peaks;
|
|
48
|
+
const sivs = [...oivs].sort((a, b) => b - a);
|
|
49
|
+
const ref = sivs[0];
|
|
50
|
+
const rDeltaX = Math.abs(2 * deltaX / ref);
|
|
51
|
+
const tTolerance = rDeltaX > allowedTolerance ? rDeltaX : allowedTolerance;
|
|
52
|
+
const tolerance = Math.abs(tTolerance * faktor);
|
|
53
|
+
const roivs = oivs.map(oiv => oiv / ref);
|
|
54
|
+
const rsivs = sivs.map(siv => siv / ref);
|
|
64
55
|
return {
|
|
65
|
-
roivs
|
|
66
|
-
rsivs
|
|
67
|
-
tolerance
|
|
68
|
-
observeFrequency
|
|
56
|
+
roivs,
|
|
57
|
+
rsivs,
|
|
58
|
+
tolerance,
|
|
59
|
+
observeFrequency
|
|
69
60
|
};
|
|
70
61
|
};
|
|
71
|
-
|
|
62
|
+
const verifyTypeT = (type, js, oivs, metaSt) => {
|
|
72
63
|
if (!passRuleIntervalCounts(oivs, 2)) return {
|
|
73
64
|
type: 'm',
|
|
74
65
|
js: []
|
|
75
66
|
};
|
|
76
|
-
|
|
77
|
-
rsivs
|
|
78
|
-
tolerance
|
|
79
|
-
|
|
67
|
+
const {
|
|
68
|
+
rsivs,
|
|
69
|
+
tolerance
|
|
70
|
+
} = getRuleParams(oivs, metaSt);
|
|
71
|
+
const isT = Math.abs(rsivs[0] - rsivs[1]) < tolerance;
|
|
80
72
|
if (isT) return {
|
|
81
|
-
type
|
|
82
|
-
js
|
|
73
|
+
type,
|
|
74
|
+
js
|
|
83
75
|
};
|
|
84
76
|
return {
|
|
85
77
|
type: 'm',
|
|
@@ -87,23 +79,24 @@ var verifyTypeT = function verifyTypeT(type, js, oivs, metaSt) {
|
|
|
87
79
|
};
|
|
88
80
|
};
|
|
89
81
|
exports.verifyTypeT = verifyTypeT;
|
|
90
|
-
|
|
82
|
+
const verifyTypeQ = (type, js, oivs, metaSt) => {
|
|
91
83
|
if (!passRuleIntervalCounts(oivs, 3)) return {
|
|
92
84
|
type: 'm',
|
|
93
85
|
js: []
|
|
94
86
|
};
|
|
95
|
-
|
|
96
|
-
roivs
|
|
97
|
-
rsivs
|
|
98
|
-
tolerance
|
|
99
|
-
observeFrequency
|
|
100
|
-
|
|
87
|
+
const {
|
|
88
|
+
roivs,
|
|
89
|
+
rsivs,
|
|
90
|
+
tolerance,
|
|
91
|
+
observeFrequency
|
|
92
|
+
} = getRuleParams(oivs, metaSt);
|
|
93
|
+
const isQ = Math.abs(rsivs[0] - rsivs[2]) < tolerance;
|
|
101
94
|
if (isQ) return {
|
|
102
|
-
type
|
|
103
|
-
js
|
|
95
|
+
type,
|
|
96
|
+
js
|
|
104
97
|
};
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
const isDD = Math.abs(roivs[0] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[1]) >= tolerance;
|
|
99
|
+
const ddJs = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency];
|
|
107
100
|
if (isDD) return {
|
|
108
101
|
type: 'dd',
|
|
109
102
|
js: ddJs
|
|
@@ -114,18 +107,19 @@ var verifyTypeQ = function verifyTypeQ(type, js, oivs, metaSt) {
|
|
|
114
107
|
};
|
|
115
108
|
};
|
|
116
109
|
exports.verifyTypeQ = verifyTypeQ;
|
|
117
|
-
|
|
110
|
+
const verifyTypeQuint = (type, js, oivs, metaSt) => {
|
|
118
111
|
if (!passRuleIntervalCounts(oivs, 4)) return {
|
|
119
112
|
type: 'm',
|
|
120
113
|
js: []
|
|
121
114
|
};
|
|
122
|
-
|
|
123
|
-
rsivs
|
|
124
|
-
tolerance
|
|
125
|
-
|
|
115
|
+
const {
|
|
116
|
+
rsivs,
|
|
117
|
+
tolerance
|
|
118
|
+
} = getRuleParams(oivs, metaSt);
|
|
119
|
+
const isQuint = Math.abs(rsivs[0] - rsivs[3]) < tolerance;
|
|
126
120
|
if (isQuint) return {
|
|
127
|
-
type
|
|
128
|
-
js
|
|
121
|
+
type,
|
|
122
|
+
js
|
|
129
123
|
};
|
|
130
124
|
return {
|
|
131
125
|
type: 'm',
|
|
@@ -133,35 +127,36 @@ var verifyTypeQuint = function verifyTypeQuint(type, js, oivs, metaSt) {
|
|
|
133
127
|
};
|
|
134
128
|
};
|
|
135
129
|
exports.verifyTypeQuint = verifyTypeQuint;
|
|
136
|
-
|
|
130
|
+
const verifyTypeH = (type, js, oivs, metaSt) => {
|
|
137
131
|
if (!passRuleIntervalCounts(oivs, 5)) return {
|
|
138
132
|
type: 'm',
|
|
139
133
|
js: []
|
|
140
134
|
};
|
|
141
|
-
|
|
142
|
-
roivs
|
|
143
|
-
rsivs
|
|
144
|
-
tolerance
|
|
145
|
-
observeFrequency
|
|
146
|
-
|
|
135
|
+
const {
|
|
136
|
+
roivs,
|
|
137
|
+
rsivs,
|
|
138
|
+
tolerance,
|
|
139
|
+
observeFrequency
|
|
140
|
+
} = getRuleParams(oivs, metaSt);
|
|
141
|
+
const isH = Math.abs(rsivs[0] - rsivs[4]) < tolerance;
|
|
147
142
|
if (isH) return {
|
|
148
|
-
type
|
|
149
|
-
js
|
|
143
|
+
type,
|
|
144
|
+
js
|
|
150
145
|
};
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
const isTD = Math.abs(roivs[0] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[4]) < tolerance && Math.abs(roivs[1] - roivs[3]) < tolerance && Math.abs(roivs[0] - roivs[1]) >= tolerance;
|
|
147
|
+
const tdJs = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency];
|
|
153
148
|
if (isTD) return {
|
|
154
149
|
type: 'td',
|
|
155
150
|
js: tdJs
|
|
156
151
|
};
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
const isDT1 = Math.abs(roivs[0] - roivs[1]) < tolerance && Math.abs(roivs[0] - roivs[3]) < tolerance && Math.abs(roivs[0] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[2]) >= tolerance;
|
|
153
|
+
const dt1Js = [oivs[0] * observeFrequency, (oivs[1] + oivs[2] + oivs[3]) * observeFrequency];
|
|
159
154
|
if (isDT1) return {
|
|
160
155
|
type: 'dt',
|
|
161
156
|
js: dt1Js
|
|
162
157
|
};
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
const isDT2 = Math.abs(roivs[0] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[1] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[2] - roivs[3]) < tolerance && Math.abs(roivs[0] - roivs[2]) >= tolerance;
|
|
159
|
+
const dt2Js = [oivs[0] * observeFrequency, (oivs[1] + oivs[2] + oivs[3]) * observeFrequency];
|
|
165
160
|
if (isDT2) return {
|
|
166
161
|
type: 'dt',
|
|
167
162
|
js: dt2Js
|
|
@@ -172,23 +167,24 @@ var verifyTypeH = function verifyTypeH(type, js, oivs, metaSt) {
|
|
|
172
167
|
};
|
|
173
168
|
};
|
|
174
169
|
exports.verifyTypeH = verifyTypeH;
|
|
175
|
-
|
|
170
|
+
const verifyTypeSept = (type, js, oivs, metaSt) => {
|
|
176
171
|
if (!passRuleIntervalCounts(oivs, 6)) return {
|
|
177
172
|
type: 'm',
|
|
178
173
|
js: []
|
|
179
174
|
};
|
|
180
|
-
|
|
181
|
-
roivs
|
|
182
|
-
rsivs
|
|
183
|
-
tolerance
|
|
184
|
-
observeFrequency
|
|
185
|
-
|
|
175
|
+
const {
|
|
176
|
+
roivs,
|
|
177
|
+
rsivs,
|
|
178
|
+
tolerance,
|
|
179
|
+
observeFrequency
|
|
180
|
+
} = getRuleParams(oivs, metaSt);
|
|
181
|
+
const isSept = Math.abs(rsivs[0] - rsivs[5]) < tolerance;
|
|
186
182
|
if (isSept) return {
|
|
187
|
-
type
|
|
188
|
-
js
|
|
183
|
+
type,
|
|
184
|
+
js
|
|
189
185
|
};
|
|
190
|
-
|
|
191
|
-
|
|
186
|
+
const isDDD = Math.abs(roivs[0] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[3]) < tolerance && Math.abs(roivs[0] - roivs[5]) < tolerance && Math.abs(roivs[1] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[1]) >= tolerance;
|
|
187
|
+
const dddJs = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency, (oivs[0] + oivs[1] + oivs[2]) * observeFrequency];
|
|
192
188
|
if (isDDD) return {
|
|
193
189
|
type: 'ddd',
|
|
194
190
|
js: dddJs
|
|
@@ -199,47 +195,48 @@ var verifyTypeSept = function verifyTypeSept(type, js, oivs, metaSt) {
|
|
|
199
195
|
};
|
|
200
196
|
};
|
|
201
197
|
exports.verifyTypeSept = verifyTypeSept;
|
|
202
|
-
|
|
198
|
+
const verifyTypeO = (type, js, oivs, metaSt) => {
|
|
203
199
|
if (!passRuleIntervalCounts(oivs, 7)) return {
|
|
204
200
|
type: 'm',
|
|
205
201
|
js: []
|
|
206
202
|
};
|
|
207
|
-
|
|
208
|
-
roivs
|
|
209
|
-
rsivs
|
|
210
|
-
tolerance
|
|
211
|
-
observeFrequency
|
|
212
|
-
|
|
203
|
+
const {
|
|
204
|
+
roivs,
|
|
205
|
+
rsivs,
|
|
206
|
+
tolerance,
|
|
207
|
+
observeFrequency
|
|
208
|
+
} = getRuleParams(oivs, metaSt);
|
|
209
|
+
const isO = Math.abs(rsivs[0] - rsivs[6]) < tolerance;
|
|
213
210
|
if (isO) return {
|
|
214
|
-
type
|
|
215
|
-
js
|
|
211
|
+
type,
|
|
212
|
+
js
|
|
216
213
|
};
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
const isQD = Math.abs(roivs[0] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[6]) < tolerance && Math.abs(roivs[1] - roivs[3]) < tolerance && Math.abs(roivs[1] - roivs[5]) < tolerance;
|
|
215
|
+
const qdJs = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency];
|
|
219
216
|
if (isQD) return {
|
|
220
217
|
type: 'qd',
|
|
221
218
|
js: qdJs
|
|
222
219
|
};
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
const isDQ1 = Math.abs(roivs[0] - roivs[1] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[2] - roivs[3]) < tolerance && Math.abs(roivs[0] - roivs[3] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[4] - roivs[5]) < tolerance && Math.abs(roivs[0] - roivs[6]) < tolerance && Math.abs(roivs[1] - roivs[5]) < tolerance;
|
|
221
|
+
const dq1Js = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency];
|
|
225
222
|
if (isDQ1) return {
|
|
226
223
|
type: 'dq',
|
|
227
224
|
js: dq1Js
|
|
228
225
|
};
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
const isDQ2 = Math.abs(roivs[0] - roivs[1]) < tolerance && Math.abs(roivs[0] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[5]) < tolerance && Math.abs(roivs[0] - roivs[6]) < tolerance && Math.abs(roivs[0] - roivs[3]) >= tolerance;
|
|
227
|
+
const dq2Js = [oivs[0] * observeFrequency, (oivs[0] + oivs[1] + oivs[2] + oivs[3]) * observeFrequency];
|
|
231
228
|
if (isDQ2) return {
|
|
232
229
|
type: 'dq',
|
|
233
230
|
js: dq2Js
|
|
234
231
|
};
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
const isDDD1 = Math.abs(roivs[0] - roivs[2]) < tolerance && Math.abs(roivs[0] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[6]) < tolerance && Math.abs(roivs[1] - roivs[5]) < tolerance;
|
|
233
|
+
const ddd1Js = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency, (oivs[0] + oivs[1] + oivs[2] + oivs[3]) * observeFrequency];
|
|
237
234
|
if (isDDD1) return {
|
|
238
235
|
type: 'ddd',
|
|
239
236
|
js: ddd1Js
|
|
240
237
|
};
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
const isDDD2 = Math.abs(roivs[0] - roivs[2] - roivs[3]) < tolerance && Math.abs(roivs[0] - roivs[3] - roivs[4]) < tolerance && Math.abs(roivs[0] - roivs[6]) < tolerance && Math.abs(roivs[1] - roivs[5]) < tolerance && Math.abs(roivs[0] - roivs[1]) >= tolerance;
|
|
239
|
+
const ddd2Js = [oivs[0] * observeFrequency, (oivs[0] + oivs[1]) * observeFrequency, (oivs[0] + oivs[1] + oivs[2]) * observeFrequency];
|
|
243
240
|
if (isDDD2) return {
|
|
244
241
|
type: 'ddd',
|
|
245
242
|
js: ddd2Js
|