From b65441f3120e218e0fd26a5d3a3ceef3b10dfff9 Mon Sep 17 00:00:00 2001 From: Lan Le Date: Tue, 25 Jun 2024 14:04:29 +0200 Subject: [PATCH] Add DSC layout and inline notation for CV layout (#222) * feat: add dsc layout (#217) * feat: add function to generate inline notation for CV layout (#215) --- cypress/e2e/nmr1h_spec.cy.ts | 4 +- dist/actions/meta.js | 9 +- dist/components/cmd_bar/r01_layout.js | 4 + dist/components/cmd_bar/r05_submit_btn.js | 19 +- dist/components/d3_line/line_focus.js | 2 +- dist/components/d3_multi/multi_focus.js | 2 +- dist/components/panel/info.js | 84 +- dist/constants/action_type.js | 4 +- dist/constants/list_layout.js | 3 +- dist/helpers/cfg.js | 2 +- dist/helpers/chem.js | 26 +- dist/helpers/compass.js | 2 +- dist/helpers/format.js | 100 +- dist/index.js | 56 +- dist/layer_init.js | 14 +- dist/reducers/reducer_meta.js | 14 + dist/sagas/saga_meta.js | 10 +- dist/sagas/saga_ui.js | 1 + package.json | 4 +- .../fixtures/cyclic_voltammetry_1.js | 2 + src/__tests__/fixtures/dsc_jcamp.js | 420 ++++ .../units/components/panel/info.test.js | 1 + src/__tests__/units/helpers/cfg.test.tsx | 46 +- src/__tests__/units/helpers/chem.test.tsx | 2 +- src/__tests__/units/helpers/format.test.tsx | 55 +- src/actions/meta.js | 9 +- src/components/cmd_bar/r01_layout.js | 3 + src/components/cmd_bar/r05_submit_btn.js | 9 +- src/components/d3_line/line_focus.js | 3 +- src/components/d3_multi/multi_focus.js | 3 +- src/components/panel/info.js | 56 +- src/constants/action_type.js | 2 + src/constants/list_layout.js | 1 + src/helpers/cfg.js | 1 + src/helpers/chem.js | 19 +- src/helpers/compass.js | 2 +- src/helpers/format.js | 64 +- src/index.js | 38 +- src/layer_init.js | 9 +- src/reducers/reducer_meta.js | 11 + src/sagas/saga_meta.js | 10 + src/sagas/saga_ui.js | 1 + yarn.lock | 2034 ++++++++--------- 43 files changed, 2044 insertions(+), 1117 deletions(-) create mode 100644 src/__tests__/fixtures/dsc_jcamp.js diff --git a/cypress/e2e/nmr1h_spec.cy.ts b/cypress/e2e/nmr1h_spec.cy.ts index 4c35a634..d312fd64 100644 --- a/cypress/e2e/nmr1h_spec.cy.ts +++ b/cypress/e2e/nmr1h_spec.cy.ts @@ -70,9 +70,9 @@ describe('NMR 1H', () => { cy.get('.btn-sv-bar-spctrum').click() cy.get('.input-sv-bar-layout').click() cy.get('.option-sv-bar-layout').should($li => { - expect($li).to.have.length(22) + expect($li).to.have.length(23) }) - cy.get('ul li:nth-child(8)').click() + cy.get('ul li:nth-child(9)').click() cy.get('.d3Line').children().should('have.class', 'd3Svg') cy.get('.d3Svg text.xLabel').should('have.text', 'X (PPM)') diff --git a/dist/actions/meta.js b/dist/actions/meta.js index 66d2470f..dce5acf9 100644 --- a/dist/actions/meta.js +++ b/dist/actions/meta.js @@ -3,10 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateMetaPeaks = void 0; +exports.updateMetaPeaks = exports.updateDSCMetaData = void 0; var _action_type = require("../constants/action_type"); const updateMetaPeaks = payload => ({ type: _action_type.META.UPDATE_PEAKS, payload }); -exports.updateMetaPeaks = updateMetaPeaks; \ No newline at end of file +exports.updateMetaPeaks = updateMetaPeaks; +const updateDSCMetaData = payload => ({ + type: _action_type.META.UPDATE_META_DATA, + payload +}); +exports.updateDSCMetaData = updateDSCMetaData; \ No newline at end of file diff --git a/dist/components/cmd_bar/r01_layout.js b/dist/components/cmd_bar/r01_layout.js index dfa61c66..98f81ee3 100644 --- a/dist/components/cmd_bar/r01_layout.js +++ b/dist/components/cmd_bar/r01_layout.js @@ -108,6 +108,10 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => { }, /*#__PURE__*/_react.default.createElement("span", { className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout') }, "TGA (THERMOGRAVIMETRIC ANALYSIS)")), /*#__PURE__*/_react.default.createElement(_material.MenuItem, { + value: _list_layout.LIST_LAYOUT.DSC + }, /*#__PURE__*/_react.default.createElement("span", { + className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout') + }, "DSC (DIFFERENTIAL SCANNING CALORIMETRY)")), /*#__PURE__*/_react.default.createElement(_material.MenuItem, { value: _list_layout.LIST_LAYOUT.XRD }, /*#__PURE__*/_react.default.createElement("span", { className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout') diff --git a/dist/components/cmd_bar/r05_submit_btn.js b/dist/components/cmd_bar/r05_submit_btn.js index 734ff0dd..769e5cce 100644 --- a/dist/components/cmd_bar/r05_submit_btn.js +++ b/dist/components/cmd_bar/r05_submit_btn.js @@ -21,7 +21,7 @@ react/function-component-definition, function-call-argument-newline, react/require-default-props */ const styles = () => Object.assign({}, _common.commonStyle); -const onClickCb = (operation, peaksEdit, isAscend, isIntensity, scan, thres, layoutSt, shiftSt, analysis, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, aucValues, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt) => () => { +const onClickCb = (operation, peaksEdit, isAscend, isIntensity, scan, thres, layoutSt, shiftSt, analysis, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, aucValues, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, dscMetaData) => () => { operation({ peaks: peaksEdit, layout: layoutSt, @@ -40,7 +40,8 @@ const onClickCb = (operation, peaksEdit, isAscend, isIntensity, scan, thres, lay cyclicvoltaSt, curveSt, axesUnitsSt, - detectorSt + detectorSt, + dscMetaData }); }; const BtnSubmit = _ref => { @@ -64,13 +65,17 @@ const BtnSubmit = _ref => { cyclicvoltaSt, curveSt, axesUnitsSt, - detectorSt + detectorSt, + metaSt } = _ref; const peaksEdit = (0, _extractPeaksEdit.extractPeaksEdit)(feature, editPeakSt, thresSt, shiftSt, layoutSt); // const disBtn = peaksEdit.length === 0 || statusSt.btnSubmit || disabled; const scan = (0, _chem.Convert2Scan)(feature, scanSt); const thres = (0, _chem.Convert2Thres)(feature, thresSt); const aucValues = (0, _extractPeaksEdit.extractAreaUnderCurve)(allIntegrationSt, integrationSt, layoutSt); + const { + dscMetaData + } = metaSt; if (!operation) return null; return /*#__PURE__*/_react.default.createElement(_Tooltip.default, { title: /*#__PURE__*/_react.default.createElement("span", { @@ -79,7 +84,7 @@ const BtnSubmit = _ref => { }, /*#__PURE__*/_react.default.createElement(_common.MuButton, { className: (0, _classnames.default)('btn-sv-bar-submit'), color: "primary", - onClick: onClickCb(operation.value, peaksEdit, isAscend, isIntensity, scan, thres, layoutSt, shiftSt, forecastSt.predictions, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, aucValues, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt) + onClick: onClickCb(operation.value, peaksEdit, isAscend, isIntensity, scan, thres, layoutSt, shiftSt, forecastSt.predictions, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, aucValues, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, dscMetaData) }, /*#__PURE__*/_react.default.createElement(_PlayCircleOutline.default, { className: classes.icon }))); @@ -101,7 +106,8 @@ const mapStateToProps = (state, props) => ( cyclicvoltaSt: state.cyclicvolta, curveSt: state.curve, axesUnitsSt: state.axesUnits, - detectorSt: state.detector + detectorSt: state.detector, + metaSt: state.meta }); const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({}, dispatch); BtnSubmit.propTypes = { @@ -124,6 +130,7 @@ BtnSubmit.propTypes = { cyclicvoltaSt: _propTypes.default.object.isRequired, curveSt: _propTypes.default.object, axesUnitsSt: _propTypes.default.object.isRequired, - detectorSt: _propTypes.default.object.isRequired + detectorSt: _propTypes.default.object.isRequired, + metaSt: _propTypes.default.object.isRequired }; var _default = exports.default = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps), (0, _styles.withStyles)(styles))(BtnSubmit); \ No newline at end of file diff --git a/dist/components/d3_line/line_focus.js b/dist/components/d3_line/line_focus.js index 245be342..f3701ada 100644 --- a/dist/components/d3_line/line_focus.js +++ b/dist/components/d3_line/line_focus.js @@ -596,7 +596,7 @@ class LineFocus { return null; } reverseXAxis(layoutSt) { - return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.DLS_ACF, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.EMISSIONS, _list_layout.LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0; + return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.DLS_ACF, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.EMISSIONS, _list_layout.LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0; } create(_ref) { let { diff --git a/dist/components/d3_multi/multi_focus.js b/dist/components/d3_multi/multi_focus.js index 6db9b929..7a16ad6c 100644 --- a/dist/components/d3_multi/multi_focus.js +++ b/dist/components/d3_multi/multi_focus.js @@ -785,7 +785,7 @@ class MultiFocus { ccp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-ref').attr('fill', 'green').attr('fill-opacity', 0.8).merge(ccp).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y)})`); } reverseXAxis(layoutSt) { - return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) < 0; + return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) < 0; } create(_ref) { let { diff --git a/dist/components/panel/info.js b/dist/components/panel/info.js index d177d5ca..d916bdd6 100644 --- a/dist/components/panel/info.js +++ b/dist/components/panel/info.js @@ -16,6 +16,7 @@ var _material = require("@mui/material"); var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore")); var _styles = require("@mui/styles"); var _format = _interopRequireDefault(require("../../helpers/format")); +var _meta = require("../../actions/meta"); /* eslint-disable no-mixed-operators, react/function-component-definition, react/require-default-props, max-len */ @@ -163,7 +164,61 @@ SECData.propTypes = { detector: _propTypes.default.object.isRequired, secData: _propTypes.default.object.isRequired }; -const InfoPanel = _ref2 => { +const DSCData = _ref2 => { + let { + classes, + layout, + dscMetaData, + updateAction + } = _ref2; + if (_format.default.isDSCLayout(layout) && dscMetaData !== undefined) { + const { + meltingPoint, + tg + } = dscMetaData; + const onChange = e => { + const { + name, + value + } = e.target; + const dataToUpdate = { + meltingPoint, + tg + }; + dataToUpdate[name] = value; + updateAction(dataToUpdate); + }; + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", { + className: (0, _classnames.default)(classes.rowRoot, classes.rowOdd) + }, /*#__PURE__*/_react.default.createElement("span", { + className: (0, _classnames.default)(classes.tTxt, classes.tHead, 'txt-sv-panel-txt') + }, "Melting Point: "), /*#__PURE__*/_react.default.createElement("input", { + type: "text", + name: "meltingPoint", + className: (0, _classnames.default)(classes.tTxt, 'txt-sv-panel-txt'), + value: meltingPoint, + onChange: onChange + })), /*#__PURE__*/_react.default.createElement("div", { + className: (0, _classnames.default)(classes.rowRoot, classes.rowEven) + }, /*#__PURE__*/_react.default.createElement("span", { + className: (0, _classnames.default)(classes.tTxt, classes.tHead, 'txt-sv-panel-txt') + }, "TG: "), /*#__PURE__*/_react.default.createElement("input", { + type: "text", + name: "tg", + className: (0, _classnames.default)(classes.tTxt, 'txt-sv-panel-txt'), + value: tg, + onChange: onChange + }))); + } + return null; +}; +DSCData.propTypes = { + classes: _propTypes.default.object.isRequired, + layout: _propTypes.default.string.isRequired, + dscMetaData: _propTypes.default.object.isRequired, + updateAction: _propTypes.default.func.isRequired +}; +const InfoPanel = _ref3 => { let { classes, expand, @@ -180,8 +235,10 @@ const InfoPanel = _ref2 => { onExapnd, canChangeDescription, onDescriptionChanged, - detectorSt - } = _ref2; + detectorSt, + metaSt, + updateDSCMetaDataAct + } = _ref3; if (!feature) return null; const { title, @@ -189,6 +246,9 @@ const InfoPanel = _ref2 => { solventName, secData } = feature; + const { + dscMetaData + } = metaSt; const { curveIdx } = curveSt; @@ -274,7 +334,12 @@ const InfoPanel = _ref2 => { className: (0, _classnames.default)(classes.tTxt, classes.tHead, 'txt-sv-panel-txt') }, "Area under curve (AUC):"), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("span", { className: (0, _classnames.default)(classes.tTxt, classes.tTxtSim, 'txt-sv-panel-txt') - }, aucValue(integration))) : null), !_format.default.isCyclicVoltaLayout(layoutSt) ? /*#__PURE__*/_react.default.createElement(_reactQuill.default, { + }, aucValue(integration))) : null, /*#__PURE__*/_react.default.createElement(DSCData, { + classes: classes, + layout: layoutSt, + dscMetaData: dscMetaData, + updateAction: updateDSCMetaDataAct + })), !_format.default.isCyclicVoltaLayout(layoutSt) ? /*#__PURE__*/_react.default.createElement(_reactQuill.default, { className: (0, _classnames.default)(classes.quill, 'card-sv-quill'), value: descriptions, modules: { @@ -297,9 +362,12 @@ const mapStateToProps = (state, props) => ( simulationSt: state.simulation, shiftSt: state.shift, curveSt: state.curve, - detectorSt: state.detector + detectorSt: state.detector, + metaSt: state.meta }); -const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({}, dispatch); +const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({ + updateDSCMetaDataAct: _meta.updateDSCMetaData +}, dispatch); InfoPanel.propTypes = { classes: _propTypes.default.object.isRequired, expand: _propTypes.default.bool.isRequired, @@ -316,7 +384,9 @@ InfoPanel.propTypes = { canChangeDescription: _propTypes.default.bool.isRequired, onDescriptionChanged: _propTypes.default.func, theoryMass: _propTypes.default.string, - detectorSt: _propTypes.default.object.isRequired + detectorSt: _propTypes.default.object.isRequired, + metaSt: _propTypes.default.object.isRequired, + updateDSCMetaDataAct: _propTypes.default.func.isRequired }; var _default = exports.default = (0, _reactRedux.connect)( // eslint-disable-line diff --git a/dist/constants/action_type.js b/dist/constants/action_type.js index 29fae0d6..2754d8f0 100644 --- a/dist/constants/action_type.js +++ b/dist/constants/action_type.js @@ -106,7 +106,9 @@ const MULTIPLICITY = exports.MULTIPLICITY = { }; const META = exports.META = { UPDATE_PEAKS: 'META_UPDATE_PEAKS', - UPDATE_PEAKS_RDC: 'META_UPDATE_PEAKS_RDC' + UPDATE_PEAKS_RDC: 'META_UPDATE_PEAKS_RDC', + UPDATE_META_DATA: 'UPDATE_META_DATA', + UPDATE_META_DATA_RDC: 'UPDATE_META_DATA_RDC' }; const JCAMP = exports.JCAMP = { ADD_OTHERS: 'JCAMP_ADD_OTHERS', diff --git a/dist/constants/list_layout.js b/dist/constants/list_layout.js index 1c1399ac..545c45af 100644 --- a/dist/constants/list_layout.js +++ b/dist/constants/list_layout.js @@ -25,5 +25,6 @@ const LIST_LAYOUT = exports.LIST_LAYOUT = { AIF: 'AIF', EMISSIONS: 'Emissions', DLS_ACF: 'DLS ACF', - DLS_INTENSITY: 'DLS intensity' + DLS_INTENSITY: 'DLS intensity', + DSC: 'DIFFERENTIAL SCANNING CALORIMETRY' }; \ No newline at end of file diff --git a/dist/helpers/cfg.js b/dist/helpers/cfg.js index d91af7e7..9a75c401 100644 --- a/dist/helpers/cfg.js +++ b/dist/helpers/cfg.js @@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; var _format = _interopRequireDefault(require("./format")); -const btnCmdAnaViewer = layoutSt => _format.default.isMsLayout(layoutSt) || _format.default.isRamanLayout(layoutSt) || _format.default.is19FLayout(layoutSt) || _format.default.isUvVisLayout(layoutSt) || _format.default.isHplcUvVisLayout(layoutSt) || _format.default.isTGALayout(layoutSt) || _format.default.isXRDLayout(layoutSt) || _format.default.is31PLayout(layoutSt) || _format.default.is15NLayout(layoutSt) || _format.default.is29SiLayout(layoutSt) || _format.default.isCyclicVoltaLayout(layoutSt) || _format.default.isCDSLayout(layoutSt) || _format.default.isSECLayout(layoutSt); +const btnCmdAnaViewer = layoutSt => _format.default.isMsLayout(layoutSt) || _format.default.isRamanLayout(layoutSt) || _format.default.is19FLayout(layoutSt) || _format.default.isUvVisLayout(layoutSt) || _format.default.isHplcUvVisLayout(layoutSt) || _format.default.isTGALayout(layoutSt) || _format.default.isDSCLayout(layoutSt) || _format.default.isXRDLayout(layoutSt) || _format.default.is31PLayout(layoutSt) || _format.default.is15NLayout(layoutSt) || _format.default.is29SiLayout(layoutSt) || _format.default.isCyclicVoltaLayout(layoutSt) || _format.default.isCDSLayout(layoutSt) || _format.default.isSECLayout(layoutSt); const hideCmdAnaViewer = () => false; const btnCmdAddPeak = layoutSt => _format.default.isMsLayout(layoutSt); const btnCmdRmPeak = layoutSt => _format.default.isMsLayout(layoutSt); diff --git a/dist/helpers/chem.js b/dist/helpers/chem.js index c9d8dc6f..da442fd9 100644 --- a/dist/helpers/chem.js +++ b/dist/helpers/chem.js @@ -350,6 +350,9 @@ const readLayout = jcamp => { if (dataType.includes('THERMOGRAVIMETRIC ANALYSIS')) { return _list_layout.LIST_LAYOUT.TGA; } + if (dataType.includes('DIFFERENTIAL SCANNING CALORIMETRY')) { + return _list_layout.LIST_LAYOUT.DSC; + } if (dataType.includes('X-RAY DIFFRACTION')) { return _list_layout.LIST_LAYOUT.XRD; } @@ -514,7 +517,8 @@ const buildPeakFeature = function (jcamp, layout, peakUp, s, thresRef) { solventName: info['.SOLVENTNAME'], upperThres, lowerThres, - volammetryData: extractVoltammetryData(jcamp) + volammetryData: extractVoltammetryData(jcamp), + scanRate: +info.$CSSCANRATE || 0.1 }, s); }; const maxArray = arr => { @@ -683,6 +687,7 @@ const extrFeaturesNi = (jcamp, layout, peakUp, spectra) => { nfs.simulation = buildSimFeature(jcamp); return nfs; } + // workaround for legacy design const features = jcamp.spectra.map(s => { const thresRef = calcThresRef(s, peakUp); @@ -768,7 +773,6 @@ const extrFeaturesCylicVolta = (jcamp, layout, peakUp) => { mw: MW }; } - // const detector = Format.isSECLayout(layout) && jcamp.info.$DETECTOR ? jcamp.info.$DETECTOR : ''; return Object.assign({}, base, cpo, bnd, { detector, secData @@ -818,7 +822,7 @@ const extractTemperature = jcamp => { const ExtractJcamp = source => { const jcamp = _jcampconverter.default.convert(source, { xy: true, - keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL|CSAUTOMETADATA|\$DETECTOR|MN|MW|D|MP)/ // eslint-disable-line + keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL|CSAUTOMETADATA|\$DETECTOR|MN|MW|D|MP|MELTINGPOINT|TG|\$CSSCANRATE|\$CSSPECTRUMDIRECTION)/ // eslint-disable-line }); const layout = readLayout(jcamp); const peakUp = !_format.default.isIrLayout(layout); @@ -839,6 +843,22 @@ const ExtractJcamp = source => { features = extrFeaturesCylicVolta(jcamp, layout, peakUp); } else { features = extrFeaturesNi(jcamp, layout, peakUp, spectra); + if (_format.default.isDSCLayout(layout)) { + const { + info + } = jcamp; + const { + MELTINGPOINT, + TG + } = info; + const dscMetaData = { + meltingPoint: MELTINGPOINT, + tg: TG + }; + features = Object.assign({}, features, { + dscMetaData + }); + } } // const features = Format.isMsLayout(layout) // ? extrFeaturesMs(jcamp, layout, peakUp) diff --git a/dist/helpers/compass.js b/dist/helpers/compass.js index 3ee7c7ab..c23573b0 100644 --- a/dist/helpers/compass.js +++ b/dist/helpers/compass.js @@ -97,7 +97,7 @@ const MouseMove = (event, focus) => { dValue = (0, _chem.Convert2DValue)(pt.x).toExponential(2); } focus.root.select('.cursor-txt-hz').attr('transform', `translate(${tx},${ty - 30})`).text(`2Theta: ${pt.x.toExponential(2)}, d-value: ${dValue}`); - } else if (_format.default.isTGALayout(layout)) { + } else if (_format.default.isTGALayout(layout) || _format.default.isDSCLayout(layout)) { focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(`X: ${pt.x.toFixed(3)}, Y: ${pt.y.toFixed(3)}`); } else { focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(pt.x.toFixed(3)); diff --git a/dist/helpers/format.js b/dist/helpers/format.js index 4e085684..fdd11e7d 100644 --- a/dist/helpers/format.js +++ b/dist/helpers/format.js @@ -20,6 +20,7 @@ const spectraDigit = layout => { case _list_layout.LIST_LAYOUT.UVVIS: case _list_layout.LIST_LAYOUT.HPLC_UVVIS: case _list_layout.LIST_LAYOUT.TGA: + case _list_layout.LIST_LAYOUT.DSC: case _list_layout.LIST_LAYOUT.XRD: case _list_layout.LIST_LAYOUT.CDS: case _list_layout.LIST_LAYOUT.SEC: @@ -110,6 +111,10 @@ const spectraOps = { head: 'THERMOGRAVIMETRIC ANALYSIS', tail: ' SECONDS' }, + [_list_layout.LIST_LAYOUT.DSC]: { + head: 'DIFFERENTIAL SCANNING CALORIMETRY', + tail: ' SECONDS' + }, [_list_layout.LIST_LAYOUT.MS]: { head: 'MASS', tail: ' m/z' @@ -119,7 +124,7 @@ const spectraOps = { tail: '.' }, [_list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY]: { - head: 'CYCLIC VOLTAMMETRY', + head: 'CV', tail: '.' }, [_list_layout.LIST_LAYOUT.CDS]: { @@ -411,7 +416,7 @@ const peaksBody = _ref => { if (layout === _list_layout.LIST_LAYOUT.DLS_INTENSITY) { return formatedDLSIntensity(ordered, maxY, decimal, isAscend, isIntensity, boundary, false); } - if (layout === _list_layout.LIST_LAYOUT.RAMAN || layout === _list_layout.LIST_LAYOUT.TGA || layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === _list_layout.LIST_LAYOUT.CDS || layout === _list_layout.LIST_LAYOUT.SEC) { + if (layout === _list_layout.LIST_LAYOUT.RAMAN || layout === _list_layout.LIST_LAYOUT.TGA || layout === _list_layout.LIST_LAYOUT.DSC || layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === _list_layout.LIST_LAYOUT.CDS || layout === _list_layout.LIST_LAYOUT.SEC) { return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false); } if (layout === _list_layout.LIST_LAYOUT.XRD) { @@ -454,6 +459,7 @@ const isRamanLayout = layoutSt => _list_layout.LIST_LAYOUT.RAMAN === layoutSt; const isUvVisLayout = layoutSt => _list_layout.LIST_LAYOUT.UVVIS === layoutSt; const isHplcUvVisLayout = layoutSt => _list_layout.LIST_LAYOUT.HPLC_UVVIS === layoutSt; const isTGALayout = layoutSt => _list_layout.LIST_LAYOUT.TGA === layoutSt; +const isDSCLayout = layoutSt => _list_layout.LIST_LAYOUT.DSC === layoutSt; const isXRDLayout = layoutSt => _list_layout.LIST_LAYOUT.XRD === layoutSt; const isCyclicVoltaLayout = layoutSt => _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt; const isCDSLayout = layoutSt => _list_layout.LIST_LAYOUT.CDS === layoutSt; @@ -538,6 +544,92 @@ const strNumberFixedLength = function (number) { return number.toFixed(lengthToFix); }; +const inlineNotation = function (layout, data) { + let sampleName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + let formattedString = ''; + let quillData = []; + const { + scanRate, + voltaData + } = data; + switch (layout) { + case _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY: + { + if (!voltaData) { + break; + } + let refString = ''; + let nonRefString = ''; + let refOps = []; + const nonRefOps = []; + const { + listPeaks, + xyData + } = voltaData; + const { + x + } = xyData; + listPeaks.forEach(item => { + const { + isRef, + e12, + max, + min + } = item; + const e12Str = e12 ? strNumberFixedLength(e12, 3) : '0'; + const scanRateStr = scanRate ? strNumberFixedLength(scanRate, 3) : '0'; + if (isRef) { + const posNegString = x[0] > x[1] ? 'neg.' : 'pos.'; + refString = `CV ( mM in vs. Ref (Fc+/Fc) = ${e12Str} V, v = ${scanRateStr} V/s, to ${posNegString}):`; + refOps = [{ + insert: 'CV ( mM in vs. Ref ' + }, { + insert: '(Fc' + }, { + insert: '+', + attributes: { + script: 'super' + } + }, { + insert: '/Fc) ' + }, { + insert: `= ${e12Str} V, v = ${scanRateStr} V/s, to ${posNegString}):` + }]; + } else { + const delta = max && min ? strNumberFixedLength(Math.abs(max.x - min.x) * 1000, 3) : '0'; + nonRefString += `\nE1/2 = ([${sampleName}] , ΔEp) = ${e12Str} V (${delta} mV)`; + const currentNoneOps = [{ + insert: '\nE' + }, { + insert: '1/2', + attributes: { + script: 'sub' + } + }, { + insert: ` = ([${sampleName}] , ΔE` + }, { + insert: 'p', + attributes: { + script: 'sub' + } + }, { + insert: `) = ${e12Str} V (${delta} mV)` + }]; + nonRefOps.push(...currentNoneOps); + } + }); + formattedString = refString + nonRefString; + quillData = [...refOps, ...nonRefOps]; + break; + } + default: + break; + } + return { + quillData, + formattedString + }; +}; const Format = { toPeakStr, buildData, @@ -560,6 +652,7 @@ const Format = { isUvVisLayout, isHplcUvVisLayout, isTGALayout, + isDSCLayout, isXRDLayout, isCyclicVoltaLayout, isCDSLayout, @@ -579,6 +672,7 @@ const Format = { isDLSACFLayout, strNumberFixedDecimal, formatedXRD, - strNumberFixedLength + strNumberFixedLength, + inlineNotation }; var _default = exports.default = Format; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index d6921f75..00f8c1e3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -27,6 +27,7 @@ var _uv_vis_jcamp = _interopRequireDefault(require("./__tests__/fixtures/uv_vis_ var _hplc_uvvis_jcamp = _interopRequireDefault(require("./__tests__/fixtures/hplc_uvvis_jcamp")); var _hplc_uvvis_jcamp_ = _interopRequireDefault(require("./__tests__/fixtures/hplc_uvvis_jcamp_2")); var _tga_jcamp = _interopRequireDefault(require("./__tests__/fixtures/tga_jcamp")); +var _dsc_jcamp = _interopRequireDefault(require("./__tests__/fixtures/dsc_jcamp")); var _xrd_jcamp_ = _interopRequireDefault(require("./__tests__/fixtures/xrd_jcamp_1")); var _xrd_jcamp_2 = _interopRequireDefault(require("./__tests__/fixtures/xrd_jcamp_2")); var _cyclic_voltammetry_ = _interopRequireDefault(require("./__tests__/fixtures/cyclic_voltammetry_1")); @@ -64,6 +65,7 @@ const compUvVisEntity = _app.FN.ExtractJcamp(_compare_uv_vis_jcamp.default); const hplcUVVisEntity = _app.FN.ExtractJcamp(_hplc_uvvis_jcamp.default); const hplcUVVisEntity2 = _app.FN.ExtractJcamp(_hplc_uvvis_jcamp_.default); const tgaEntity = _app.FN.ExtractJcamp(_tga_jcamp.default); +const dscEntity = _app.FN.ExtractJcamp(_dsc_jcamp.default); const xrdEntity1 = _app.FN.ExtractJcamp(_xrd_jcamp_.default); const xrdEntity2 = _app.FN.ExtractJcamp(_xrd_jcamp_2.default); const cyclicVoltaEntity1 = _app.FN.ExtractJcamp(_cyclic_voltammetry_.default); @@ -156,6 +158,8 @@ class DemoWriteIr extends _react.default.Component { return hplcUVVisEntity; case 'tga': return tgaEntity; + case 'dsc': + return dscEntity; case 'xrd': return xrdEntity1; case 'cyclic volta': @@ -221,6 +225,7 @@ class DemoWriteIr extends _react.default.Component { case 'uv/vis': case 'hplc uv/vis': case 'tga': + case 'dsc': case 'xrd': case 'ms': case 'cyclic volta': @@ -259,7 +264,9 @@ class DemoWriteIr extends _react.default.Component { decimal, isIntensity, integration, - waveLength + waveLength, + cyclicvoltaSt, + curveSt } = _ref; const entity = this.loadEntity(); const { @@ -289,7 +296,36 @@ class DemoWriteIr extends _react.default.Component { temperature }); const wrapper = _app.FN.peaksWrapper(layout, shift); - const desc = this.rmDollarSign(wrapper.head) + body + wrapper.tail; + let desc = this.rmDollarSign(wrapper.head) + body + wrapper.tail; + if (_app.FN.isCyclicVoltaLayout(layout)) { + const { + spectraList + } = cyclicvoltaSt; + const { + curveIdx, + listCurves + } = curveSt; + const selectedVolta = spectraList[curveIdx]; + const selectedCurve = listCurves[curveIdx]; + const { + feature + } = selectedCurve; + const { + scanRate + } = feature; + const data = { + scanRate, + voltaData: { + listPeaks: selectedVolta.list, + xyData: feature.data[0] + } + }; + const inlineData = _app.FN.inlineNotation(layout, data); + const { + formattedString + } = inlineData; + desc = formattedString; + } return desc; } formatMpy(_ref2) { @@ -393,7 +429,9 @@ class DemoWriteIr extends _react.default.Component { decimal, isIntensity, integration, - waveLength + waveLength, + cyclicvoltaSt, + curveSt } = _ref4; const desc = this.formatPks({ peaks, @@ -403,7 +441,10 @@ class DemoWriteIr extends _react.default.Component { decimal, isIntensity, integration, - waveLength + waveLength, + // eslint-disable-line + cyclicvoltaSt, + curveSt // eslint-disable-line }); this.setState({ desc @@ -625,6 +666,13 @@ class DemoWriteIr extends _react.default.Component { }, onClick: this.onClick('tga') }, "TGA"), /*#__PURE__*/_react.default.createElement(_material.Button, { + id: "btn-dsc", + variant: "contained", + style: { + margin: '0 10px 0 10px' + }, + onClick: this.onClick('dsc') + }, "DSC"), /*#__PURE__*/_react.default.createElement(_material.Button, { id: "btn-xrd", variant: "contained", style: { diff --git a/dist/layer_init.js b/dist/layer_init.js index 7875bc6d..0cd879a3 100644 --- a/dist/layer_init.js +++ b/dist/layer_init.js @@ -61,7 +61,8 @@ class LayerInit extends _react.default.Component { resetInitMsAct, resetInitNmrAct, resetInitCommonWithIntergationAct, - resetDetectorAct + resetDetectorAct, + updateDSCMetaDataAct } = this.props; resetInitCommonAct(); resetDetectorAct(); @@ -96,6 +97,11 @@ class LayerInit extends _react.default.Component { resetInitCommonWithIntergationAct({ integration }); + } else if (_format.default.isDSCLayout(layout)) { + const { + dscMetaData + } = features; + updateDSCMetaDataAct(dscMetaData); } } initReducer() { @@ -191,7 +197,8 @@ const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({ updateOperationAct: _submit.updateOperation, updateMetaPeaksAct: _meta.updateMetaPeaks, addOthersAct: _jcamp.addOthers, - setAllCurvesAct: _curve.setAllCurves + setAllCurvesAct: _curve.setAllCurves, + updateDSCMetaDataAct: _meta.updateDSCMetaData }, dispatch); LayerInit.propTypes = { entity: _propTypes.default.object.isRequired, @@ -222,7 +229,8 @@ LayerInit.propTypes = { setAllCurvesAct: _propTypes.default.func.isRequired, userManualLink: _propTypes.default.object, // eslint-disable-line - resetDetectorAct: _propTypes.default.func.isRequired + resetDetectorAct: _propTypes.default.func.isRequired, + updateDSCMetaDataAct: _propTypes.default.func.isRequired }; var _default = exports.default = (0, _reactRedux.connect)( // eslint-disable-line diff --git a/dist/reducers/reducer_meta.js b/dist/reducers/reducer_meta.js index c9b796a4..6abbca9c 100644 --- a/dist/reducers/reducer_meta.js +++ b/dist/reducers/reducer_meta.js @@ -13,14 +13,28 @@ const initialState = { intervalR: null, observeFrequency: null, deltaX: null + }, + dscMetaData: { + meltingPoint: null, + tg: null } }; +const updateMetaData = (state, action) => { + const { + dscMetaData + } = action.payload; + return Object.assign({}, state, { + dscMetaData + }); +}; const metaReducer = function () { let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; let action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case _action_type.META.UPDATE_PEAKS_RDC: return Object.assign({}, state, action.payload); + case _action_type.META.UPDATE_META_DATA_RDC: + return updateMetaData(state, action); default: return state; } diff --git a/dist/sagas/saga_meta.js b/dist/sagas/saga_meta.js index fb1ebbad..6b3be549 100644 --- a/dist/sagas/saga_meta.js +++ b/dist/sagas/saga_meta.js @@ -32,5 +32,13 @@ function* updateMetaPeaks(action) { } }); } -const metaSagas = [(0, _effects.takeEvery)(_action_type.META.UPDATE_PEAKS, updateMetaPeaks)]; +function* updateMetaData(action) { + yield (0, _effects.put)({ + type: _action_type.META.UPDATE_META_DATA_RDC, + payload: { + dscMetaData: action.payload + } + }); +} +const metaSagas = [(0, _effects.takeEvery)(_action_type.META.UPDATE_PEAKS, updateMetaPeaks), (0, _effects.takeEvery)(_action_type.META.UPDATE_META_DATA, updateMetaData)]; var _default = exports.default = metaSagas; \ No newline at end of file diff --git a/dist/sagas/saga_ui.js b/dist/sagas/saga_ui.js index 48da5752..adf16e94 100644 --- a/dist/sagas/saga_ui.js +++ b/dist/sagas/saga_ui.js @@ -139,6 +139,7 @@ function* scrollUiWheel(action) { case _list_layout.LIST_LAYOUT.UVVIS: case _list_layout.LIST_LAYOUT.HPLC_UVVIS: case _list_layout.LIST_LAYOUT.TGA: + case _list_layout.LIST_LAYOUT.DSC: case _list_layout.LIST_LAYOUT.XRD: default: [nyeL, nyeU] = [yeL, yeL + (yeU - yeL) * scale]; diff --git a/package.json b/package.json index 56ca6772..4f3c5f32 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@complat/react-spectra-editor", - "version": "1.3.1", - "description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS, CV, UIVIS, XRD).", + "version": "1.3.2", + "description": "An editor to View and Edit Chemical Spectra data (NMR, IR, MS, CV, UIVIS, XRD, and DSC).", "repository": { "type": "git", "url": "https://github.com/ComPlat/react-spectra-editor" diff --git a/src/__tests__/fixtures/cyclic_voltammetry_1.js b/src/__tests__/fixtures/cyclic_voltammetry_1.js index 70542699..92612705 100644 --- a/src/__tests__/fixtures/cyclic_voltammetry_1.js +++ b/src/__tests__/fixtures/cyclic_voltammetry_1.js @@ -712,6 +712,8 @@ $$ === CHEMSPECTRA INTEGRALS AND MULTIPLETS === $$ === CHEMSPECTRA SIMULATION === ##$CSSIMULATIONPEAKS= $$ === CHEMSPECTRA CYCLIC VOLTAMMETRY === +##$CSSCANRATE=0.09 +##$CSSPECTRUMDIRECTION=NEGATIVE ##$CSCYCLICVOLTAMMETRYDATA= (0.10003, 2.85434e-06, -1.5404, -3.07144e-06, 1.441336382491224, 1.64043, 0.380242, 1.64361e-06, 1) (0.10002, 2.83434e-06, -1.5504, -3.17144e-06, 1.541336382491224, 1.54043, 0.480242, 1.74361e-06, 0) diff --git a/src/__tests__/fixtures/dsc_jcamp.js b/src/__tests__/fixtures/dsc_jcamp.js new file mode 100644 index 00000000..81ff6c64 --- /dev/null +++ b/src/__tests__/fixtures/dsc_jcamp.js @@ -0,0 +1,420 @@ +const dscJcamp = ` +##TITLE=DSC1.1_bagit +##JCAMP-DX=5.0 +##DATA TYPE=LINK +##BLOCKS=1 + + +$$ === CHEMSPECTRA SPECTRUM ORIG === +##TITLE=DSC1.1_bagit +##JCAMP-DX=5.00 +##DATA TYPE=DIFFERENTIAL SCANNING CALORIMETRY +##DATA CLASS=XYDATA +##$CSCATEGORY=SPECTRUM +##ORIGIN= +##OWNER= +##XUNITS=DEGREES CELSIUS +##YUNITS=W/g +##XFACTOR=1.0 +##YFACTOR=1.0 +##FIRSTX=-63.0 +##LASTX=77.0 +##MAXX=77.0 +##MAXY=0.25175 +##MINX=-63.0 +##MINY=0.11677 +##MELTINGPOINT=1.5 +##TG=6 +##NPOINTS=141 +##XYDATA= (XY..XY) +-63.0, 0.11677 +-62.0, 0.11735 +-61.0, 0.11846 +-60.0, 0.11883 +-59.0, 0.12039 +-58.0, 0.12119 +-57.0, 0.12283 +-56.0, 0.12307 +-55.0, 0.12475 +-54.0, 0.12572 +-53.0, 0.12679 +-52.0, 0.12734 +-51.0, 0.12816 +-50.0, 0.12912 +-49.0, 0.13037 +-48.0, 0.13143 +-47.0, 0.13223 +-46.0, 0.133 +-45.0, 0.13489 +-44.0, 0.13631 +-43.0, 0.13762 +-42.0, 0.13922 +-41.0, 0.14115 +-40.0, 0.14282 +-39.0, 0.14512 +-38.0, 0.14791 +-37.0, 0.15185 +-36.0, 0.15621 +-35.0, 0.16347 +-34.0, 0.17107 +-33.0, 0.181 +-32.0, 0.1906 +-31.0, 0.19701 +-30.0, 0.19835 +-29.0, 0.19769 +-28.0, 0.19625 +-27.0, 0.19572 +-26.0, 0.19538 +-25.0, 0.19507 +-24.0, 0.19475 +-23.0, 0.1959 +-22.0, 0.19594 +-21.0, 0.19629 +-20.0, 0.19673 +-19.0, 0.19782 +-18.0, 0.19831 +-17.0, 0.19894 +-16.0, 0.19921 +-15.0, 0.20047 +-14.0, 0.20127 +-13.0, 0.20227 +-12.0, 0.20231 +-11.0, 0.20364 +-10.0, 0.20473 +-9.0, 0.20614 +-8.0, 0.20717 +-7.0, 0.20811 +-6.0, 0.20812 +-5.0, 0.20888 +-4.0, 0.2094 +-3.0, 0.20991 +-2.0, 0.2107 +-1.0, 0.21024 +0.0, 0.21301 +1.0, 0.21343 +2.0, 0.21476 +3.0, 0.21539 +4.0, 0.21575 +5.0, 0.21741 +6.0, 0.21804 +7.0, 0.21857 +8.0, 0.21968 +9.0, 0.22042 +10.0, 0.22132 +11.0, 0.2219 +12.0, 0.22323 +13.0, 0.22292 +14.0, 0.2238 +15.0, 0.22403 +16.0, 0.22516 +17.0, 0.22501 +18.0, 0.22537 +19.0, 0.22724 +20.0, 0.22789 +21.0, 0.22903 +22.0, 0.22874 +23.0, 0.22968 +24.0, 0.23052 +25.0, 0.23125 +26.0, 0.23222 +27.0, 0.23264 +28.0, 0.23352 +29.0, 0.2329 +30.0, 0.23468 +31.0, 0.23594 +32.0, 0.23694 +33.0, 0.23795 +34.0, 0.23884 +35.0, 0.23874 +36.0, 0.2388 +37.0, 0.23787 +38.0, 0.23632 +39.0, 0.23466 +40.0, 0.2341 +41.0, 0.23385 +42.0, 0.23285 +43.0, 0.23268 +44.0, 0.23306 +45.0, 0.23314 +46.0, 0.23343 +47.0, 0.23341 +48.0, 0.23417 +49.0, 0.23427 +50.0, 0.2345 +51.0, 0.23501 +52.0, 0.23577 +53.0, 0.23657 +54.0, 0.23737 +55.0, 0.23798 +56.0, 0.23837 +57.0, 0.23914 +58.0, 0.23969 +59.0, 0.24067 +60.0, 0.24087 +61.0, 0.24185 +62.0, 0.24243 +63.0, 0.24258 +64.0, 0.24378 +65.0, 0.24441 +66.0, 0.24479 +67.0, 0.24473 +68.0, 0.24596 +69.0, 0.24651 +70.0, 0.24716 +71.0, 0.2482 +72.0, 0.24848 +73.0, 0.24912 +74.0, 0.25051 +75.0, 0.25049 +76.0, 0.2509 +77.0, 0.25175 +$$ === CHEMSPECTRA INTEGRALS AND MULTIPLETS === +##$OBSERVEDINTEGRALS= (X Y Z) + +##$OBSERVEDMULTIPLETS= +##$OBSERVEDMULTIPLETSPEAKS= +$$ === CHEMSPECTRA SIMULATION === +##$CSSIMULATIONPEAKS= +##END= + + +$$ === CHEMSPECTRA PEAK TABLE EDIT === +##TITLE=DSC1.1_bagit +##JCAMP-DX=5.00 +##DATA TYPE=DIFFERENTIAL SCANNING CALORIMETRYPEAKTABLE +##DATA CLASS=PEAKTABLE +##$CSCATEGORY=EDIT_PEAK +##$CSTHRESHOLD=1.05 +##MAXX=77.0 +##MAXY=0.25175 +##MINX=-63.0 +##MINY=0.11677 +##$CSSOLVENTNAME=- - - +##$CSSOLVENTVALUE=0 +##$CSSOLVENTX=0 +##NPOINTS=0 +##PEAKTABLE= (XY..XY) +##END= + + +$$ === CHEMSPECTRA PEAK TABLE AUTO === +##TITLE=DSC1.1_bagit +##JCAMP-DX=5.00 +##DATA TYPE=DIFFERENTIAL SCANNING CALORIMETRYPEAKTABLE +##DATA CLASS=PEAKTABLE +##$CSCATEGORY=AUTO_PEAK +##$CSTHRESHOLD=1.05 +##MAXX=77.0 +##MAXY=0.25175 +##MINX=-63.0 +##MINY=0.11677 +##NPOINTS=0 +##PEAKTABLE= (XY..XY) +##END= + + +$$ === CHEMSPECTRA ORIGINAL METADATA === +###TITLE= DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit +###JCAMPDX= 5.0, 5.00, 5.00, 5.00 +###BLOCKS= 1 +###$CSCATEGORY= SPECTRUM, EDIT_PEAK, AUTO_PEAK +###XUNITS= DEGREES CELSIUS +###YUNITS= W/g +###LASTX= 77.0 +###MAXX= 77.0, 77.0, 77.0 +###MAXY= 0.25175, 0.25175, 0.25175 +###MINX= -63.0, -63.0, -63.0 +###MINY= 0.11677, 0.11677, 0.11677 +###MELTINGPOINT= 1.5 +###TG= 6 +###NPOINTS= 141, 0, 0 +###$OBSERVEDINTEGRALS= (X Y Z) +###$CSTHRESHOLD= 1.05, 1.05 +###$CSSOLVENTNAME= - - - +###$CSSOLVENTVALUE= 0 +###$CSSOLVENTX= 0 +###TITLE= DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, DSC1.1_bagit, Spectrum +###JCAMPDX= 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.0, 5.00, 5.00, 5.00, 5.00 +###BLOCKS= 1, 1, 1, 1, 1, 1, 1, 1, 1 +###$CSCATEGORY= SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK, SPECTRUM, EDIT_PEAK, AUTO_PEAK +###XUNITS= DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS, DEGREES CELSIUS +###YUNITS= W/g, W/g, W/g, W/g, W/g, W/g, W/g, W/g, W/g, W/g, W/g +###LASTX= 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.00000 +###MAXX= 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0, 77.0 +###MAXY= 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175, 0.25175 +###MINX= -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0, -63.0 +###MINY= 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677, 0.11677 +###NPOINTS= 141, 0, 0, 141, 0, 0, 141, 0, 0, 141, 0, 0, 141, 0, 0, 141, 0, 0, 141, 0, 0, 141, 0, 0, 141, 0, 0, 141 +###$OBSERVEDINTEGRALS= (X Y Z), (X Y Z), (X Y Z), (X Y Z), (X Y Z), (X Y Z), (X Y Z), (X Y Z), (X Y Z) +###$CSTHRESHOLD= 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05 +###$CSSOLVENTNAME= - - -, - - -, - - -, - - -, - - -, - - -, - - - +###$CSSOLVENTVALUE= 0, 0, 0, 0, 0, 0, 0, 0, 0 +###$CSSOLVENTX= 0, 0, 0, 0, 0, 0, 0, 0, 0 +###SAMPLE= SB +###AMOUNT= 6,4 +###DATE= 31.03.2022 +###TIME= 12:47:59 (UTC+2) +###REFERENCE= ----- +###REFERENCEMASS= 0.0 +###TEMPCAL= 14-03-2022 +###SENSFILE= 14-03-2022 +###SEGMENTS= 4/4 +###BRAND= NETZSCH +###INSTRUMENT= DSC 214 +###CRUCIBLE= Concavus Al, pierced lid +###ATMOSPHERE= NITROGEN,250,0 ml/min +###RANGE= 5.0 +###TEMPERATURE= -80C/10,0(K/min)/200C +###OPERATOR= SB +###XYPOINTS= (XY..XY) +-63.00000, 0.11677 +-62.00000, 0.11735 +-61.00000, 0.11846 +-60.00000, 0.11883 +-59.00000, 0.12039 +-58.00000, 0.12119 +-57.00000, 0.12283 +-56.00000, 0.12307 +-55.00000, 0.12475 +-54.00000, 0.12572 +-53.00000, 0.12679 +-52.00000, 0.12734 +-51.00000, 0.12816 +-50.00000, 0.12912 +-49.00000, 0.13037 +-48.00000, 0.13143 +-47.00000, 0.13223 +-46.00000, 0.13300 +-45.00000, 0.13489 +-44.00000, 0.13631 +-43.00000, 0.13762 +-42.00000, 0.13922 +-41.00000, 0.14115 +-40.00000, 0.14282 +-39.00000, 0.14512 +-38.00000, 0.14791 +-37.00000, 0.15185 +-36.00000, 0.15621 +-35.00000, 0.16347 +-34.00000, 0.17107 +-33.00000, 0.18100 +-32.00000, 0.19060 +-31.00000, 0.19701 +-30.00000, 0.19835 +-29.00000, 0.19769 +-28.00000, 0.19625 +-27.00000, 0.19572 +-26.00000, 0.19538 +-25.00000, 0.19507 +-24.00000, 0.19475 +-23.00000, 0.19590 +-22.00000, 0.19594 +-21.00000, 0.19629 +-20.00000, 0.19673 +-19.00000, 0.19782 +-18.00000, 0.19831 +-17.00000, 0.19894 +-16.00000, 0.19921 +-15.00000, 0.20047 +-14.00000, 0.20127 +-13.00000, 0.20227 +-12.00000, 0.20231 +-11.00000, 0.20364 +-10.00000, 0.20473 + -9.00000, 0.20614 + -8.00000, 0.20717 + -7.00000, 0.20811 + -6.00000, 0.20812 + -5.00000, 0.20888 + -4.00000, 0.20940 + -3.00000, 0.20991 + -2.00000, 0.21070 + -1.00000, 0.21024 + 0.00000, 0.21301 + 1.00000, 0.21343 + 2.00000, 0.21476 + 3.00000, 0.21539 + 4.00000, 0.21575 + 5.00000, 0.21741 + 6.00000, 0.21804 + 7.00000, 0.21857 + 8.00000, 0.21968 + 9.00000, 0.22042 + 10.00000, 0.22132 + 11.00000, 0.22190 + 12.00000, 0.22323 + 13.00000, 0.22292 + 14.00000, 0.22380 + 15.00000, 0.22403 + 16.00000, 0.22516 + 17.00000, 0.22501 + 18.00000, 0.22537 + 19.00000, 0.22724 + 20.00000, 0.22789 + 21.00000, 0.22903 + 22.00000, 0.22874 + 23.00000, 0.22968 + 24.00000, 0.23052 + 25.00000, 0.23125 + 26.00000, 0.23222 + 27.00000, 0.23264 + 28.00000, 0.23352 + 29.00000, 0.23290 + 30.00000, 0.23468 + 31.00000, 0.23594 + 32.00000, 0.23694 + 33.00000, 0.23795 + 34.00000, 0.23884 + 35.00000, 0.23874 + 36.00000, 0.23880 + 37.00000, 0.23787 + 38.00000, 0.23632 + 39.00000, 0.23466 + 40.00000, 0.23410 + 41.00000, 0.23385 + 42.00000, 0.23285 + 43.00000, 0.23268 + 44.00000, 0.23306 + 45.00000, 0.23314 + 46.00000, 0.23343 + 47.00000, 0.23341 + 48.00000, 0.23417 + 49.00000, 0.23427 + 50.00000, 0.23450 + 51.00000, 0.23501 + 52.00000, 0.23577 + 53.00000, 0.23657 + 54.00000, 0.23737 + 55.00000, 0.23798 + 56.00000, 0.23837 + 57.00000, 0.23914 + 58.00000, 0.23969 + 59.00000, 0.24067 + 60.00000, 0.24087 + 61.00000, 0.24185 + 62.00000, 0.24243 + 63.00000, 0.24258 + 64.00000, 0.24378 + 65.00000, 0.24441 + 66.00000, 0.24479 + 67.00000, 0.24473 + 68.00000, 0.24596 + 69.00000, 0.24651 + 70.00000, 0.24716 + 71.00000, 0.24820 + 72.00000, 0.24848 + 73.00000, 0.24912 + 74.00000, 0.25051 + 75.00000, 0.25049 + 76.00000, 0.25090 + 77.00000, 0.25175 + + +##END= + + + + +`; + +export default dscJcamp; diff --git a/src/__tests__/units/components/panel/info.test.js b/src/__tests__/units/components/panel/info.test.js index 73a71db3..647164e7 100644 --- a/src/__tests__/units/components/panel/info.test.js +++ b/src/__tests__/units/components/panel/info.test.js @@ -29,6 +29,7 @@ const store = mockStore({ }, ], }, + meta: {} }); const failedStore = mockStore({ diff --git a/src/__tests__/units/helpers/cfg.test.tsx b/src/__tests__/units/helpers/cfg.test.tsx index 482a53f7..bd65672a 100644 --- a/src/__tests__/units/helpers/cfg.test.tsx +++ b/src/__tests__/units/helpers/cfg.test.tsx @@ -10,8 +10,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.IR, LIST_LAYOUT.C13, LIST_LAYOUT.H1] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.MS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) it('Show analytical view button', () => { @@ -37,8 +37,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.IR, LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) it('Show add peaks button', () => { @@ -75,7 +75,7 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.MS, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) @@ -99,8 +99,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.MS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) it('Show add and remove multiplicity button', () => { @@ -123,8 +123,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.HPLC_UVVIS] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.MS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) it('Show add and remove integration button', () => { @@ -149,8 +149,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.MS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) it('Show add and remove multiplicity peak button', () => { @@ -180,8 +180,8 @@ describe('Test Config helper', () => { layoutShouldHide = [LIST_LAYOUT.MS] layoutShouldView = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.HPLC_UVVIS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] }) it('Show threshold line', () => { @@ -216,8 +216,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.SEC] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.HPLC_UVVIS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.MS] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.MS] }) it('Show panel peaks info view', () => { @@ -240,8 +240,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.SEC, LIST_LAYOUT.HPLC_UVVIS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.MS] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.MS] }) it('Show multiplicity info view', () => { @@ -264,8 +264,8 @@ describe('Test Config helper', () => { layoutShouldView = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29] layoutShouldHide = [LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.SEC, LIST_LAYOUT.HPLC_UVVIS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.MS] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.MS] }) it('Show solvent info view', () => { @@ -289,8 +289,8 @@ describe('Test Config helper', () => { layoutShouldHide = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.SEC, - LIST_LAYOUT.TGA, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, - LIST_LAYOUT.CDS, LIST_LAYOUT.MS] + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, + LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.MS] }) it('Show comparison info view', () => { @@ -314,7 +314,7 @@ describe('Test Config helper', () => { layoutShouldHide = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.SEC, LIST_LAYOUT.HPLC_UVVIS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.CDS, LIST_LAYOUT.MS] }) @@ -339,7 +339,7 @@ describe('Test Config helper', () => { layoutShouldHide = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.IR, LIST_LAYOUT.SEC, LIST_LAYOUT.HPLC_UVVIS, - LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.CDS, LIST_LAYOUT.MS] }) diff --git a/src/__tests__/units/helpers/chem.test.tsx b/src/__tests__/units/helpers/chem.test.tsx index 75b1ebe7..b6312174 100644 --- a/src/__tests__/units/helpers/chem.test.tsx +++ b/src/__tests__/units/helpers/chem.test.tsx @@ -341,7 +341,7 @@ describe('Test for chem helper', () => { const layoutShouldHide = [LIST_LAYOUT.C13, LIST_LAYOUT.H1, LIST_LAYOUT.F19, LIST_LAYOUT.P31, LIST_LAYOUT.N15, LIST_LAYOUT.Si29, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.MS, - LIST_LAYOUT.TGA, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC] describe('Layouts do not have comparison', () => { diff --git a/src/__tests__/units/helpers/format.test.tsx b/src/__tests__/units/helpers/format.test.tsx index 0627d86b..bb93890a 100644 --- a/src/__tests__/units/helpers/format.test.tsx +++ b/src/__tests__/units/helpers/format.test.tsx @@ -212,7 +212,7 @@ describe('Test format helper', () => { describe('Get digit number of spectra based on layout', () => { it('Layout digit 0', () => { const listLayout = [LIST_LAYOUT.IR, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, - LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, + LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC, LIST_LAYOUT.MS ]; @@ -451,4 +451,57 @@ describe('Test format helper', () => { expect(strNumber2).toEqual(expected2) }) }) + + describe('Format inline notation', () => { + it('Inline notation for Cyclic voltammetry layout', () => { + const expectedString = "CV ( mM in vs. Ref (Fc+/Fc) = -0.72 V, v = 0.10 V/s, to neg.):\nE1/2 = ([Cu(TMGqu)] , ΔEp) = -0.73 V (1650 mV)" + const expectedQuillData = [ + { + insert: "CV ( mM in vs. Ref " + }, + { + insert: "(Fc" + }, + { + insert: "+", attributes: { script: 'super' } + }, + { + insert: "/Fc) " + }, + { + insert: "= -0.72 V, v = 0.10 V/s, to neg.):" + }, + { + insert: "\nE" + }, + { + insert: "1/2", attributes: { script: 'sub' } + }, + { + insert: " = ([Cu(TMGqu)] , ΔE" + }, + { + insert: "p", attributes: { script: 'sub' } + }, + { + insert: ") = -0.73 V (1650 mV)" + }, + ] + const layout = LIST_LAYOUT.CYCLIC_VOLTAMMETRY + const data = { + scanRate: 0.1, + voltaData: { + listPeaks: [{"min":{"x":-1.5404,"y":-0.00000307144},"max":{"x":0.10003,"y":0.00000285434},"isRef":true,"e12":-0.720185,"createdAt":1716803991732,"updatedAt":1716803991733,"pecker":{"x":0.380242,"y":0.00000164361}},{"max":{"x":0.10002,"y":0.00000283434},"e12":-0.72519,"updatedAt":1716803991733,"min":{"x":-1.5504,"y":-0.00000317144},"pecker":{"x":0.480242,"y":0.00000174361},"isRef":false}], + xyData: { + x: [1.49048, 1.48049], + y: [0.00000534724, 0.00000481545] + } + } + } + const formattedData = Format.inlineNotation(layout, data, 'Cu(TMGqu)') + const { formattedString, quillData } = formattedData; + expect(formattedString).toEqual(expectedString) + expect(quillData).toEqual(expectedQuillData) + }) + }) }) diff --git a/src/actions/meta.js b/src/actions/meta.js index ea8aa50d..dc6a2be0 100644 --- a/src/actions/meta.js +++ b/src/actions/meta.js @@ -7,6 +7,13 @@ const updateMetaPeaks = (payload) => ( } ); +const updateDSCMetaData = (payload) => ( + { + type: META.UPDATE_META_DATA, + payload, + } +); + export { - updateMetaPeaks, // eslint-disable-line + updateMetaPeaks, updateDSCMetaData, // eslint-disable-line }; diff --git a/src/components/cmd_bar/r01_layout.js b/src/components/cmd_bar/r01_layout.js index c41ccf6d..84785a66 100644 --- a/src/components/cmd_bar/r01_layout.js +++ b/src/components/cmd_bar/r01_layout.js @@ -115,6 +115,9 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => { TGA (THERMOGRAVIMETRIC ANALYSIS) + + DSC (DIFFERENTIAL SCANNING CALORIMETRY) + XRD (X-RAY DIFFRACTION) diff --git a/src/components/cmd_bar/r05_submit_btn.js b/src/components/cmd_bar/r05_submit_btn.js index ee6bb317..b992f359 100644 --- a/src/components/cmd_bar/r05_submit_btn.js +++ b/src/components/cmd_bar/r05_submit_btn.js @@ -28,7 +28,7 @@ const onClickCb = ( operation, peaksEdit, isAscend, isIntensity, scan, thres, layoutSt, shiftSt, analysis, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, aucValues, waveLengthSt, - cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, + cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, dscMetaData, ) => ( () => { operation({ @@ -50,6 +50,7 @@ const onClickCb = ( curveSt, axesUnitsSt, detectorSt, + dscMetaData, }); } ); @@ -59,12 +60,14 @@ const BtnSubmit = ({ editPeakSt, thresSt, layoutSt, shiftSt, scanSt, forecastSt, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, + metaSt, }) => { const peaksEdit = extractPeaksEdit(feature, editPeakSt, thresSt, shiftSt, layoutSt); // const disBtn = peaksEdit.length === 0 || statusSt.btnSubmit || disabled; const scan = Convert2Scan(feature, scanSt); const thres = Convert2Thres(feature, thresSt); const aucValues = extractAreaUnderCurve(allIntegrationSt, integrationSt, layoutSt); + const { dscMetaData } = metaSt; if (!operation) return null; @@ -81,7 +84,7 @@ const BtnSubmit = ({ operation.value, peaksEdit, isAscend, isIntensity, scan, thres, layoutSt, shiftSt, forecastSt.predictions, decimalSt, integrationSt, multiplicitySt, allIntegrationSt, aucValues, waveLengthSt, - cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, + cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, dscMetaData, )} > @@ -107,6 +110,7 @@ const mapStateToProps = (state, props) => ( // eslint-disable-line curveSt: state.curve, axesUnitsSt: state.axesUnits, detectorSt: state.detector, + metaSt: state.meta, } ); @@ -141,6 +145,7 @@ BtnSubmit.propTypes = { curveSt: PropTypes.object, axesUnitsSt: PropTypes.object.isRequired, detectorSt: PropTypes.object.isRequired, + metaSt: PropTypes.object.isRequired, }; export default compose( diff --git a/src/components/d3_line/line_focus.js b/src/components/d3_line/line_focus.js index d040b0bd..5aef59e3 100644 --- a/src/components/d3_line/line_focus.js +++ b/src/components/d3_line/line_focus.js @@ -783,7 +783,8 @@ class LineFocus { } reverseXAxis(layoutSt) { - return [LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.TGA, + return [LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.DLS_ACF, LIST_LAYOUT.SEC, LIST_LAYOUT.EMISSIONS, LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0; diff --git a/src/components/d3_multi/multi_focus.js b/src/components/d3_multi/multi_focus.js index a1d088cc..fa524c27 100644 --- a/src/components/d3_multi/multi_focus.js +++ b/src/components/d3_multi/multi_focus.js @@ -976,7 +976,8 @@ class MultiFocus { } reverseXAxis(layoutSt) { - return [LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.TGA, + return [LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS, + LIST_LAYOUT.TGA, LIST_LAYOUT.DSC, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS, LIST_LAYOUT.SEC, LIST_LAYOUT.AIF].indexOf(layoutSt) < 0; } diff --git a/src/components/panel/info.js b/src/components/panel/info.js index d13c9777..57bf2d65 100644 --- a/src/components/panel/info.js +++ b/src/components/panel/info.js @@ -15,6 +15,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import { withStyles } from '@mui/styles'; import Format from '../../helpers/format'; +import { updateDSCMetaData } from '../../actions/meta'; const styles = () => ({ chip: { @@ -155,15 +156,55 @@ SECData.propTypes = { secData: PropTypes.object.isRequired, }; +const DSCData = ({ + classes, layout, dscMetaData, updateAction, +}) => { + if (Format.isDSCLayout(layout) && dscMetaData !== undefined) { + const { + meltingPoint, tg, + } = dscMetaData; + + const onChange = (e) => { + const { name, value } = e.target; + const dataToUpdate = { meltingPoint, tg }; + dataToUpdate[name] = value; + updateAction(dataToUpdate); + }; + + return ( +
+
+ Melting Point: + +
+
+ TG: + +
+
+ ); + } + return null; +}; + +DSCData.propTypes = { + classes: PropTypes.object.isRequired, + layout: PropTypes.string.isRequired, + dscMetaData: PropTypes.object.isRequired, + updateAction: PropTypes.func.isRequired, +}; + const InfoPanel = ({ classes, expand, feature, integration, editorOnly, molSvg, descriptions, layoutSt, simulationSt, shiftSt, curveSt, theoryMass, onExapnd, canChangeDescription, onDescriptionChanged, detectorSt, + metaSt, updateDSCMetaDataAct, }) => { if (!feature) return null; const { title, observeFrequency, solventName, secData, } = feature; + const { dscMetaData } = metaSt; const { curveIdx } = curveSt; const { curves } = detectorSt; @@ -247,16 +288,6 @@ const InfoPanel = ({ ) : null } - {/* { - Format.isSECLayout(layoutSt) - ? ( -
- Detector: - {selectedDetector} -
- ) - : null - } */} { !molSvg @@ -282,6 +313,7 @@ const InfoPanel = ({ ) : null } + {/* ( // eslint-disable-line shiftSt: state.shift, curveSt: state.curve, detectorSt: state.detector, + metaSt: state.meta, } ); const mapDispatchToProps = (dispatch) => ( bindActionCreators({ + updateDSCMetaDataAct: updateDSCMetaData, }, dispatch) ); @@ -355,6 +389,8 @@ InfoPanel.propTypes = { onDescriptionChanged: PropTypes.func, theoryMass: PropTypes.string, detectorSt: PropTypes.object.isRequired, + metaSt: PropTypes.object.isRequired, + updateDSCMetaDataAct: PropTypes.func.isRequired, }; export default connect( // eslint-disable-line diff --git a/src/constants/action_type.js b/src/constants/action_type.js index 1de86d6f..09a72bb8 100644 --- a/src/constants/action_type.js +++ b/src/constants/action_type.js @@ -114,6 +114,8 @@ const MULTIPLICITY = { const META = { UPDATE_PEAKS: 'META_UPDATE_PEAKS', UPDATE_PEAKS_RDC: 'META_UPDATE_PEAKS_RDC', + UPDATE_META_DATA: 'UPDATE_META_DATA', + UPDATE_META_DATA_RDC: 'UPDATE_META_DATA_RDC', }; const JCAMP = { diff --git a/src/constants/list_layout.js b/src/constants/list_layout.js index c6ea126e..b4152307 100644 --- a/src/constants/list_layout.js +++ b/src/constants/list_layout.js @@ -20,6 +20,7 @@ const LIST_LAYOUT = { EMISSIONS: 'Emissions', DLS_ACF: 'DLS ACF', DLS_INTENSITY: 'DLS intensity', + DSC: 'DIFFERENTIAL SCANNING CALORIMETRY', }; export { diff --git a/src/helpers/cfg.js b/src/helpers/cfg.js index 4ba5c331..77d3a1d0 100644 --- a/src/helpers/cfg.js +++ b/src/helpers/cfg.js @@ -7,6 +7,7 @@ const btnCmdAnaViewer = (layoutSt) => ( || Format.isUvVisLayout(layoutSt) || Format.isHplcUvVisLayout(layoutSt) || Format.isTGALayout(layoutSt) + || Format.isDSCLayout(layoutSt) || Format.isXRDLayout(layoutSt) || Format.is31PLayout(layoutSt) || Format.is15NLayout(layoutSt) diff --git a/src/helpers/chem.js b/src/helpers/chem.js index 571d3f9f..a9decfb6 100644 --- a/src/helpers/chem.js +++ b/src/helpers/chem.js @@ -306,6 +306,9 @@ const readLayout = (jcamp) => { if (dataType.includes('THERMOGRAVIMETRIC ANALYSIS')) { return LIST_LAYOUT.TGA; } + if (dataType.includes('DIFFERENTIAL SCANNING CALORIMETRY')) { + return LIST_LAYOUT.DSC; + } if (dataType.includes('X-RAY DIFFRACTION')) { return LIST_LAYOUT.XRD; } @@ -470,6 +473,7 @@ const buildPeakFeature = (jcamp, layout, peakUp, s, thresRef, upperThres = false upperThres, lowerThres, volammetryData: extractVoltammetryData(jcamp), + scanRate: +info.$CSSCANRATE || 0.1, }, s, ) @@ -644,6 +648,7 @@ const extrFeaturesNi = (jcamp, layout, peakUp, spectra) => { nfs.simulation = buildSimFeature(jcamp); return nfs; } + // workaround for legacy design const features = jcamp.spectra.map((s) => { const thresRef = calcThresRef(s, peakUp); @@ -722,7 +727,6 @@ const extrFeaturesCylicVolta = (jcamp, layout, peakUp) => { d: D, mn: MN, mp: MP, mw: MW, }; } - // const detector = Format.isSECLayout(layout) && jcamp.info.$DETECTOR ? jcamp.info.$DETECTOR : ''; return Object.assign({}, base, cpo, bnd, { detector, secData }); }).filter((r) => r != null); @@ -777,7 +781,7 @@ const ExtractJcamp = (source) => { source, { xy: true, - keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL|CSAUTOMETADATA|\$DETECTOR|MN|MW|D|MP)/, // eslint-disable-line + keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL|CSAUTOMETADATA|\$DETECTOR|MN|MW|D|MP|MELTINGPOINT|TG|\$CSSCANRATE|\$CSSPECTRUMDIRECTION)/, // eslint-disable-line }, ); const layout = readLayout(jcamp); @@ -800,6 +804,17 @@ const ExtractJcamp = (source) => { features = extrFeaturesCylicVolta(jcamp, layout, peakUp); } else { features = extrFeaturesNi(jcamp, layout, peakUp, spectra); + if (Format.isDSCLayout(layout)) { + const { info } = jcamp; + const { + MELTINGPOINT, TG, + } = info; + const dscMetaData = { + meltingPoint: MELTINGPOINT, + tg: TG, + }; + features = Object.assign({}, features, { dscMetaData }); + } } // const features = Format.isMsLayout(layout) // ? extrFeaturesMs(jcamp, layout, peakUp) diff --git a/src/helpers/compass.js b/src/helpers/compass.js index 1246058d..038faaff 100644 --- a/src/helpers/compass.js +++ b/src/helpers/compass.js @@ -98,7 +98,7 @@ const MouseMove = (event, focus) => { focus.root.select('.cursor-txt-hz') .attr('transform', `translate(${tx},${ty - 30})`) .text(`2Theta: ${pt.x.toExponential(2)}, d-value: ${dValue}`); - } else if (Format.isTGALayout(layout)) { + } else if (Format.isTGALayout(layout) || Format.isDSCLayout(layout)) { focus.root.select('.cursor-txt') .attr('transform', `translate(${tx},${10})`) .text(`X: ${pt.x.toFixed(3)}, Y: ${pt.y.toFixed(3)}`); diff --git a/src/helpers/format.js b/src/helpers/format.js index 5e59e5d5..a36bdf81 100644 --- a/src/helpers/format.js +++ b/src/helpers/format.js @@ -13,6 +13,7 @@ const spectraDigit = (layout) => { case LIST_LAYOUT.UVVIS: case LIST_LAYOUT.HPLC_UVVIS: case LIST_LAYOUT.TGA: + case LIST_LAYOUT.DSC: case LIST_LAYOUT.XRD: case LIST_LAYOUT.CDS: case LIST_LAYOUT.SEC: @@ -66,9 +67,10 @@ const spectraOps = { [LIST_LAYOUT.UVVIS]: { head: 'UV-VIS (absorption, solvent), λmax', tail: ' nm' }, [LIST_LAYOUT.HPLC_UVVIS]: { head: 'HPLC UV/VIS (transmittance)', tail: '' }, [LIST_LAYOUT.TGA]: { head: 'THERMOGRAVIMETRIC ANALYSIS', tail: ' SECONDS' }, + [LIST_LAYOUT.DSC]: { head: 'DIFFERENTIAL SCANNING CALORIMETRY', tail: ' SECONDS' }, [LIST_LAYOUT.MS]: { head: 'MASS', tail: ' m/z' }, [LIST_LAYOUT.XRD]: { head: 'XRD', tail: '.' }, - [LIST_LAYOUT.CYCLIC_VOLTAMMETRY]: { head: 'CYCLIC VOLTAMMETRY', tail: '.' }, + [LIST_LAYOUT.CYCLIC_VOLTAMMETRY]: { head: 'CV', tail: '.' }, [LIST_LAYOUT.CDS]: { head: 'CIRCULAR DICHROISM SPECTROSCOPY', tail: '.' }, [LIST_LAYOUT.SEC]: { head: 'SIZE EXCLUSION CHROMATOGRAPHY', tail: '.' }, [LIST_LAYOUT.EMISSIONS]: { head: 'EMISSION', tail: '.' }, @@ -329,6 +331,7 @@ const peaksBody = ({ } if (layout === LIST_LAYOUT.RAMAN || layout === LIST_LAYOUT.TGA + || layout === LIST_LAYOUT.DSC || layout === LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === LIST_LAYOUT.CDS || layout === LIST_LAYOUT.SEC) { @@ -372,6 +375,7 @@ const isRamanLayout = (layoutSt) => (LIST_LAYOUT.RAMAN === layoutSt); const isUvVisLayout = (layoutSt) => (LIST_LAYOUT.UVVIS === layoutSt); const isHplcUvVisLayout = (layoutSt) => (LIST_LAYOUT.HPLC_UVVIS === layoutSt); const isTGALayout = (layoutSt) => (LIST_LAYOUT.TGA === layoutSt); +const isDSCLayout = (layoutSt) => (LIST_LAYOUT.DSC === layoutSt); const isXRDLayout = (layoutSt) => (LIST_LAYOUT.XRD === layoutSt); const isCyclicVoltaLayout = (layoutSt) => (LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt); const isCDSLayout = (layoutSt) => (LIST_LAYOUT.CDS === layoutSt); @@ -466,6 +470,62 @@ const strNumberFixedLength = (number, maxLength = -1) => { return number.toFixed(lengthToFix); }; +const inlineNotation = (layout, data, sampleName = '') => { + let formattedString = ''; + let quillData = []; + const { scanRate, voltaData } = data; + switch (layout) { + case LIST_LAYOUT.CYCLIC_VOLTAMMETRY: { + if (!voltaData) { + break; + } + let refString = ''; + let nonRefString = ''; + let refOps = []; + const nonRefOps = []; + const { listPeaks, xyData } = voltaData; + const { x } = xyData; + listPeaks.forEach((item) => { + const { + isRef, e12, max, min, + } = item; + const e12Str = e12 ? strNumberFixedLength(e12, 3) : '0'; + const scanRateStr = scanRate ? strNumberFixedLength(scanRate, 3) : '0'; + if (isRef) { + const posNegString = x[0] > x[1] ? 'neg.' : 'pos.'; + refString = `CV ( mM in vs. Ref (Fc+/Fc) = ${e12Str} V, v = ${scanRateStr} V/s, to ${posNegString}):`; + refOps = [ + { insert: 'CV ( mM in vs. Ref ' }, + { insert: '(Fc' }, + { insert: '+', attributes: { script: 'super' } }, + { insert: '/Fc) ' }, + { insert: `= ${e12Str} V, v = ${scanRateStr} V/s, to ${posNegString}):` }, + ]; + } else { + const delta = (max && min) ? strNumberFixedLength(Math.abs(max.x - min.x) * 1000, 3) : '0'; + nonRefString += `\nE1/2 = ([${sampleName}] , ΔEp) = ${e12Str} V (${delta} mV)`; + const currentNoneOps = [ + { insert: '\nE' }, + { insert: '1/2', attributes: { script: 'sub' } }, + { insert: ` = ([${sampleName}] , ΔE` }, + { insert: 'p', attributes: { script: 'sub' } }, + { insert: `) = ${e12Str} V (${delta} mV)` }, + ]; + nonRefOps.push(...currentNoneOps); + } + }); + + formattedString = refString + nonRefString; + quillData = [...refOps, ...nonRefOps]; + break; + } + default: + break; + } + + return { quillData, formattedString }; +}; + const Format = { toPeakStr, buildData, @@ -488,6 +548,7 @@ const Format = { isUvVisLayout, isHplcUvVisLayout, isTGALayout, + isDSCLayout, isXRDLayout, isCyclicVoltaLayout, isCDSLayout, @@ -508,6 +569,7 @@ const Format = { strNumberFixedDecimal, formatedXRD, strNumberFixedLength, + inlineNotation, }; export default Format; diff --git a/src/index.js b/src/index.js index db454bda..ea95a53b 100644 --- a/src/index.js +++ b/src/index.js @@ -30,6 +30,7 @@ import uvVisJcamp from './__tests__/fixtures/uv_vis_jcamp'; import hplcUVVisJcamp from './__tests__/fixtures/hplc_uvvis_jcamp'; import hplcUVVisJcamp2 from './__tests__/fixtures/hplc_uvvis_jcamp_2'; import tgaJcamp from './__tests__/fixtures/tga_jcamp'; +import dscJcamp from './__tests__/fixtures/dsc_jcamp'; import xrdJcamp1 from './__tests__/fixtures/xrd_jcamp_1'; import xrdJcamp2 from './__tests__/fixtures/xrd_jcamp_2'; import cyclicVoltaJcamp1 from './__tests__/fixtures/cyclic_voltammetry_1'; @@ -66,6 +67,7 @@ const compUvVisEntity = FN.ExtractJcamp(compareUvVisJcamp); const hplcUVVisEntity = FN.ExtractJcamp(hplcUVVisJcamp); const hplcUVVisEntity2 = FN.ExtractJcamp(hplcUVVisJcamp2); const tgaEntity = FN.ExtractJcamp(tgaJcamp); +const dscEntity = FN.ExtractJcamp(dscJcamp); const xrdEntity1 = FN.ExtractJcamp(xrdJcamp1); const xrdEntity2 = FN.ExtractJcamp(xrdJcamp2); const cyclicVoltaEntity1 = FN.ExtractJcamp(cyclicVoltaJcamp1); @@ -158,6 +160,8 @@ class DemoWriteIr extends React.Component { return hplcUVVisEntity; case 'tga': return tgaEntity; + case 'dsc': + return dscEntity; case 'xrd': return xrdEntity1; case 'cyclic volta': @@ -221,6 +225,7 @@ class DemoWriteIr extends React.Component { case 'uv/vis': case 'hplc uv/vis': case 'tga': + case 'dsc': case 'xrd': case 'ms': case 'cyclic volta': @@ -255,6 +260,7 @@ class DemoWriteIr extends React.Component { formatPks({ peaks, layout, shift, isAscend, decimal, isIntensity, integration, waveLength, + cyclicvoltaSt, curveSt, }) { const entity = this.loadEntity(); const { features } = entity; @@ -274,7 +280,25 @@ class DemoWriteIr extends React.Component { temperature, }); const wrapper = FN.peaksWrapper(layout, shift); - const desc = this.rmDollarSign(wrapper.head) + body + wrapper.tail; + let desc = this.rmDollarSign(wrapper.head) + body + wrapper.tail; + if (FN.isCyclicVoltaLayout(layout)) { + const { spectraList } = cyclicvoltaSt; + const { curveIdx, listCurves } = curveSt; + const selectedVolta = spectraList[curveIdx]; + const selectedCurve = listCurves[curveIdx]; + const { feature } = selectedCurve; + const { scanRate } = feature; + const data = { + scanRate, + voltaData: { + listPeaks: selectedVolta.list, + xyData: feature.data[0], + }, + }; + const inlineData = FN.inlineNotation(layout, data); + const { formattedString } = inlineData; + desc = formattedString; + } return desc; } @@ -338,9 +362,11 @@ class DemoWriteIr extends React.Component { writePeak({ peaks, layout, shift, isAscend, decimal, isIntensity, integration, waveLength, + cyclicvoltaSt, curveSt, }) { const desc = this.formatPks({ - peaks, layout, shift, isAscend, decimal, isIntensity, integration, waveLength, + peaks, layout, shift, isAscend, decimal, isIntensity, integration, waveLength, // eslint-disable-line + cyclicvoltaSt, curveSt, // eslint-disable-line }); this.setState({ desc }); } @@ -529,6 +555,14 @@ class DemoWriteIr extends React.Component { > TGA +