nmrium 0.56.0 → 0.57.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/lib/component/1d/ExclusionZoneAnnotation.d.ts +0 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +14 -19
- package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +0 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +0 -1
- package/lib/component/1d/peaks/PeakEditionManager.js +16 -10
- package/lib/component/1d/utilities/getDecimalsCount.js +1 -1
- package/lib/component/1d/utilities/intersectionResolver.js +1 -1
- package/lib/component/1d-2d/FieldEdition.d.ts +3 -1
- package/lib/component/1d-2d/FieldEdition.js +26 -10
- package/lib/component/2d/1d-tracer/Left1DChart.d.ts +0 -1
- package/lib/component/2d/1d-tracer/Top1DChart.d.ts +0 -1
- package/lib/component/2d/XAxis.d.ts +0 -1
- package/lib/component/2d/YAxis.d.ts +0 -1
- package/lib/component/2d/ft/Contours.js +7 -7
- package/lib/component/assignment/AssignmentsContext.d.ts +0 -1
- package/lib/component/context/ChartContext.d.ts +0 -1
- package/lib/component/context/DispatchContext.d.ts +0 -1
- package/lib/component/context/GlobalContext.d.ts +0 -1
- package/lib/component/context/KeyModifierContext.js +1 -1
- package/lib/component/context/LoaderContext.d.ts +0 -1
- package/lib/component/context/PreferencesContext.d.ts +0 -1
- package/lib/component/context/ScaleContext.d.ts +0 -1
- package/lib/component/elements/ActionButtons.d.ts +1 -0
- package/lib/component/elements/ActionButtons.js +4 -4
- package/lib/component/elements/ColorInput.d.ts +0 -1
- package/lib/component/elements/ColorPickerDropdownController.d.ts +2 -0
- package/lib/component/elements/ColorPickerDropdownController.js +8 -0
- package/lib/component/elements/ColumnWrapper.d.ts +0 -1
- package/lib/component/elements/ContextMenu.d.ts +0 -1
- package/lib/component/elements/Input.d.ts +1 -0
- package/lib/component/elements/Input.js +2 -1
- package/lib/component/elements/Input2.d.ts +13 -0
- package/lib/component/elements/Input2.js +118 -0
- package/lib/component/elements/Input2Controller.d.ts +12 -0
- package/lib/component/elements/Input2Controller.js +22 -0
- package/lib/component/elements/MoleculeSelection.js +1 -1
- package/lib/component/elements/NumberInput.js +1 -1
- package/lib/component/elements/NumberInput2.d.ts +12 -0
- package/lib/component/elements/NumberInput2.js +65 -0
- package/lib/component/elements/NumberInput2Controller.d.ts +8 -0
- package/lib/component/elements/NumberInput2Controller.js +15 -0
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +3 -3
- package/lib/component/elements/ReactTable/Style.d.ts +3 -1
- package/lib/component/elements/ReactTable/Style.js +11 -1
- package/lib/component/elements/ReactTable/utility/ReactTableContext.d.ts +0 -1
- package/lib/component/elements/Select2.d.ts +26 -0
- package/lib/component/elements/Select2.js +25 -0
- package/lib/component/elements/Select2Controller.d.ts +7 -0
- package/lib/component/elements/Select2Controller.js +12 -0
- package/lib/component/elements/draggable/useDraggable.d.ts +0 -1
- package/lib/component/elements/dropDownButton/DropDownButton.d.ts +2 -4
- package/lib/component/elements/dropDownButton/DropDownButton.js +11 -37
- package/lib/component/elements/dropDownButton/DropDownList.js +3 -32
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColumnFormatField.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput2.d.ts +11 -0
- package/lib/component/elements/formik/FormikInput2.js +26 -0
- package/lib/component/elements/formik/FormikOnChange.d.ts +0 -1
- package/lib/component/elements/popup/Modal/Context.d.ts +0 -1
- package/lib/component/elements/popup/Modal/ModalContent.d.ts +0 -1
- package/lib/component/elements/resizer/SVGResizer.d.ts +0 -1
- package/lib/component/elements/useFormValidateField.d.ts +1 -0
- package/lib/component/elements/useFormValidateField.js +9 -0
- package/lib/component/header/ApodizationOptionsPanel.js +26 -11
- package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +1 -4
- package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -16
- package/lib/component/header/BaseLineCorrectionPanel.js +49 -27
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/PhaseCorrectionPanel.js +12 -24
- package/lib/component/header/RangesPickingOptionPanel.js +12 -12
- package/lib/component/header/ZeroFillingOptionsPanel.js +18 -7
- package/lib/component/header/Zones2DOptionPanel.js +19 -18
- package/lib/component/hooks/useWorkspaceAction.d.ts +1 -1
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +0 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +5 -1
- package/lib/component/modal/setting/GeneralSettings.js +107 -111
- package/lib/component/modal/setting/WorkspaceItem.js +4 -9
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +95 -59
- package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +33 -25
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +15 -4
- package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +56 -39
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +36 -36
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +44 -36
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +16 -11
- package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +47 -40
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +50 -40
- package/lib/component/modal/setting/settingsValidation.js +8 -34
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +0 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +0 -1
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +0 -1
- package/lib/component/panels/Panels.js +31 -8
- package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +0 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +0 -1
- package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/SpectraPreferences.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/SpectraPreferences.js +32 -24
- package/lib/component/panels/SpectraPanel/SpectraTable.js +17 -2
- package/lib/component/panels/SpectraPanel/SpectrumListPanel.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/ColorIndicator.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.d.ts +3 -3
- package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.js +25 -16
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DHistogram.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +15 -5
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +44 -6
- package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.d.ts +0 -1
- package/lib/component/panels/SummaryPanel/Overview.d.ts +0 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts +0 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +0 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +17 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.d.ts +0 -1
- package/lib/component/panels/databasePanel/DatabaseTable.d.ts +11 -4
- package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
- package/lib/component/panels/informationPanel/InformationEditionModal.d.ts +6 -0
- package/lib/component/panels/informationPanel/InformationEditionModal.js +105 -0
- package/lib/component/panels/informationPanel/InformationPanel.d.ts +1 -0
- package/lib/component/panels/{InformationPanel.js → informationPanel/InformationPanel.js} +2 -2
- package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts +0 -1
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.d.ts +0 -1
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +0 -1
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -1
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/DatabaseActions.js +22 -5
- package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
- package/lib/component/reducer/actions/SpectraActions.js +58 -21
- package/lib/component/reducer/actions/ToolsActions.js +3 -4
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +7 -7
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/utility/checkUniqueByKey.d.ts +2 -0
- package/lib/component/utility/checkUniqueByKey.js +40 -0
- package/lib/component/utility/colorToHexWithAlpha.d.ts +9 -0
- package/lib/component/utility/colorToHexWithAlpha.js +4 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/process1D.js +0 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib/data/PredictionManager.js +3 -5
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +13 -13
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +9 -9
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -13
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +13 -13
- package/lib/data/data1d/database.d.ts +1 -0
- package/lib/data/data1d/database.js +4 -2
- package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -22
- package/lib/data/data2d/Spectrum2D/contours.js +88 -67
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +4 -2
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +20 -20
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +20 -20
- package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
- package/lib/data/initiateFilters.d.ts +1 -1
- package/lib/data/matrixGeneration.js +1 -2
- package/lib/data/types/common/Keys.d.ts +3 -0
- package/lib/data/types/common/Keys.js +1 -0
- package/lib/data/utilities/generateNumbersPowerOfX.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/package.json +32 -31
- package/lib/component/elements/formik/FormikSlider.d.ts +0 -6
- package/lib/component/elements/formik/FormikSlider.js +0 -15
- package/lib/component/panels/InformationPanel.d.ts +0 -1
|
@@ -7,6 +7,7 @@ import { getReferenceShift, isSpectrum1D, get1DColor, initiateDatum1D, generateS
|
|
|
7
7
|
import { simulateSpectrum, } from '../../../data/data1d/spectrumSimulation';
|
|
8
8
|
import { getMissingProjection, isSpectrum2D, get2DColor, } from '../../../data/data2d/Spectrum2D';
|
|
9
9
|
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
10
|
+
import { adjustAlpha, generateColor, } from '../../../data/utilities/generateColor';
|
|
10
11
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
11
12
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
12
13
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
@@ -232,16 +233,15 @@ function handleChangeSpectrumSetting(draft, action) {
|
|
|
232
233
|
const spectrum = draft.data[index];
|
|
233
234
|
spectrum.display = display;
|
|
234
235
|
if (isSpectrum2D(spectrum)) {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
contoursLevels[spectrum.id] = checkLevel();
|
|
236
|
+
const { checkLevel } = contoursManager(spectrum);
|
|
237
|
+
checkLevel();
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
//action
|
|
242
242
|
function handleDeleteSpectra(draft, action) {
|
|
243
243
|
const state = original(draft);
|
|
244
|
-
const { id: spectraId } = action?.payload || {};
|
|
244
|
+
const { id: spectraId, domainOptions } = action?.payload || {};
|
|
245
245
|
if (spectraId) {
|
|
246
246
|
const index = state.data.findIndex((d) => d.id === spectraId);
|
|
247
247
|
draft.data.splice(index, 1);
|
|
@@ -261,6 +261,7 @@ function handleDeleteSpectra(draft, action) {
|
|
|
261
261
|
setActiveTab(draft, {
|
|
262
262
|
tab: draft.view.spectra.activeTab,
|
|
263
263
|
refreshActiveTab: true,
|
|
264
|
+
domainOptions,
|
|
264
265
|
});
|
|
265
266
|
}
|
|
266
267
|
//action
|
|
@@ -322,37 +323,66 @@ function handleImportSpectraMetaInfo(draft, action) {
|
|
|
322
323
|
function handleToggleSpectraLegend(draft) {
|
|
323
324
|
draft.view.spectra.showLegend = !draft.view.spectra.showLegend;
|
|
324
325
|
}
|
|
326
|
+
function groupSpectraByClass(spectra, jpath) {
|
|
327
|
+
const spectraByClass = {};
|
|
328
|
+
for (const spectrum of spectra) {
|
|
329
|
+
const key = String(lodashGet(spectrum, jpath, ''))
|
|
330
|
+
.toLowerCase()
|
|
331
|
+
.trim()
|
|
332
|
+
.replace(/\r?\n|\r/, '');
|
|
333
|
+
if (spectraByClass[key]) {
|
|
334
|
+
spectraByClass[key].push(spectrum);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
spectraByClass[key] = [spectrum];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return spectraByClass;
|
|
341
|
+
}
|
|
325
342
|
//action
|
|
326
343
|
function handleRecolorSpectraBasedOnDistinctValue(draft, action) {
|
|
327
344
|
const { data, view: { spectra: { activeTab }, }, } = draft;
|
|
328
345
|
const { jpath = null, customColors } = action.payload;
|
|
329
|
-
const
|
|
346
|
+
const spectraByNucleus = getSpectraByNucleus(activeTab, data);
|
|
330
347
|
if (jpath) {
|
|
331
348
|
//recolor spectra based on distinct value
|
|
332
|
-
const spectraByClass =
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
spectrum.display.color = spectraByClass[key].display.color;
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
spectrum.display.positiveColor = spectraByClass[key].display.positiveColor;
|
|
344
|
-
spectrum.display.negativeColor = spectraByClass[key].display.negativeColor;
|
|
349
|
+
const spectraByClass = groupSpectraByClass(spectraByNucleus, jpath);
|
|
350
|
+
const usedColors = [];
|
|
351
|
+
for (const spectra of Object.values(spectraByClass)) {
|
|
352
|
+
let color;
|
|
353
|
+
if (isSpectrum1D(spectra[0])) {
|
|
354
|
+
color = spectra[0].display.color;
|
|
355
|
+
if (usedColors.includes(color)) {
|
|
356
|
+
color = generateColor({ usedColors });
|
|
345
357
|
}
|
|
358
|
+
usedColors.push(color);
|
|
346
359
|
}
|
|
347
360
|
else {
|
|
348
|
-
|
|
361
|
+
const { positiveColor: pColor, negativeColor: nColor } = spectra[0].display;
|
|
362
|
+
color = { positiveColor: pColor, negativeColor: nColor };
|
|
363
|
+
if (usedColors.includes(pColor)) {
|
|
364
|
+
const positiveColor = generateColor({
|
|
365
|
+
usedColors,
|
|
366
|
+
});
|
|
367
|
+
const negativeColor = adjustAlpha(positiveColor, 50);
|
|
368
|
+
color = { positiveColor, negativeColor };
|
|
369
|
+
}
|
|
370
|
+
usedColors.push(color.positiveColor);
|
|
371
|
+
}
|
|
372
|
+
for (const spectrum of spectra) {
|
|
373
|
+
if (typeof color === 'string') {
|
|
374
|
+
spectrum.display = { ...spectrum.display, color };
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
spectrum.display = { ...spectrum.display, ...color };
|
|
378
|
+
}
|
|
349
379
|
}
|
|
350
380
|
}
|
|
351
381
|
}
|
|
352
382
|
else {
|
|
353
383
|
//reset spectra colors
|
|
354
384
|
const usedColors = { '1d': [], '2d': [] };
|
|
355
|
-
for (const spectrum of
|
|
385
|
+
for (const spectrum of spectraByNucleus) {
|
|
356
386
|
if (isSpectrum1D(spectrum)) {
|
|
357
387
|
spectrum.display.color = get1DColor(spectrum, {
|
|
358
388
|
usedColors,
|
|
@@ -432,4 +462,11 @@ function handleSimulateSpectrum(draft, simulateSpectrumOptions) {
|
|
|
432
462
|
setActiveTab(draft);
|
|
433
463
|
}
|
|
434
464
|
}
|
|
435
|
-
|
|
465
|
+
function handleUpdateSpectrumMeta(draft, action) {
|
|
466
|
+
const { payload: { meta }, } = action;
|
|
467
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
468
|
+
if (!activeSpectrum)
|
|
469
|
+
return null;
|
|
470
|
+
draft.data[activeSpectrum.index].customInfo = meta;
|
|
471
|
+
}
|
|
472
|
+
export { handleChangeSpectrumVisibilityById, handleChangeSpectraVisibilityByNucleus, handleChangeActiveSpectrum, handleChangeSpectrumSetting, handleDeleteSpectra, handleAddMissingProjectionHandler, handleAlignSpectraHandler, handleGenerateSpectrumFromPublicationStringHandler, handleImportSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, handleSimulateSpectrum, setSpectraMetaInfo, handleUpdateSpectrumMeta, };
|
|
@@ -466,7 +466,7 @@ function handelSetActiveTab(draft, action) {
|
|
|
466
466
|
}
|
|
467
467
|
function levelChangeHandler(draft, action) {
|
|
468
468
|
const { deltaY, altKey } = action.payload.options;
|
|
469
|
-
const { data, view: { spectra: { activeTab },
|
|
469
|
+
const { data, view: { spectra: { activeTab }, }, } = draft;
|
|
470
470
|
const activeSpectra = getActiveSpectra(draft) || [];
|
|
471
471
|
const activeSpectraObj = {};
|
|
472
472
|
for (const activeSpectrum of activeSpectra) {
|
|
@@ -476,9 +476,8 @@ function levelChangeHandler(draft, action) {
|
|
|
476
476
|
(activeSpectraObj?.[spectrum.id] || activeSpectra.length === 0));
|
|
477
477
|
try {
|
|
478
478
|
for (const spectrum of spectra) {
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
levels[spectrum.id] = zoom.wheel(deltaY, altKey);
|
|
479
|
+
const zoom = contoursManager(spectrum);
|
|
480
|
+
zoom.wheel(deltaY, altKey);
|
|
482
481
|
}
|
|
483
482
|
}
|
|
484
483
|
catch (error) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { MatrixGenerationOptions, PanelsPreferences } from 'nmr-load-save';
|
|
2
2
|
import { DeepPartial } from '../../../data/types/common/DeepPartial';
|
|
3
|
-
declare const getSpectraDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
4
|
-
declare const getIntegralDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
5
|
-
declare const getZoneDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
6
|
-
declare const getRangeDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
7
|
-
declare const getPeaksDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
3
|
+
declare const getSpectraDefaultValues: (nucleus?: string) => PanelsPreferences["spectra"];
|
|
4
|
+
declare const getIntegralDefaultValues: (nucleus?: string) => PanelsPreferences["integrals"];
|
|
5
|
+
declare const getZoneDefaultValues: (nucleus?: string) => PanelsPreferences["zones"];
|
|
6
|
+
declare const getRangeDefaultValues: (nucleus?: string) => PanelsPreferences["ranges"];
|
|
7
|
+
declare const getPeaksDefaultValues: (nucleus?: string) => PanelsPreferences["peaks"];
|
|
8
8
|
declare const databaseDefaultValues: PanelsPreferences['database'];
|
|
9
|
-
declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
9
|
+
declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences["multipleSpectraAnalysis"];
|
|
10
10
|
declare function getMatrixGenerationDefaultOptions(): DeepPartial<MatrixGenerationOptions>;
|
|
11
|
-
declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences[
|
|
11
|
+
declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences["matrixGeneration"];
|
|
12
12
|
export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
|
|
@@ -52,6 +52,7 @@ const getIntegralDefaultValues = (nucleus) => {
|
|
|
52
52
|
strokeWidth: 1,
|
|
53
53
|
showKind: true,
|
|
54
54
|
showDeleteAction: true,
|
|
55
|
+
isSumConstant: true,
|
|
55
56
|
};
|
|
56
57
|
return getPreferences(preferences, nucleus);
|
|
57
58
|
};
|
|
@@ -100,6 +101,7 @@ const getRangeDefaultValues = (nucleus) => {
|
|
|
100
101
|
showZoomAction: true,
|
|
101
102
|
showEditAction: true,
|
|
102
103
|
showAssignmentLabel: false,
|
|
104
|
+
isSumConstant: true,
|
|
103
105
|
};
|
|
104
106
|
return getPreferences(preferences, nucleus);
|
|
105
107
|
};
|
|
@@ -22,7 +22,7 @@ type InitPreferencesAction = ActionType<'INIT_PREFERENCES', {
|
|
|
22
22
|
type SetPreferencesAction = ActionType<'SET_PREFERENCES', Partial<Workspace>> | ActionType<'SET_PREFERENCES'>;
|
|
23
23
|
type SetPanelsPreferencesAction = ActionType<'SET_PANELS_PREFERENCES', {
|
|
24
24
|
key: string;
|
|
25
|
-
value:
|
|
25
|
+
value: any;
|
|
26
26
|
}>;
|
|
27
27
|
export type SetWorkspaceAction = ActionType<'SET_WORKSPACE', {
|
|
28
28
|
workspaceSource: 'any';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ValidationError } from 'yup';
|
|
2
|
+
export function checkUniqueByKey(data, checkKey, context) {
|
|
3
|
+
if (!data)
|
|
4
|
+
return true;
|
|
5
|
+
const matchesFrequencies = {};
|
|
6
|
+
let index = 0;
|
|
7
|
+
for (const datum of data) {
|
|
8
|
+
let key;
|
|
9
|
+
const matchValue = datum[checkKey];
|
|
10
|
+
if (typeof matchValue === 'string') {
|
|
11
|
+
key = matchValue.toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
if (key) {
|
|
14
|
+
if (matchesFrequencies[key]) {
|
|
15
|
+
++matchesFrequencies[key].value;
|
|
16
|
+
matchesFrequencies[key].fieldsIndexes.push(index);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
matchesFrequencies[key] = { value: 1, fieldsIndexes: [index] };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
index++;
|
|
23
|
+
}
|
|
24
|
+
const errors = [];
|
|
25
|
+
for (const key in matchesFrequencies) {
|
|
26
|
+
const { value, fieldsIndexes } = matchesFrequencies[key];
|
|
27
|
+
if (value > 1) {
|
|
28
|
+
for (const index of fieldsIndexes) {
|
|
29
|
+
errors.push(context.createError({
|
|
30
|
+
message: `${key} must be unique`,
|
|
31
|
+
path: `${context.path}[${index}].${String(checkKey)}`,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (errors.length > 0) {
|
|
37
|
+
return new ValidationError(errors);
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
@@ -49,6 +49,7 @@ export const exercise = {
|
|
|
49
49
|
strokeWidth: 1,
|
|
50
50
|
showKind: false,
|
|
51
51
|
showDeleteAction: true,
|
|
52
|
+
isSumConstant: true,
|
|
52
53
|
},
|
|
53
54
|
'13C': {
|
|
54
55
|
showSerialNumber: true,
|
|
@@ -60,6 +61,7 @@ export const exercise = {
|
|
|
60
61
|
strokeWidth: 1,
|
|
61
62
|
showKind: false,
|
|
62
63
|
showDeleteAction: true,
|
|
64
|
+
isSumConstant: true,
|
|
63
65
|
},
|
|
64
66
|
},
|
|
65
67
|
},
|
|
@@ -55,13 +55,11 @@ export async function predictSpectra(molfile, options) {
|
|
|
55
55
|
}
|
|
56
56
|
function generateName(name, options) {
|
|
57
57
|
const { frequency, experiment } = options;
|
|
58
|
-
const freq = Array.isArray(frequency)
|
|
59
|
-
|
|
60
|
-
: `${frequency}MHz`;
|
|
61
|
-
return name || `${experiment.toUpperCase()}_${freq}_${v4()}`;
|
|
58
|
+
const freq = Array.isArray(frequency) ? frequency[0] : frequency;
|
|
59
|
+
return name || `${experiment.toUpperCase()}_${freq}MHz`;
|
|
62
60
|
}
|
|
63
61
|
export function generateSpectra(predictedSpectra, inputOptions, color, logger) {
|
|
64
|
-
const options =
|
|
62
|
+
const options = structuredClone(inputOptions);
|
|
65
63
|
checkFromTo(predictedSpectra, options, logger);
|
|
66
64
|
const spectra = [];
|
|
67
65
|
for (const experiment in predictedSpectra) {
|
|
@@ -11,26 +11,26 @@ export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, '
|
|
|
11
11
|
delta: number;
|
|
12
12
|
multiplicity: string;
|
|
13
13
|
js: import("nmr-processing").Jcoupling[];
|
|
14
|
-
atoms?: number[]
|
|
15
|
-
assignment?: string
|
|
16
|
-
diaIDs?: string[]
|
|
17
|
-
nbAtoms?: number
|
|
18
|
-
integration?: number
|
|
14
|
+
atoms?: number[];
|
|
15
|
+
assignment?: string;
|
|
16
|
+
diaIDs?: string[];
|
|
17
|
+
nbAtoms?: number;
|
|
18
|
+
integration?: number;
|
|
19
19
|
statistic?: {
|
|
20
20
|
mean: number;
|
|
21
21
|
sd: number;
|
|
22
22
|
min: number;
|
|
23
23
|
max: number;
|
|
24
24
|
nb: number;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
kind: string;
|
|
27
27
|
id: string;
|
|
28
28
|
peaks: {
|
|
29
29
|
originalX: number;
|
|
30
30
|
x: number;
|
|
31
31
|
id: string;
|
|
32
|
-
kind?: string
|
|
33
|
-
shape?: import("ml-peak-shape-generator").Shape1D
|
|
32
|
+
kind?: string;
|
|
33
|
+
shape?: import("ml-peak-shape-generator").Shape1D;
|
|
34
34
|
y: number;
|
|
35
35
|
width: number;
|
|
36
36
|
}[];
|
|
@@ -42,9 +42,9 @@ export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, '
|
|
|
42
42
|
id: string;
|
|
43
43
|
kind: string;
|
|
44
44
|
integration: number;
|
|
45
|
-
nbAtoms?: number
|
|
46
|
-
multiplicity?: string
|
|
47
|
-
assignment?: string
|
|
48
|
-
diaIDs?: string[]
|
|
49
|
-
pubIntegral?: number
|
|
45
|
+
nbAtoms?: number;
|
|
46
|
+
multiplicity?: string;
|
|
47
|
+
assignment?: string;
|
|
48
|
+
diaIDs?: string[];
|
|
49
|
+
pubIntegral?: number;
|
|
50
50
|
} | undefined;
|
|
@@ -24,21 +24,21 @@ export default function detectSignals(data: DataXY<Float64Array>, options: {
|
|
|
24
24
|
diaIDs: never[];
|
|
25
25
|
}[] | {
|
|
26
26
|
delta: number;
|
|
27
|
-
id?: string
|
|
27
|
+
id?: string;
|
|
28
28
|
js: import("nmr-processing").Jcoupling[];
|
|
29
|
-
atoms?: number[]
|
|
30
|
-
assignment?: string
|
|
31
|
-
kind?: string
|
|
29
|
+
atoms?: number[];
|
|
30
|
+
assignment?: string;
|
|
31
|
+
kind?: string;
|
|
32
32
|
multiplicity: string;
|
|
33
|
-
diaIDs?: string[]
|
|
34
|
-
nbAtoms?: number
|
|
35
|
-
integration?: number
|
|
36
|
-
peaks?: import("nmr-processing").NMRPeak1D[]
|
|
33
|
+
diaIDs?: string[];
|
|
34
|
+
nbAtoms?: number;
|
|
35
|
+
integration?: number;
|
|
36
|
+
peaks?: import("nmr-processing").NMRPeak1D[];
|
|
37
37
|
statistic?: {
|
|
38
38
|
mean: number;
|
|
39
39
|
sd: number;
|
|
40
40
|
min: number;
|
|
41
41
|
max: number;
|
|
42
42
|
nb: number;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
}[];
|
|
@@ -11,26 +11,26 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
|
|
|
11
11
|
delta: number;
|
|
12
12
|
multiplicity: string;
|
|
13
13
|
js: import("nmr-processing").Jcoupling[];
|
|
14
|
-
atoms?: number[]
|
|
15
|
-
assignment?: string
|
|
16
|
-
diaIDs?: string[]
|
|
17
|
-
nbAtoms?: number
|
|
18
|
-
integration?: number
|
|
14
|
+
atoms?: number[];
|
|
15
|
+
assignment?: string;
|
|
16
|
+
diaIDs?: string[];
|
|
17
|
+
nbAtoms?: number;
|
|
18
|
+
integration?: number;
|
|
19
19
|
statistic?: {
|
|
20
20
|
mean: number;
|
|
21
21
|
sd: number;
|
|
22
22
|
min: number;
|
|
23
23
|
max: number;
|
|
24
24
|
nb: number;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
kind: string;
|
|
27
27
|
id: string;
|
|
28
28
|
peaks: {
|
|
29
29
|
originalX: number;
|
|
30
30
|
x: number;
|
|
31
31
|
id: string;
|
|
32
|
-
kind?: string
|
|
33
|
-
shape?: import("ml-peak-shape-generator").Shape1D
|
|
32
|
+
kind?: string;
|
|
33
|
+
shape?: import("ml-peak-shape-generator").Shape1D;
|
|
34
34
|
y: number;
|
|
35
35
|
width: number;
|
|
36
36
|
}[];
|
|
@@ -42,10 +42,10 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
|
|
|
42
42
|
id: string;
|
|
43
43
|
kind: string;
|
|
44
44
|
integration: number;
|
|
45
|
-
nbAtoms?: number
|
|
46
|
-
multiplicity?: string
|
|
47
|
-
assignment?: string
|
|
48
|
-
diaIDs?: string[]
|
|
49
|
-
pubIntegral?: number
|
|
45
|
+
nbAtoms?: number;
|
|
46
|
+
multiplicity?: string;
|
|
47
|
+
assignment?: string;
|
|
48
|
+
diaIDs?: string[];
|
|
49
|
+
pubIntegral?: number;
|
|
50
50
|
}[];
|
|
51
51
|
};
|
|
@@ -13,26 +13,26 @@ export declare function resizeRange(spectrum: Spectrum1D, options: {
|
|
|
13
13
|
delta: number;
|
|
14
14
|
multiplicity: string;
|
|
15
15
|
js: import("nmr-processing").Jcoupling[];
|
|
16
|
-
atoms?: number[]
|
|
17
|
-
assignment?: string
|
|
18
|
-
diaIDs?: string[]
|
|
19
|
-
nbAtoms?: number
|
|
20
|
-
integration?: number
|
|
16
|
+
atoms?: number[];
|
|
17
|
+
assignment?: string;
|
|
18
|
+
diaIDs?: string[];
|
|
19
|
+
nbAtoms?: number;
|
|
20
|
+
integration?: number;
|
|
21
21
|
statistic?: {
|
|
22
22
|
mean: number;
|
|
23
23
|
sd: number;
|
|
24
24
|
min: number;
|
|
25
25
|
max: number;
|
|
26
26
|
nb: number;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
kind: string;
|
|
29
29
|
id: string;
|
|
30
30
|
peaks: {
|
|
31
31
|
originalX: number;
|
|
32
32
|
x: number;
|
|
33
33
|
id: string;
|
|
34
|
-
kind?: string
|
|
35
|
-
shape?: import("ml-peak-shape-generator").Shape1D
|
|
34
|
+
kind?: string;
|
|
35
|
+
shape?: import("ml-peak-shape-generator").Shape1D;
|
|
36
36
|
y: number;
|
|
37
37
|
width: number;
|
|
38
38
|
}[];
|
|
@@ -44,9 +44,9 @@ export declare function resizeRange(spectrum: Spectrum1D, options: {
|
|
|
44
44
|
id: string;
|
|
45
45
|
kind: string;
|
|
46
46
|
integration: number;
|
|
47
|
-
nbAtoms?: number
|
|
48
|
-
multiplicity?: string
|
|
49
|
-
assignment?: string
|
|
50
|
-
diaIDs?: string[]
|
|
51
|
-
pubIntegral?: number
|
|
47
|
+
nbAtoms?: number;
|
|
48
|
+
multiplicity?: string;
|
|
49
|
+
assignment?: string;
|
|
50
|
+
diaIDs?: string[];
|
|
51
|
+
pubIntegral?: number;
|
|
52
52
|
};
|
|
@@ -92,13 +92,14 @@ export function prepareData(data) {
|
|
|
92
92
|
let index = 0;
|
|
93
93
|
for (const item of data) {
|
|
94
94
|
const ids = [];
|
|
95
|
-
const { ranges, ...restItemKeys } = item;
|
|
95
|
+
const { ranges, id: spectrumID, ...restItemKeys } = item;
|
|
96
96
|
if (!ranges) {
|
|
97
|
-
ids.push(
|
|
97
|
+
ids.push(spectrumID);
|
|
98
98
|
result.push({
|
|
99
99
|
...restItemKeys,
|
|
100
100
|
index,
|
|
101
101
|
id: ids,
|
|
102
|
+
spectrumID,
|
|
102
103
|
ranges: [],
|
|
103
104
|
});
|
|
104
105
|
}
|
|
@@ -117,6 +118,7 @@ export function prepareData(data) {
|
|
|
117
118
|
index,
|
|
118
119
|
id: ids,
|
|
119
120
|
ranges,
|
|
121
|
+
spectrumID,
|
|
120
122
|
};
|
|
121
123
|
result.push(data);
|
|
122
124
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Spectrum2D } from 'nmr-load-save';
|
|
2
2
|
interface Level {
|
|
3
|
-
positive:
|
|
4
|
-
negative:
|
|
3
|
+
positive: ContourItem;
|
|
4
|
+
negative: ContourItem;
|
|
5
5
|
}
|
|
6
|
+
type ContourLevels = [number, number];
|
|
6
7
|
interface ContourItem {
|
|
7
|
-
contourLevels:
|
|
8
|
+
contourLevels: ContourLevels;
|
|
8
9
|
numberOfLayers: number;
|
|
9
10
|
}
|
|
10
11
|
interface ContourOptions {
|
|
@@ -12,30 +13,15 @@ interface ContourOptions {
|
|
|
12
13
|
negative: ContourItem;
|
|
13
14
|
}
|
|
14
15
|
type ContoursLevels = Record<string, Level>;
|
|
15
|
-
declare const DEFAULT_CONTOURS_OPTIONS:
|
|
16
|
-
positive: {
|
|
17
|
-
contourLevels: number[];
|
|
18
|
-
numberOfLayers: number;
|
|
19
|
-
};
|
|
20
|
-
negative: {
|
|
21
|
-
contourLevels: number[];
|
|
22
|
-
numberOfLayers: number;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
16
|
+
declare const DEFAULT_CONTOURS_OPTIONS: ContourOptions;
|
|
25
17
|
type LevelSign = keyof Level;
|
|
26
18
|
interface ReturnContoursManager {
|
|
27
19
|
wheel: (value: number, shift: boolean) => Level;
|
|
28
20
|
getLevel: () => Level;
|
|
29
21
|
checkLevel: () => Level;
|
|
30
22
|
}
|
|
31
|
-
declare function getDefaultContoursLevel(
|
|
32
|
-
declare function contoursManager(
|
|
33
|
-
declare function drawContours(level:
|
|
34
|
-
contours: {
|
|
35
|
-
zValue: any;
|
|
36
|
-
lines: never[];
|
|
37
|
-
}[];
|
|
38
|
-
timeout: boolean;
|
|
39
|
-
};
|
|
23
|
+
declare function getDefaultContoursLevel(spectrum: Spectrum2D, quadrant?: string): ContourOptions;
|
|
24
|
+
declare function contoursManager(spectrum: Spectrum2D): ReturnContoursManager;
|
|
25
|
+
declare function drawContours(level: ContourItem, spectrum: Spectrum2D, negative?: boolean, quadrant?: string): import("ml-conrec").DrawContourResult<"basic">;
|
|
40
26
|
export { drawContours, contoursManager, getDefaultContoursLevel, DEFAULT_CONTOURS_OPTIONS, };
|
|
41
27
|
export type { ContoursLevels, ReturnContoursManager, Level, LevelSign };
|