@zakodium/nmrium-core-plugins-ui 0.1.50 → 0.1.52
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/lib/plugins/spectrum_1d_processings_ui/operators/apodization.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.d.ts +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.js +2 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.d.ts +3 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.d.ts.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.js +43 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.js.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.d.ts +54 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.js +20 -2
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.js +4 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.d.ts +3 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.d.ts.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.js +22 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.js.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.d.ts +3 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.d.ts.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.js +21 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.js.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.d.ts +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.d.ts +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.d.ts +2 -0
- package/lib/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization.ts +2 -0
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx +77 -0
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts +30 -3
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction.ts +4 -0
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.tsx +28 -0
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.tsx +48 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apodization.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,qGAUxB,CAAC"}
|
|
@@ -392,6 +392,7 @@ export declare function useApodizationForm(props: ProcessingOperatorUISettingsFo
|
|
|
392
392
|
readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
|
|
393
393
|
readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
|
|
394
394
|
readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
|
|
395
|
+
readonly TextArea: typeof import("react-science/ui")._TextArea;
|
|
395
396
|
}, {
|
|
396
397
|
readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
|
|
397
398
|
readonly ResetButton: typeof import("react-science/ui")._ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAkBnF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC
|
|
1
|
+
{"version":3,"file":"apodization.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAkBnF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqC5F"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
2
|
+
import { ApodizationChartSVG } from "./apodization_chart_svg.js";
|
|
2
3
|
import { ApodizationExpanded } from "./apodization_expanded.js";
|
|
3
4
|
import { ApodizationTool } from "./apodization_tool.js";
|
|
4
5
|
import { ApodizationTopBar } from "./apodization_topbar.js";
|
|
@@ -11,5 +12,6 @@ export const apodization1D = defineProcessingOperatorUI({
|
|
|
11
12
|
Expanded: ApodizationExpanded,
|
|
12
13
|
Tool: ApodizationTool,
|
|
13
14
|
TopBar: ApodizationTopBar,
|
|
15
|
+
ChartSVG: ApodizationChartSVG,
|
|
14
16
|
});
|
|
15
17
|
//# sourceMappingURL=apodization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA4B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,aAAa,GAAG,0BAA0B,CAAC;IACtD,EAAE,EAAE,6CAA6C;IACjD,IAAI,EAAE,sBAAsB;IAC5B,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,uBAAuB,EAAE,KAAK;IAC9B,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"apodization.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA4B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,aAAa,GAAG,0BAA0B,CAAC;IACtD,EAAE,EAAE,6CAA6C;IACjD,IAAI,EAAE,sBAAsB;IAC5B,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,uBAAuB,EAAE,KAAK;IAC9B,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,iBAAiB;IACzB,QAAQ,EAAE,mBAAmB;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProcessingOperatorUIChartSVGProps } from '@zakodium/nmrium-core';
|
|
2
|
+
export declare function ApodizationChartSVG(props: ProcessingOperatorUIChartSVGProps<'@zakodium/nmrium-core-plugins#apodization1D'>): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=apodization_chart_svg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apodization_chart_svg.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAS/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iCAAiC,CAAC,6CAA6C,CAAC,+BAwBxF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
+
import { assertDefined } from '@zakodium/utils';
|
|
4
|
+
import { xyReduce } from 'ml-spectra-processing';
|
|
5
|
+
import { createApodizationWindowData } from 'nmr-processing';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
8
|
+
export function ApodizationChartSVG(props) {
|
|
9
|
+
const { spectrum, operation, width, scaleX, scaleY, indicatorLineColor } = props;
|
|
10
|
+
castSpectrum1D(spectrum);
|
|
11
|
+
const { x } = spectrum.data;
|
|
12
|
+
const path = useApodizationPath({
|
|
13
|
+
x,
|
|
14
|
+
width,
|
|
15
|
+
scaleX,
|
|
16
|
+
scaleY,
|
|
17
|
+
shapes: operation.settings,
|
|
18
|
+
});
|
|
19
|
+
return (_jsx("path", { "data-testid": "@zakodium/nmrium-core-plugins#apodization1D#indicator", stroke: indicatorLineColor, fill: "none", strokeWidth: "2", d: path.toString() }));
|
|
20
|
+
}
|
|
21
|
+
function useApodizationPath(props) {
|
|
22
|
+
const { x, width, scaleX, scaleY, shapes } = props;
|
|
23
|
+
return useMemo(() => {
|
|
24
|
+
const builder = new SVGPathBuilder();
|
|
25
|
+
const from = x.at(-1);
|
|
26
|
+
const to = x[0];
|
|
27
|
+
assertDefined(from);
|
|
28
|
+
assertDefined(to);
|
|
29
|
+
const length = x.length;
|
|
30
|
+
const dw = (from - to) / (length - 1);
|
|
31
|
+
const y = createApodizationWindowData({
|
|
32
|
+
windowOptions: { dw, length },
|
|
33
|
+
shapes,
|
|
34
|
+
});
|
|
35
|
+
const pathPoints = xyReduce({ x, y }, { from, to, nbPoints: width * 4, optimize: true });
|
|
36
|
+
builder.moveTo(scaleX(pathPoints.x[0]), scaleY(pathPoints.y[0]));
|
|
37
|
+
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
38
|
+
builder.lineTo(scaleX(pathPoints.x[i]), scaleY(pathPoints.y[i]));
|
|
39
|
+
}
|
|
40
|
+
return builder;
|
|
41
|
+
}, [x, shapes, width, scaleX, scaleY]);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=apodization_chart_svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apodization_chart_svg.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_chart_svg.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,mBAAmB,CACjC,KAAuF;IAEvF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,GACtE,KAAK,CAAC;IACR,cAAc,CAAC,QAAQ,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;IAE5B,MAAM,IAAI,GAAG,kBAAkB,CAAC;QAC9B,CAAC;QACD,KAAK;QACL,MAAM;QACN,MAAM;QACN,MAAM,EAAE,SAAS,CAAC,QAAQ;KAC3B,CAAC,CAAC;IAEH,OAAO,CACL,8BACc,uDAAuD,EACnE,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAC,MAAM,EACX,WAAW,EAAC,GAAG,EACf,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,GAClB,CACH,CAAC;AACJ,CAAC;AAUD,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEnD,OAAO,OAAO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M,EAAE,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase_correction.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phase_correction.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,yGAW5B,CAAC"}
|
|
@@ -2,124 +2,172 @@ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-cor
|
|
|
2
2
|
export declare function usePhaseCorrectionForm(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): {
|
|
3
3
|
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<{
|
|
4
4
|
mode: "absolute";
|
|
5
|
+
pivotIndex?: number | undefined;
|
|
5
6
|
} | {
|
|
6
7
|
mode: "manual";
|
|
7
8
|
ph0: number;
|
|
8
9
|
ph1: number;
|
|
10
|
+
pivotIndex?: number | undefined;
|
|
9
11
|
} | {
|
|
10
12
|
mode: "automatic-compute";
|
|
13
|
+
pivotIndex?: number | undefined;
|
|
11
14
|
} | {
|
|
12
15
|
mode: "automatic-info";
|
|
16
|
+
pivotIndex?: number | undefined;
|
|
13
17
|
}, import("@tanstack/react-form").FormValidateOrFn<{
|
|
14
18
|
mode: "absolute";
|
|
19
|
+
pivotIndex?: number | undefined;
|
|
15
20
|
} | {
|
|
16
21
|
mode: "manual";
|
|
17
22
|
ph0: number;
|
|
18
23
|
ph1: number;
|
|
24
|
+
pivotIndex?: number | undefined;
|
|
19
25
|
} | {
|
|
20
26
|
mode: "automatic-compute";
|
|
27
|
+
pivotIndex?: number | undefined;
|
|
21
28
|
} | {
|
|
22
29
|
mode: "automatic-info";
|
|
30
|
+
pivotIndex?: number | undefined;
|
|
23
31
|
}> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
|
|
24
32
|
mode: "absolute";
|
|
33
|
+
pivotIndex?: number | undefined;
|
|
25
34
|
} | {
|
|
26
35
|
mode: "manual";
|
|
27
36
|
ph0: number;
|
|
28
37
|
ph1: number;
|
|
38
|
+
pivotIndex?: number | undefined;
|
|
29
39
|
} | {
|
|
30
40
|
mode: "automatic-compute";
|
|
41
|
+
pivotIndex?: number | undefined;
|
|
31
42
|
} | {
|
|
32
43
|
mode: "automatic-info";
|
|
44
|
+
pivotIndex?: number | undefined;
|
|
33
45
|
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
34
46
|
mode: "absolute";
|
|
47
|
+
pivotIndex?: number | undefined;
|
|
35
48
|
} | {
|
|
36
49
|
mode: "manual";
|
|
37
50
|
ph0: number;
|
|
38
51
|
ph1: number;
|
|
52
|
+
pivotIndex?: number | undefined;
|
|
39
53
|
} | {
|
|
40
54
|
mode: "automatic-compute";
|
|
55
|
+
pivotIndex?: number | undefined;
|
|
41
56
|
} | {
|
|
42
57
|
mode: "automatic-info";
|
|
58
|
+
pivotIndex?: number | undefined;
|
|
43
59
|
}> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
|
|
44
60
|
mode: "absolute";
|
|
61
|
+
pivotIndex?: number | undefined;
|
|
45
62
|
} | {
|
|
46
63
|
mode: "manual";
|
|
47
64
|
ph0: number;
|
|
48
65
|
ph1: number;
|
|
66
|
+
pivotIndex?: number | undefined;
|
|
49
67
|
} | {
|
|
50
68
|
mode: "automatic-compute";
|
|
69
|
+
pivotIndex?: number | undefined;
|
|
51
70
|
} | {
|
|
52
71
|
mode: "automatic-info";
|
|
72
|
+
pivotIndex?: number | undefined;
|
|
53
73
|
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
54
74
|
mode: "absolute";
|
|
75
|
+
pivotIndex?: number | undefined;
|
|
55
76
|
} | {
|
|
56
77
|
mode: "manual";
|
|
57
78
|
ph0: number;
|
|
58
79
|
ph1: number;
|
|
80
|
+
pivotIndex?: number | undefined;
|
|
59
81
|
} | {
|
|
60
82
|
mode: "automatic-compute";
|
|
83
|
+
pivotIndex?: number | undefined;
|
|
61
84
|
} | {
|
|
62
85
|
mode: "automatic-info";
|
|
86
|
+
pivotIndex?: number | undefined;
|
|
63
87
|
}> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
|
|
64
88
|
mode: "absolute";
|
|
89
|
+
pivotIndex?: number | undefined;
|
|
65
90
|
} | {
|
|
66
91
|
mode: "manual";
|
|
67
92
|
ph0: number;
|
|
68
93
|
ph1: number;
|
|
94
|
+
pivotIndex?: number | undefined;
|
|
69
95
|
} | {
|
|
70
96
|
mode: "automatic-compute";
|
|
97
|
+
pivotIndex?: number | undefined;
|
|
71
98
|
} | {
|
|
72
99
|
mode: "automatic-info";
|
|
100
|
+
pivotIndex?: number | undefined;
|
|
73
101
|
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
74
102
|
mode: "absolute";
|
|
103
|
+
pivotIndex?: number | undefined;
|
|
75
104
|
} | {
|
|
76
105
|
mode: "manual";
|
|
77
106
|
ph0: number;
|
|
78
107
|
ph1: number;
|
|
108
|
+
pivotIndex?: number | undefined;
|
|
79
109
|
} | {
|
|
80
110
|
mode: "automatic-compute";
|
|
111
|
+
pivotIndex?: number | undefined;
|
|
81
112
|
} | {
|
|
82
113
|
mode: "automatic-info";
|
|
114
|
+
pivotIndex?: number | undefined;
|
|
83
115
|
}> | undefined, import("zod").ZodType<{
|
|
84
116
|
mode: "absolute";
|
|
117
|
+
pivotIndex?: number | undefined;
|
|
85
118
|
} | {
|
|
86
119
|
mode: "manual";
|
|
87
120
|
ph0: number;
|
|
88
121
|
ph1: number;
|
|
122
|
+
pivotIndex?: number | undefined;
|
|
89
123
|
} | {
|
|
90
124
|
mode: "automatic-compute";
|
|
125
|
+
pivotIndex?: number | undefined;
|
|
91
126
|
} | {
|
|
92
127
|
mode: "automatic-info";
|
|
128
|
+
pivotIndex?: number | undefined;
|
|
93
129
|
}, any, import("zod/v4/core").$ZodTypeInternals<{
|
|
94
130
|
mode: "absolute";
|
|
131
|
+
pivotIndex?: number | undefined;
|
|
95
132
|
} | {
|
|
96
133
|
mode: "manual";
|
|
97
134
|
ph0: number;
|
|
98
135
|
ph1: number;
|
|
136
|
+
pivotIndex?: number | undefined;
|
|
99
137
|
} | {
|
|
100
138
|
mode: "automatic-compute";
|
|
139
|
+
pivotIndex?: number | undefined;
|
|
101
140
|
} | {
|
|
102
141
|
mode: "automatic-info";
|
|
142
|
+
pivotIndex?: number | undefined;
|
|
103
143
|
}, any>>, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
104
144
|
mode: "absolute";
|
|
145
|
+
pivotIndex?: number | undefined;
|
|
105
146
|
} | {
|
|
106
147
|
mode: "manual";
|
|
107
148
|
ph0: number;
|
|
108
149
|
ph1: number;
|
|
150
|
+
pivotIndex?: number | undefined;
|
|
109
151
|
} | {
|
|
110
152
|
mode: "automatic-compute";
|
|
153
|
+
pivotIndex?: number | undefined;
|
|
111
154
|
} | {
|
|
112
155
|
mode: "automatic-info";
|
|
156
|
+
pivotIndex?: number | undefined;
|
|
113
157
|
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
114
158
|
mode: "absolute";
|
|
159
|
+
pivotIndex?: number | undefined;
|
|
115
160
|
} | {
|
|
116
161
|
mode: "manual";
|
|
117
162
|
ph0: number;
|
|
118
163
|
ph1: number;
|
|
164
|
+
pivotIndex?: number | undefined;
|
|
119
165
|
} | {
|
|
120
166
|
mode: "automatic-compute";
|
|
167
|
+
pivotIndex?: number | undefined;
|
|
121
168
|
} | {
|
|
122
169
|
mode: "automatic-info";
|
|
170
|
+
pivotIndex?: number | undefined;
|
|
123
171
|
}> | undefined, unknown, {
|
|
124
172
|
readonly Input: typeof import("react-science/ui")._Input;
|
|
125
173
|
readonly NumericInput: typeof import("react-science/ui")._NumericInput;
|
|
@@ -129,6 +177,7 @@ export declare function usePhaseCorrectionForm(props: ProcessingOperatorUISettin
|
|
|
129
177
|
readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
|
|
130
178
|
readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
|
|
131
179
|
readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
|
|
180
|
+
readonly TextArea: typeof import("react-science/ui")._TextArea;
|
|
132
181
|
}, {
|
|
133
182
|
readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
|
|
134
183
|
readonly ResetButton: typeof import("react-science/ui")._ResetButton;
|
|
@@ -137,14 +186,18 @@ export declare function usePhaseCorrectionForm(props: ProcessingOperatorUISettin
|
|
|
137
186
|
selectModeProps: Pick<import("react-science/ui").SelectProps, "itemDisabled" | "items">;
|
|
138
187
|
appFieldModeListeners: import("@tanstack/react-form").FieldListeners<{
|
|
139
188
|
mode: "absolute";
|
|
189
|
+
pivotIndex?: number | undefined;
|
|
140
190
|
} | {
|
|
141
191
|
mode: "manual";
|
|
142
192
|
ph0: number;
|
|
143
193
|
ph1: number;
|
|
194
|
+
pivotIndex?: number | undefined;
|
|
144
195
|
} | {
|
|
145
196
|
mode: "automatic-compute";
|
|
197
|
+
pivotIndex?: number | undefined;
|
|
146
198
|
} | {
|
|
147
199
|
mode: "automatic-info";
|
|
148
|
-
|
|
200
|
+
pivotIndex?: number | undefined;
|
|
201
|
+
}, "mode" | "pivotIndex" | "ph0" | "ph1", number | "absolute" | "manual" | "automatic-compute" | "automatic-info" | undefined>;
|
|
149
202
|
};
|
|
150
203
|
//# sourceMappingURL=phase_correction.hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase_correction.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phase_correction.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AA8BnF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,qCAAqC,CAAC,iDAAiD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmGhG"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
2
|
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
3
|
import { cast } from '@zakodium/utils';
|
|
4
|
+
import { xFindClosestIndex, xMaxAbsoluteValue } from 'ml-spectra-processing';
|
|
4
5
|
import { autoPhaseCorrection } from 'nmr-processing';
|
|
5
6
|
import { useEffect, useMemo } from 'react';
|
|
6
7
|
import { useForm } from 'react-science/ui';
|
|
@@ -75,10 +76,27 @@ export function usePhaseCorrectionForm(props) {
|
|
|
75
76
|
if (phases.ph0 === 0 && phases.ph1 === 0) {
|
|
76
77
|
phases = autoPhaseCorrection(spectrum, { magnitudeMode: true });
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
form.setFieldValue('
|
|
79
|
+
const { ph0, ph1 } = phases;
|
|
80
|
+
form.setFieldValue('ph0', ph0, { dontRunListeners: true });
|
|
81
|
+
form.setFieldValue('ph1', ph1, { dontRunListeners: true });
|
|
82
|
+
// reuse previous pivotIndex or compute it if missing
|
|
83
|
+
const formPivot = form.state.values.pivotIndex;
|
|
84
|
+
const pivotIndex = typeof formPivot === 'number' ? formPivot : findStrongestPeak(spectrum);
|
|
85
|
+
form.setFieldValue('pivotIndex', pivotIndex, { dontRunListeners: true });
|
|
86
|
+
const settings = {
|
|
87
|
+
mode: 'manual',
|
|
88
|
+
ph0,
|
|
89
|
+
ph1,
|
|
90
|
+
pivotIndex,
|
|
91
|
+
};
|
|
92
|
+
onChange({ ...operation, settings });
|
|
80
93
|
},
|
|
81
94
|
};
|
|
82
95
|
return { form, selectModeProps, appFieldModeListeners };
|
|
83
96
|
}
|
|
97
|
+
function findStrongestPeak(spectrum) {
|
|
98
|
+
const re = spectrum.data.re;
|
|
99
|
+
const maxY = xMaxAbsoluteValue(re);
|
|
100
|
+
return xFindClosestIndex(re, maxY, { sorted: false });
|
|
101
|
+
}
|
|
84
102
|
//# sourceMappingURL=phase_correction.hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase_correction.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"phase_correction.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAU3C,MAAM,KAAK,GAAW;IACpB;QACE,KAAK,EAAE,mBAAmB;QAC1B,KAAK,EAAE,iCAAiC;KACzC;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,KAAK,E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ush_tracker.js";
|
|
3
|
+
import { PhaseCorrectionChartSvg } from "./phase_correction_chart_svg.js";
|
|
2
4
|
import { PhaseCorrectionExpanded } from "./phase_correction_expanded.js";
|
|
3
5
|
import { PhaseCorrectionTool } from "./phase_correction_tool.js";
|
|
4
6
|
import { PhaseCorrectionTopbar } from "./phase_correction_topbar.js";
|
|
@@ -11,5 +13,7 @@ export const phaseCorrection1D = defineProcessingOperatorUI({
|
|
|
11
13
|
defaultShouldProcessAll: false,
|
|
12
14
|
Tool: PhaseCorrectionTool,
|
|
13
15
|
TopBar: PhaseCorrectionTopbar,
|
|
16
|
+
ChartBrushTracker: PhaseCorrectionChartBrushTracker,
|
|
17
|
+
ChartSVG: PhaseCorrectionChartSvg,
|
|
14
18
|
});
|
|
15
19
|
//# sourceMappingURL=phase_correction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase_correction.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAiC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA+B,CAAC;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;IAC1D,EAAE,EAAE,iDAAiD;IACrD,IAAI,EAAE,kBAAkB;IACxB,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,uBAAuB;IACjC,uBAAuB,EAAE,KAAK;IAC9B,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,qBAAqB;
|
|
1
|
+
{"version":3,"file":"phase_correction.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA4C,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAkC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAiC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA+B,CAAC;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;IAC1D,EAAE,EAAE,iDAAiD;IACrD,IAAI,EAAE,kBAAkB;IACxB,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,uBAAuB;IACjC,uBAAuB,EAAE,KAAK;IAC9B,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,qBAAqB;IAC7B,iBAAiB,EAAE,gCAAgC;IACnD,QAAQ,EAAE,uBAAuB;CAClC,CAAC,CAAC"}
|
package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProcessingOperatorUIChartBrushTrackerProps } from '@zakodium/nmrium-core';
|
|
2
|
+
export declare function PhaseCorrectionChartBrushTracker(props: ProcessingOperatorUIChartBrushTrackerProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): null;
|
|
3
|
+
//# sourceMappingURL=phase_correction_chart_brush_tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase_correction_chart_brush_tracker.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,uBAAuB,CAAC;AAIxF,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,0CAA0C,CAAC,iDAAiD,CAAC,QAsBrG"}
|
package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
2
|
+
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
3
|
+
export function PhaseCorrectionChartBrushTracker(props) {
|
|
4
|
+
const { useBrushTrackerEvent, scaleX, onChange, operation, spectrum } = props;
|
|
5
|
+
castSpectrum1D(spectrum);
|
|
6
|
+
useBrushTrackerEvent({
|
|
7
|
+
onClick: (event) => {
|
|
8
|
+
const chartX = event.position.x;
|
|
9
|
+
const spectrumX = scaleX.invert(chartX);
|
|
10
|
+
const index = xFindClosestIndex(spectrum.data.x, spectrumX);
|
|
11
|
+
onChange({
|
|
12
|
+
...operation,
|
|
13
|
+
settings: {
|
|
14
|
+
...operation.settings,
|
|
15
|
+
pivotIndex: index,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=phase_correction_chart_brush_tracker.js.map
|
package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase_correction_chart_brush_tracker.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,UAAU,gCAAgC,CAC9C,KAAoG;IAEpG,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC9E,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,oBAAoB,CAAC;QACnB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACxC,MAAM,KAAK,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YAE5D,QAAQ,CAAC;gBACP,GAAG,SAAS;gBACZ,QAAQ,EAAE;oBACR,GAAG,SAAS,CAAC,QAAQ;oBACrB,UAAU,EAAE,KAAK;iBAClB;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProcessingOperatorUIChartSVGProps } from '@zakodium/nmrium-core';
|
|
2
|
+
export declare function PhaseCorrectionChartSvg(props: ProcessingOperatorUIChartSVGProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): import("react").JSX.Element | null;
|
|
3
|
+
//# sourceMappingURL=phase_correction_chart_svg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase_correction_chart_svg.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAG/E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iCAAiC,CAAC,iDAAiD,CAAC,sCAiB5F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
+
export function PhaseCorrectionChartSvg(props) {
|
|
4
|
+
const { spectrum, operation, scaleX, scaleY, indicatorLineColor } = props;
|
|
5
|
+
castSpectrum1D(spectrum);
|
|
6
|
+
const { pivotIndex } = operation.settings;
|
|
7
|
+
if (typeof pivotIndex !== 'number')
|
|
8
|
+
return null;
|
|
9
|
+
const pivotX = scaleX(spectrum.data.x[pivotIndex]);
|
|
10
|
+
const baselineY = scaleY(0);
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(PivotIndicator, { x: pivotX, stroke: indicatorLineColor }), _jsx(BaselineIndicator, { y: baselineY, stroke: indicatorLineColor })] }));
|
|
12
|
+
}
|
|
13
|
+
function PivotIndicator(props) {
|
|
14
|
+
const { x, stroke } = props;
|
|
15
|
+
return (_jsx("line", { x1: x, x2: x, y1: 0, y2: "100%", strokeWidth: 2, stroke: stroke }));
|
|
16
|
+
}
|
|
17
|
+
function BaselineIndicator(props) {
|
|
18
|
+
const { y, stroke } = props;
|
|
19
|
+
return (_jsx("line", { x1: 0, x2: "100%", y1: y, y2: y, strokeWidth: 1, stroke: stroke }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=phase_correction_chart_svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase_correction_chart_svg.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_svg.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,uBAAuB,CACrC,KAA2F;IAE3F,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAC1E,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,QAAQ,CAAC;IAC1C,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAE5B,OAAO,CACL,8BACE,KAAC,cAAc,IAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAI,EACzD,KAAC,iBAAiB,IAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,GAAI,IAC9D,CACJ,CAAC;AACJ,CAAC;AAOD,SAAS,cAAc,CAAC,KAA0B;IAChD,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE5B,OAAO,CACL,eAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAC,MAAM,EAAC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAI,CACxE,CAAC;AACJ,CAAC;AAOD,SAAS,iBAAiB,CAAC,KAA6B;IACtD,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE5B,OAAO,CACL,eAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAI,CACxE,CAAC;AACJ,CAAC"}
|
|
@@ -31,6 +31,7 @@ export declare function useShiftXForm(props: ProcessingOperatorUISettingsFormPro
|
|
|
31
31
|
readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
|
|
32
32
|
readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
|
|
33
33
|
readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
|
|
34
|
+
readonly TextArea: typeof import("react-science/ui")._TextArea;
|
|
34
35
|
}, {
|
|
35
36
|
readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
|
|
36
37
|
readonly ResetButton: typeof import("react-science/ui")._ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift_x.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,aAAa,CAC3B,KAAK,EAAE,qCAAqC,CAAC,wCAAwC,CAAC
|
|
1
|
+
{"version":3,"file":"shift_x.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,aAAa,CAC3B,KAAK,EAAE,qCAAqC,CAAC,wCAAwC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CvF"}
|
|
@@ -32,6 +32,7 @@ export declare function useZeroFillingForm(props: ProcessingOperatorUISettingsFo
|
|
|
32
32
|
readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
|
|
33
33
|
readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
|
|
34
34
|
readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
|
|
35
|
+
readonly TextArea: typeof import("react-science/ui")._TextArea;
|
|
35
36
|
}, {
|
|
36
37
|
readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
|
|
37
38
|
readonly ResetButton: typeof import("react-science/ui")._ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zero_filling.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC
|
|
1
|
+
{"version":3,"file":"zero_filling.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD5F"}
|
|
@@ -8,6 +8,7 @@ export declare const HorizontalAppForm: import("@emotion/styled").StyledComponen
|
|
|
8
8
|
readonly ColorPicker: typeof import("react-science/ui").ColorPicker;
|
|
9
9
|
readonly RadioGroup: typeof import("react-science/ui").RadioGroup;
|
|
10
10
|
readonly DraggableNumericInput: typeof import("react-science/ui").DraggableNumericInput;
|
|
11
|
+
readonly TextArea: typeof import("react-science/ui").TextArea;
|
|
11
12
|
}, {
|
|
12
13
|
readonly SubmitButton: typeof import("react-science/ui").SubmitButton;
|
|
13
14
|
readonly ResetButton: typeof import("react-science/ui").ResetButton;
|
|
@@ -23,6 +24,7 @@ export declare const HorizontalAppForm: import("@emotion/styled").StyledComponen
|
|
|
23
24
|
readonly ColorPicker: typeof import("react-science/ui").ColorPicker;
|
|
24
25
|
readonly RadioGroup: typeof import("react-science/ui").RadioGroup;
|
|
25
26
|
readonly DraggableNumericInput: typeof import("react-science/ui").DraggableNumericInput;
|
|
27
|
+
readonly TextArea: typeof import("react-science/ui").TextArea;
|
|
26
28
|
}, {
|
|
27
29
|
readonly SubmitButton: typeof import("react-science/ui").SubmitButton;
|
|
28
30
|
readonly ResetButton: typeof import("react-science/ui").ResetButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"horizontal_app_form.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"horizontal_app_form.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoB7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakodium/nmrium-core-plugins-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"license": "CC-BY-NC-SA-4.0",
|
|
5
5
|
"description": "UI related plugins needed for cheminfo/nmrium",
|
|
6
6
|
"keywords": [],
|
|
@@ -29,15 +29,16 @@
|
|
|
29
29
|
"@emotion/react": "^11.14.0",
|
|
30
30
|
"@emotion/styled": "^11.14.1",
|
|
31
31
|
"@tanstack/react-form": "^1.33.4",
|
|
32
|
-
"@zakodium/nmrium-core": "^0.7.
|
|
33
|
-
"@zakodium/nmrium-core-plugins": "^0.7.
|
|
32
|
+
"@zakodium/nmrium-core": "^0.7.66",
|
|
33
|
+
"@zakodium/nmrium-core-plugins": "^0.7.88",
|
|
34
34
|
"@zakodium/utils": "^0.5.1",
|
|
35
35
|
"cheminfo-font": "^1.27.0",
|
|
36
36
|
"fifo-logger": "^2.0.1",
|
|
37
37
|
"ml-spectra-processing": "^14.33.0",
|
|
38
|
+
"nmr-processing": "^22.23.6",
|
|
38
39
|
"react": "^18.3.1",
|
|
39
40
|
"react-dom": "^18.3.1",
|
|
40
|
-
"react-science": "^23.
|
|
41
|
+
"react-science": "^23.1.1",
|
|
41
42
|
"usehooks-ts": "^3.1.1",
|
|
42
43
|
"zod": "^4.4.3"
|
|
43
44
|
},
|
|
@@ -51,5 +52,5 @@
|
|
|
51
52
|
"volta": {
|
|
52
53
|
"extends": "../../../package.json"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "2cce4069bf2c77165a8bcd37af616730f66fbca4"
|
|
55
56
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
2
2
|
|
|
3
|
+
import { ApodizationChartSVG } from './apodization_chart_svg.tsx';
|
|
3
4
|
import { ApodizationExpanded } from './apodization_expanded.tsx';
|
|
4
5
|
import { ApodizationTool } from './apodization_tool.tsx';
|
|
5
6
|
import { ApodizationTopBar } from './apodization_topbar.tsx';
|
|
@@ -13,4 +14,5 @@ export const apodization1D = defineProcessingOperatorUI({
|
|
|
13
14
|
Expanded: ApodizationExpanded,
|
|
14
15
|
Tool: ApodizationTool,
|
|
15
16
|
TopBar: ApodizationTopBar,
|
|
17
|
+
ChartSVG: ApodizationChartSVG,
|
|
16
18
|
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Shapes } from '@zakodium/nmr-types';
|
|
2
|
+
import type { ProcessingOperatorUIChartSVGProps } from '@zakodium/nmrium-core';
|
|
3
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
4
|
+
import { assertDefined } from '@zakodium/utils';
|
|
5
|
+
import type { ScaleLinear } from 'd3-scale';
|
|
6
|
+
import { xyReduce } from 'ml-spectra-processing';
|
|
7
|
+
import { createApodizationWindowData } from 'nmr-processing';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { SVGPathBuilder } from 'react-science/ui';
|
|
10
|
+
|
|
11
|
+
export function ApodizationChartSVG(
|
|
12
|
+
props: ProcessingOperatorUIChartSVGProps<'@zakodium/nmrium-core-plugins#apodization1D'>,
|
|
13
|
+
) {
|
|
14
|
+
const { spectrum, operation, width, scaleX, scaleY, indicatorLineColor } =
|
|
15
|
+
props;
|
|
16
|
+
castSpectrum1D(spectrum);
|
|
17
|
+
const { x } = spectrum.data;
|
|
18
|
+
|
|
19
|
+
const path = useApodizationPath({
|
|
20
|
+
x,
|
|
21
|
+
width,
|
|
22
|
+
scaleX,
|
|
23
|
+
scaleY,
|
|
24
|
+
shapes: operation.settings,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<path
|
|
29
|
+
data-testid="@zakodium/nmrium-core-plugins#apodization1D#indicator"
|
|
30
|
+
stroke={indicatorLineColor}
|
|
31
|
+
fill="none"
|
|
32
|
+
strokeWidth="2"
|
|
33
|
+
d={path.toString()}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface UseApodizationPathProps {
|
|
39
|
+
x: Float64Array;
|
|
40
|
+
width: number;
|
|
41
|
+
scaleX: ScaleLinear<number, number>;
|
|
42
|
+
scaleY: ScaleLinear<number, number>;
|
|
43
|
+
shapes: Shapes;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function useApodizationPath(props: UseApodizationPathProps) {
|
|
47
|
+
const { x, width, scaleX, scaleY, shapes } = props;
|
|
48
|
+
|
|
49
|
+
return useMemo(() => {
|
|
50
|
+
const builder = new SVGPathBuilder();
|
|
51
|
+
|
|
52
|
+
const from = x.at(-1);
|
|
53
|
+
const to = x[0];
|
|
54
|
+
assertDefined(from);
|
|
55
|
+
assertDefined(to);
|
|
56
|
+
|
|
57
|
+
const length = x.length;
|
|
58
|
+
const dw = (from - to) / (length - 1);
|
|
59
|
+
|
|
60
|
+
const y = createApodizationWindowData({
|
|
61
|
+
windowOptions: { dw, length },
|
|
62
|
+
shapes,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const pathPoints = xyReduce(
|
|
66
|
+
{ x, y },
|
|
67
|
+
{ from, to, nbPoints: width * 4, optimize: true },
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
builder.moveTo(scaleX(pathPoints.x[0]), scaleY(pathPoints.y[0]));
|
|
71
|
+
for (let i = 1; i < pathPoints.x.length; i++) {
|
|
72
|
+
builder.lineTo(scaleX(pathPoints.x[i]), scaleY(pathPoints.y[i]));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return builder;
|
|
76
|
+
}, [x, shapes, width, scaleX, scaleY]);
|
|
77
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
Spectrum1D,
|
|
4
|
+
Spectrum1DProcessingTypeRegistry,
|
|
5
|
+
} from '@zakodium/nmr-types';
|
|
3
6
|
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
4
7
|
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
5
8
|
import { cast } from '@zakodium/utils';
|
|
9
|
+
import { xFindClosestIndex, xMaxAbsoluteValue } from 'ml-spectra-processing';
|
|
6
10
|
import { autoPhaseCorrection } from 'nmr-processing';
|
|
7
11
|
import type { ComponentProps } from 'react';
|
|
8
12
|
import { useEffect, useMemo } from 'react';
|
|
@@ -106,10 +110,33 @@ export function usePhaseCorrectionForm(
|
|
|
106
110
|
phases = autoPhaseCorrection(spectrum, { magnitudeMode: true });
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
const { ph0, ph1 } = phases;
|
|
114
|
+
|
|
115
|
+
form.setFieldValue('ph0', ph0, { dontRunListeners: true });
|
|
116
|
+
form.setFieldValue('ph1', ph1, { dontRunListeners: true });
|
|
117
|
+
|
|
118
|
+
// reuse previous pivotIndex or compute it if missing
|
|
119
|
+
const formPivot = form.state.values.pivotIndex;
|
|
120
|
+
const pivotIndex =
|
|
121
|
+
typeof formPivot === 'number' ? formPivot : findStrongestPeak(spectrum);
|
|
122
|
+
|
|
123
|
+
form.setFieldValue('pivotIndex', pivotIndex, { dontRunListeners: true });
|
|
124
|
+
|
|
125
|
+
const settings = {
|
|
126
|
+
mode: 'manual' as const,
|
|
127
|
+
ph0,
|
|
128
|
+
ph1,
|
|
129
|
+
pivotIndex,
|
|
130
|
+
};
|
|
131
|
+
onChange({ ...operation, settings });
|
|
111
132
|
},
|
|
112
133
|
};
|
|
113
134
|
|
|
114
135
|
return { form, selectModeProps, appFieldModeListeners };
|
|
115
136
|
}
|
|
137
|
+
|
|
138
|
+
function findStrongestPeak(spectrum: Spectrum1D) {
|
|
139
|
+
const re = spectrum.data.re;
|
|
140
|
+
const maxY = xMaxAbsoluteValue(re);
|
|
141
|
+
return xFindClosestIndex(re, maxY, { sorted: false });
|
|
142
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
2
2
|
|
|
3
|
+
import { PhaseCorrectionChartBrushTracker } from './phase_correction_chart_brush_tracker.tsx';
|
|
4
|
+
import { PhaseCorrectionChartSvg } from './phase_correction_chart_svg.tsx';
|
|
3
5
|
import { PhaseCorrectionExpanded } from './phase_correction_expanded.tsx';
|
|
4
6
|
import { PhaseCorrectionTool } from './phase_correction_tool.tsx';
|
|
5
7
|
import { PhaseCorrectionTopbar } from './phase_correction_topbar.tsx';
|
|
@@ -13,4 +15,6 @@ export const phaseCorrection1D = defineProcessingOperatorUI({
|
|
|
13
15
|
defaultShouldProcessAll: false,
|
|
14
16
|
Tool: PhaseCorrectionTool,
|
|
15
17
|
TopBar: PhaseCorrectionTopbar,
|
|
18
|
+
ChartBrushTracker: PhaseCorrectionChartBrushTracker,
|
|
19
|
+
ChartSVG: PhaseCorrectionChartSvg,
|
|
16
20
|
});
|
package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_chart_brush_tracker.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ProcessingOperatorUIChartBrushTrackerProps } from '@zakodium/nmrium-core';
|
|
2
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
+
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
4
|
+
|
|
5
|
+
export function PhaseCorrectionChartBrushTracker(
|
|
6
|
+
props: ProcessingOperatorUIChartBrushTrackerProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>,
|
|
7
|
+
) {
|
|
8
|
+
const { useBrushTrackerEvent, scaleX, onChange, operation, spectrum } = props;
|
|
9
|
+
castSpectrum1D(spectrum);
|
|
10
|
+
|
|
11
|
+
useBrushTrackerEvent({
|
|
12
|
+
onClick: (event) => {
|
|
13
|
+
const chartX = event.position.x;
|
|
14
|
+
const spectrumX = scaleX.invert(chartX);
|
|
15
|
+
const index = xFindClosestIndex(spectrum.data.x, spectrumX);
|
|
16
|
+
|
|
17
|
+
onChange({
|
|
18
|
+
...operation,
|
|
19
|
+
settings: {
|
|
20
|
+
...operation.settings,
|
|
21
|
+
pivotIndex: index,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ProcessingOperatorUIChartSVGProps } from '@zakodium/nmrium-core';
|
|
2
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
+
|
|
4
|
+
export function PhaseCorrectionChartSvg(
|
|
5
|
+
props: ProcessingOperatorUIChartSVGProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>,
|
|
6
|
+
) {
|
|
7
|
+
const { spectrum, operation, scaleX, scaleY, indicatorLineColor } = props;
|
|
8
|
+
castSpectrum1D(spectrum);
|
|
9
|
+
|
|
10
|
+
const { pivotIndex } = operation.settings;
|
|
11
|
+
if (typeof pivotIndex !== 'number') return null;
|
|
12
|
+
|
|
13
|
+
const pivotX = scaleX(spectrum.data.x[pivotIndex]);
|
|
14
|
+
const baselineY = scaleY(0);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<PivotIndicator x={pivotX} stroke={indicatorLineColor} />
|
|
19
|
+
<BaselineIndicator y={baselineY} stroke={indicatorLineColor} />
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface PivotIndicatorProps {
|
|
25
|
+
x: number;
|
|
26
|
+
stroke: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function PivotIndicator(props: PivotIndicatorProps) {
|
|
30
|
+
const { x, stroke } = props;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<line x1={x} x2={x} y1={0} y2="100%" strokeWidth={2} stroke={stroke} />
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface BaselineIndicatorProps {
|
|
38
|
+
y: number;
|
|
39
|
+
stroke: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function BaselineIndicator(props: BaselineIndicatorProps) {
|
|
43
|
+
const { y, stroke } = props;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<line x1={0} x2="100%" y1={y} y2={y} strokeWidth={1} stroke={stroke} />
|
|
47
|
+
);
|
|
48
|
+
}
|