@complat/react-spectra-editor 0.11.0 → 0.11.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/dist/helpers/chem.js +44 -2
- package/package.json +1 -1
package/dist/helpers/chem.js
CHANGED
|
@@ -652,6 +652,38 @@ var extrFeaturesXrd = function extrFeaturesXrd(jcamp, layout, peakUp) {
|
|
|
652
652
|
return r != null;
|
|
653
653
|
});
|
|
654
654
|
|
|
655
|
+
var category = jcamp.info.$CSCATEGORY;
|
|
656
|
+
if (category) {
|
|
657
|
+
var idxEditPeak = category.indexOf('EDIT_PEAK');
|
|
658
|
+
if (idxEditPeak >= 0) {
|
|
659
|
+
var sEP = jcamp.spectra[idxEditPeak];
|
|
660
|
+
var thresRef = calcThresRef(sEP, peakUp);
|
|
661
|
+
features.editPeak = buildPeakFeature(jcamp, layout, peakUp, sEP, thresRef);
|
|
662
|
+
}
|
|
663
|
+
var idxAutoPeak = category.indexOf('AUTO_PEAK');
|
|
664
|
+
if (idxAutoPeak >= 0) {
|
|
665
|
+
var sAP = jcamp.spectra[idxAutoPeak];
|
|
666
|
+
var _thresRef2 = calcThresRef(sAP, peakUp);
|
|
667
|
+
features.autoPeak = buildPeakFeature(jcamp, layout, peakUp, sAP, _thresRef2);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return features;
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
var extrFeaturesCylicVolta = function extrFeaturesCylicVolta(jcamp, layout, peakUp) {
|
|
675
|
+
var base = jcamp.spectra[0];
|
|
676
|
+
|
|
677
|
+
var features = jcamp.spectra.map(function (s) {
|
|
678
|
+
var upperThres = _format2.default.isXRDLayout(layout) ? 100 : calcUpperThres(s);
|
|
679
|
+
var lowerThres = _format2.default.isXRDLayout(layout) ? 100 : calcLowerThres(s);
|
|
680
|
+
var cpo = buildPeakFeature(jcamp, layout, peakUp, s, 100, upperThres, lowerThres);
|
|
681
|
+
var bnd = getBoundary(s);
|
|
682
|
+
return Object.assign({}, base, cpo, bnd);
|
|
683
|
+
}).filter(function (r) {
|
|
684
|
+
return r != null;
|
|
685
|
+
});
|
|
686
|
+
|
|
655
687
|
return features;
|
|
656
688
|
};
|
|
657
689
|
|
|
@@ -712,10 +744,20 @@ var ExtractJcamp = function ExtractJcamp(source) {
|
|
|
712
744
|
var peakUp = !_format2.default.isIrLayout(layout);
|
|
713
745
|
|
|
714
746
|
var spectra = _format2.default.isMsLayout(layout) ? extrSpectraMs(jcamp, layout) : extrSpectraNi(jcamp, layout);
|
|
747
|
+
var features = {};
|
|
748
|
+
if (_format2.default.isMsLayout(layout)) {
|
|
749
|
+
features = extrFeaturesMs(jcamp, layout, peakUp);
|
|
750
|
+
} else if (_format2.default.isXRDLayout(layout)) {
|
|
751
|
+
features = extrFeaturesXrd(jcamp, layout, peakUp);
|
|
752
|
+
} else if (_format2.default.isCyclicVoltaLayout(layout)) {
|
|
753
|
+
features = extrFeaturesCylicVolta(jcamp, layout, peakUp);
|
|
754
|
+
} else {
|
|
755
|
+
features = extrFeaturesNi(jcamp, layout, peakUp, spectra);
|
|
756
|
+
}
|
|
715
757
|
// const features = Format.isMsLayout(layout)
|
|
716
758
|
// ? extrFeaturesMs(jcamp, layout, peakUp)
|
|
717
|
-
// :
|
|
718
|
-
|
|
759
|
+
// : ((Format.isXRDLayout(layout) || Format.isCyclicVoltaLayout(layout))
|
|
760
|
+
// ? extrFeaturesXrd(jcamp, layout, peakUp) : extrFeaturesNi(jcamp, layout, peakUp, spectra));
|
|
719
761
|
|
|
720
762
|
return { spectra: spectra, features: features, layout: layout };
|
|
721
763
|
};
|