From 3524e2df577b33380d9da170d0222fa04e35173f Mon Sep 17 00:00:00 2001 From: Lan Le Date: Mon, 17 Apr 2023 17:00:53 +0200 Subject: [PATCH] Update CV layout and add CDS layout --- dist/components/cmd_bar/03_peak.js | 3 + dist/components/cmd_bar/r01_layout.js | 9 + dist/components/d3_line/line_focus.js | 2 +- .../components/panel/cyclic_voltamery_data.js | 8 +- dist/constants/action_type.js | 3 +- dist/constants/list_layout.js | 3 +- dist/constants/list_ui.js | 5 +- dist/helpers/chem.js | 5 +- dist/helpers/format.js | 10 +- dist/index.js | 17 + dist/reducers/reducer_voltammetry.js | 28 + dist/sagas/saga_ui.js | 46 +- package.json | 2 +- src/__tests__/fixtures/cds_jcamp.js | 856 ++++++++++++++++++ src/components/cmd_bar/03_peak.js | 5 +- src/components/cmd_bar/r01_layout.js | 3 + src/components/d3_line/line_focus.js | 2 +- src/components/panel/cyclic_voltamery_data.js | 14 +- src/constants/action_type.js | 1 + src/constants/list_layout.js | 3 +- src/constants/list_ui.js | 2 + src/helpers/cfg.js | 2 +- src/helpers/chem.js | 5 +- src/helpers/format.js | 7 + src/index.js | 12 + src/reducers/reducer_voltammetry.js | 25 + src/sagas/saga_ui.js | 6 + 27 files changed, 1044 insertions(+), 40 deletions(-) create mode 100644 src/__tests__/fixtures/cds_jcamp.js diff --git a/dist/components/cmd_bar/03_peak.js b/dist/components/cmd_bar/03_peak.js index e75bb21e..6904b512 100644 --- a/dist/components/cmd_bar/03_peak.js +++ b/dist/components/cmd_bar/03_peak.js @@ -91,6 +91,9 @@ var Peak = function Peak(_ref) { return setUiSweepTypeAct(_list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK, curveIdx); }; } + onSweepAnchorShift = function onSweepAnchorShift() { + return setUiSweepTypeAct(_list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF, curveIdx); + }; } } diff --git a/dist/components/cmd_bar/r01_layout.js b/dist/components/cmd_bar/r01_layout.js index 32cc84b3..dba3a163 100644 --- a/dist/components/cmd_bar/r01_layout.js +++ b/dist/components/cmd_bar/r01_layout.js @@ -309,6 +309,15 @@ var layoutSelect = function layoutSelect(classes, layoutSt, updateLayoutAct) { { className: (0, _classnames2.default)(classes.txtOpt, 'option-sv-bar-layout') }, 'CV (CYCLIC VOLTAMMETRY)' ) + ), + _react2.default.createElement( + _MenuItem2.default, + { value: _list_layout.LIST_LAYOUT.CDS }, + _react2.default.createElement( + 'span', + { className: (0, _classnames2.default)(classes.txtOpt, 'option-sv-bar-layout') }, + 'CDS (CIRCULAR DICHROISM SPECTROSCOPY)' + ) ) ) ); diff --git a/dist/components/d3_line/line_focus.js b/dist/components/d3_line/line_focus.js index 97fb72d0..89953b32 100644 --- a/dist/components/d3_line/line_focus.js +++ b/dist/components/d3_line/line_focus.js @@ -755,7 +755,7 @@ var LineFocus = function () { }, { key: 'reverseXAxis', value: function 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].indexOf(layoutSt) < 0; + 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].indexOf(layoutSt) < 0; } }, { key: 'create', diff --git a/dist/components/panel/cyclic_voltamery_data.js b/dist/components/panel/cyclic_voltamery_data.js index e62cb068..356447f0 100644 --- a/dist/components/panel/cyclic_voltamery_data.js +++ b/dist/components/panel/cyclic_voltamery_data.js @@ -169,21 +169,21 @@ var CyclicVoltammetryPanel = function CyclicVoltammetryPanel(_ref) { }; var getDelta = function getDelta(data) { - return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x).toExponential(2) : "undefined"; + return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x) : "undefined"; }; var getRatio = function getRatio(feature, data) { var featureData = feature.data[0]; var idx = featureData.x.indexOf(feature.maxX); var y_pecker = data.pecker ? data.pecker.y : featureData.y[idx]; - return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toExponential(2) : "undefined"; + return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(8) : "undefined"; }; var rows = list.map(function (o, idx) { return { idx: idx, - max: o.max ? 'x:' + parseFloat(o.max.x).toExponential(2) + ', y:' + parseFloat(o.max.y).toExponential(2) : "undefined", - min: o.min ? 'x:' + parseFloat(o.min.x).toExponential(2) + ', y:' + parseFloat(o.min.y).toExponential(2) : "undefined", + max: o.max ? 'x:' + parseFloat(o.max.x) + ', y:' + parseFloat(o.max.y).toExponential(2) : "undefined", + min: o.min ? 'x:' + parseFloat(o.min.x) + ', y:' + parseFloat(o.min.y).toExponential(2) : "undefined", pecker: o.pecker ? '' + parseFloat(o.pecker.y).toExponential(2) : "undefined", delta: getDelta(o), ratio: getRatio(feature, o), diff --git a/dist/constants/action_type.js b/dist/constants/action_type.js index c0978672..ad21552f 100644 --- a/dist/constants/action_type.js +++ b/dist/constants/action_type.js @@ -140,7 +140,8 @@ var CYCLIC_VOLTA_METRY = { WORK_WITH_MAX_PEAK: 'WORK_WITH_MAX_PEAK', ADD_PECKER: 'ADD_PECKER', REMOVE_PECKER: 'REMOVE_PECKER', - RESETALL: 'RESETALL_VOLTA_METRY' + RESETALL: 'RESETALL_VOLTA_METRY', + SET_REF: 'VOLTA_METRY_SET_REF' }; var CURVE = { diff --git a/dist/constants/list_layout.js b/dist/constants/list_layout.js index 8fc4db04..9b44efae 100644 --- a/dist/constants/list_layout.js +++ b/dist/constants/list_layout.js @@ -18,7 +18,8 @@ var LIST_LAYOUT = { TGA: 'THERMOGRAVIMETRIC ANALYSIS', XRD: 'X-RAY DIFFRACTION', HPLC_UVVIS: 'HPLC UV/VIS', - CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY' + CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY', + CDS: 'CIRCULAR DICHROISM SPECTROSCOPY' }; exports.LIST_LAYOUT = LIST_LAYOUT; \ No newline at end of file diff --git a/dist/constants/list_ui.js b/dist/constants/list_ui.js index 937bdade..e476bcb5 100644 --- a/dist/constants/list_ui.js +++ b/dist/constants/list_ui.js @@ -29,10 +29,11 @@ var LIST_UI_SWEEP_TYPE = { CYCLIC_VOLTA_ADD_MIN_PEAK: 'cyclic voltammetry add min peak', CYCLIC_VOLTA_RM_MIN_PEAK: 'cyclic voltammetry remove min peak', CYCLIC_VOLTA_ADD_PECKER: 'cyclic voltammetry add pecker', - CYCLIC_VOLTA_RM_PECKER: 'cyclic voltammetry remove pecker' + CYCLIC_VOLTA_RM_PECKER: 'cyclic voltammetry remove pecker', + CYCLIC_VOLTA_SET_REF: 'cyclic voltammetry set ref' }; -var LIST_NON_BRUSH_TYPES = [LIST_UI_SWEEP_TYPE.PEAK_ADD, LIST_UI_SWEEP_TYPE.PEAK_DELETE, LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT, LIST_UI_SWEEP_TYPE.INTEGRATION_RM, LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF, LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_ADD, LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_RM, LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_CLICK, LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_RM, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MAX_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MAX_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MIN_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_PECKER, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER]; +var LIST_NON_BRUSH_TYPES = [LIST_UI_SWEEP_TYPE.PEAK_ADD, LIST_UI_SWEEP_TYPE.PEAK_DELETE, LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT, LIST_UI_SWEEP_TYPE.INTEGRATION_RM, LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF, LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_ADD, LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_RM, LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_CLICK, LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_RM, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MAX_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MAX_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MIN_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_PECKER, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF]; exports.LIST_UI_VIEWER_TYPE = LIST_UI_VIEWER_TYPE; exports.LIST_UI_SWEEP_TYPE = LIST_UI_SWEEP_TYPE; diff --git a/dist/helpers/chem.js b/dist/helpers/chem.js index 092fb460..951ecc74 100644 --- a/dist/helpers/chem.js +++ b/dist/helpers/chem.js @@ -324,6 +324,9 @@ var readLayout = function readLayout(jcamp) { if (dataType.includes('CYCLIC VOLTAMMETRY')) { return _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY; } + if (dataType.includes('CIRCULAR DICHROISM SPECTROSCOPY')) { + return _list_layout.LIST_LAYOUT.CDS; + } } return false; }; @@ -747,7 +750,7 @@ var ExtractJcamp = function ExtractJcamp(source) { var features = {}; if (_format2.default.isMsLayout(layout)) { features = extrFeaturesMs(jcamp, layout, peakUp); - } else if (_format2.default.isXRDLayout(layout)) { + } else if (_format2.default.isXRDLayout(layout) || _format2.default.isCDSLayout(layout)) { features = extrFeaturesXrd(jcamp, layout, peakUp); } else if (_format2.default.isCyclicVoltaLayout(layout)) { features = extrFeaturesCylicVolta(jcamp, layout, peakUp); diff --git a/dist/helpers/format.js b/dist/helpers/format.js index 68be640a..ee7442e6 100644 --- a/dist/helpers/format.js +++ b/dist/helpers/format.js @@ -25,6 +25,7 @@ var spectraDigit = function spectraDigit(layout) { case _list_layout.LIST_LAYOUT.TGA: case _list_layout.LIST_LAYOUT.XRD: case _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY: + case _list_layout.LIST_LAYOUT.CDS: case _list_layout.LIST_LAYOUT.MS: return 0; case _list_layout.LIST_LAYOUT.C13: @@ -63,7 +64,7 @@ var toPeakStr = function toPeakStr(peaks) { return str; }; -var spectraOps = (_spectraOps = {}, _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.PLAIN, { head: '', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.H1, { head: '1H', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.C13, { head: '13C', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.F19, { head: '19F', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.P31, { head: '31P', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.N15, { head: '15N', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.Si29, { head: '29Si', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.IR, { head: 'IR', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.RAMAN, { head: 'RAMAN', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.UVVIS, { head: 'UV-VIS (absorption, solvent), λmax', tail: ' nm' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.HPLC_UVVIS, { head: 'HPLC UV/VIS (transmittance)', tail: '' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.TGA, { head: 'THERMOGRAVIMETRIC ANALYSIS', tail: ' SECONDS' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.MS, { head: 'MASS', tail: ' m/z' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.XRD, { head: 'X-RAY DIFFRACTION', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, { head: 'CYCLIC VOLTAMMETRY', tail: '.' }), _spectraOps); +var spectraOps = (_spectraOps = {}, _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.PLAIN, { head: '', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.H1, { head: '1H', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.C13, { head: '13C', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.F19, { head: '19F', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.P31, { head: '31P', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.N15, { head: '15N', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.Si29, { head: '29Si', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.IR, { head: 'IR', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.RAMAN, { head: 'RAMAN', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.UVVIS, { head: 'UV-VIS (absorption, solvent), λmax', tail: ' nm' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.HPLC_UVVIS, { head: 'HPLC UV/VIS (transmittance)', tail: '' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.TGA, { head: 'THERMOGRAVIMETRIC ANALYSIS', tail: ' SECONDS' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.MS, { head: 'MASS', tail: ' m/z' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.XRD, { head: 'X-RAY DIFFRACTION', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, { head: 'CYCLIC VOLTAMMETRY', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.CDS, { head: 'CIRCULAR DICHROISM SPECTROSCOPY', tail: '.' }), _spectraOps); var rmRef = function rmRef(peaks, shift) { var refValue = shift.ref.value || shift.peak.x; @@ -295,6 +296,9 @@ var peaksBody = function peaksBody(_ref) { if (layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY) { return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false); } + if (layout === _list_layout.LIST_LAYOUT.CDS) { + return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false); + } return ordered.map(function (o) { return fixDigit(o.x, decimal); }).join(', '); @@ -359,6 +363,9 @@ var isXRDLayout = function isXRDLayout(layoutSt) { var isCyclicVoltaLayout = function isCyclicVoltaLayout(layoutSt) { return _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt; }; +var isCDSLayout = function isCDSLayout(layoutSt) { + return _list_layout.LIST_LAYOUT.CDS === layoutSt; +}; var isEmWaveLayout = function isEmWaveLayout(layoutSt) { return [_list_layout.LIST_LAYOUT.IR, _list_layout.LIST_LAYOUT.RAMAN, _list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS].indexOf(layoutSt) >= 0; }; @@ -449,6 +456,7 @@ var Format = { isTGALayout: isTGALayout, isXRDLayout: isXRDLayout, isCyclicVoltaLayout: isCyclicVoltaLayout, + isCDSLayout: isCDSLayout, isEmWaveLayout: isEmWaveLayout, fixDigit: fixDigit, formatPeaksByPrediction: formatPeaksByPrediction, diff --git a/dist/index.js b/dist/index.js index ee9abe6d..6301708f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -126,6 +126,10 @@ var _cyclic_voltammetry_5 = require('./__tests__/fixtures/cyclic_voltammetry_3') var _cyclic_voltammetry_6 = _interopRequireDefault(_cyclic_voltammetry_5); +var _cds_jcamp = require('./__tests__/fixtures/cds_jcamp'); + +var _cds_jcamp2 = _interopRequireDefault(_cds_jcamp); + var _qDescValue = require('./__tests__/fixtures/qDescValue'); require('./__tests__/style/svg.css'); @@ -161,6 +165,7 @@ var xrdEntity2 = _app.FN.ExtractJcamp(_xrd_jcamp_4.default); var cyclicVoltaEntity1 = _app.FN.ExtractJcamp(_cyclic_voltammetry_2.default); var cyclicVoltaEntity2 = _app.FN.ExtractJcamp(_cyclic_voltammetry_4.default); var cyclicVoltaEntity3 = _app.FN.ExtractJcamp(_cyclic_voltammetry_6.default); +var cdsEntity = _app.FN.ExtractJcamp(_cds_jcamp2.default); var DemoWriteIr = function (_React$Component) { _inherits(DemoWriteIr, _React$Component); @@ -456,6 +461,8 @@ var DemoWriteIr = function (_React$Component) { return xrdEntity1; case 'cyclic volta': return cyclicVoltaEntity2; + case 'cds': + return cdsEntity; case 'ms': default: return msEntity; @@ -498,6 +505,7 @@ var DemoWriteIr = function (_React$Component) { case 'xrd': case 'ms': case 'cyclic volta': + case 'cds': default: return false; } @@ -697,6 +705,15 @@ var DemoWriteIr = function (_React$Component) { }, 'CV' ), + _react2.default.createElement( + _Button2.default, + { + variant: 'contained', + style: { margin: '0 10px 0 10px' }, + onClick: this.onClick('cds') + }, + 'CDS' + ), _react2.default.createElement( _Button2.default, { diff --git a/dist/reducers/reducer_voltammetry.js b/dist/reducers/reducer_voltammetry.js index 18cbe367..d230bbf9 100644 --- a/dist/reducers/reducer_voltammetry.js +++ b/dist/reducers/reducer_voltammetry.js @@ -213,6 +213,32 @@ var removePecker = function removePecker(state, action) { } }; +var setRef = function setRef(state, action) { + var payload = action.payload; + var spectraList = state.spectraList; + + if (payload) { + var index = payload.index, + jcampIdx = payload.jcampIdx; + + var spectra = spectraList[jcampIdx]; + var list = spectra.list; + + var newList = list; + var pairPeak = newList[index]; + // pairPeak.pecker = null; + // newList[index] = pairPeak; + + // spectraList[jcampIdx] = Object.assign({}, spectra, { list: newList, selectedIdx: index, jcampIdx: jcampIdx }); + // return Object.assign({}, state, { spectraList: spectraList }); + + //TODO: implement ref + console.log(pairPeak); + } else { + return state; + } +}; + var cyclicVoltaReducer = function cyclicVoltaReducer() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; var action = arguments[1]; @@ -238,6 +264,8 @@ var cyclicVoltaReducer = function cyclicVoltaReducer() { return addPecker(state, action); case _action_type.CYCLIC_VOLTA_METRY.REMOVE_PECKER: return removePecker(state, action); + case _action_type.CYCLIC_VOLTA_METRY.SET_REF: + return setRef(state, action); case _action_type.CYCLIC_VOLTA_METRY.RESETALL: return Object.assign({}, state, { spectraList: [] }); default: diff --git a/dist/sagas/saga_ui.js b/dist/sagas/saga_ui.js index cd7b25ab..c55aec63 100644 --- a/dist/sagas/saga_ui.js +++ b/dist/sagas/saga_ui.js @@ -229,7 +229,7 @@ function clickUiTarget(action) { }); case 7: - _context3.next = 84; + _context3.next = 89; break; case 9: @@ -245,7 +245,7 @@ function clickUiTarget(action) { }); case 12: - _context3.next = 84; + _context3.next = 89; break; case 14: @@ -261,7 +261,7 @@ function clickUiTarget(action) { }); case 17: - _context3.next = 84; + _context3.next = 89; break; case 19: @@ -277,7 +277,7 @@ function clickUiTarget(action) { }); case 22: - _context3.next = 84; + _context3.next = 89; break; case 24: @@ -293,7 +293,7 @@ function clickUiTarget(action) { }); case 27: - _context3.next = 84; + _context3.next = 89; break; case 29: @@ -309,7 +309,7 @@ function clickUiTarget(action) { }); case 32: - _context3.next = 84; + _context3.next = 89; break; case 34: @@ -348,7 +348,7 @@ function clickUiTarget(action) { }); case 44: - _context3.next = 84; + _context3.next = 89; break; case 46: @@ -364,7 +364,7 @@ function clickUiTarget(action) { }); case 49: - _context3.next = 84; + _context3.next = 89; break; case 51: @@ -380,7 +380,7 @@ function clickUiTarget(action) { }); case 54: - _context3.next = 84; + _context3.next = 89; break; case 56: @@ -396,7 +396,7 @@ function clickUiTarget(action) { }); case 59: - _context3.next = 84; + _context3.next = 89; break; case 61: @@ -412,7 +412,7 @@ function clickUiTarget(action) { }); case 64: - _context3.next = 84; + _context3.next = 89; break; case 66: @@ -428,7 +428,7 @@ function clickUiTarget(action) { }); case 69: - _context3.next = 84; + _context3.next = 89; break; case 71: @@ -444,7 +444,7 @@ function clickUiTarget(action) { }); case 74: - _context3.next = 84; + _context3.next = 89; break; case 76: @@ -460,12 +460,12 @@ function clickUiTarget(action) { }); case 79: - _context3.next = 84; + _context3.next = 89; break; case 81: if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER && onPecker)) { - _context3.next = 84; + _context3.next = 86; break; } @@ -476,6 +476,22 @@ function clickUiTarget(action) { }); case 84: + _context3.next = 89; + break; + + case 86: + if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF && onPeak)) { + _context3.next = 89; + break; + } + + _context3.next = 89; + return (0, _effects.put)({ + type: _action_type.CYCLIC_VOLTA_METRY.SET_REF, + payload: { index: voltammetryPeakIdx, jcampIdx: jcampIdx } + }); + + case 89: case 'end': return _context3.stop(); } diff --git a/package.json b/package.json index a14d13d9..b29911a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@complat/react-spectra-editor", - "version": "0.11.4", + "version": "0.11.5", "description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS).", "repository": { "type": "git", diff --git a/src/__tests__/fixtures/cds_jcamp.js b/src/__tests__/fixtures/cds_jcamp.js new file mode 100644 index 00000000..506a3548 --- /dev/null +++ b/src/__tests__/fixtures/cds_jcamp.js @@ -0,0 +1,856 @@ +const cdsJcamp = ` +##TITLE=Spectrum +##JCAMP-DX=5.00 $$ chemotion-converter-app (0.1.0) +##DATA TYPE=CIRCULAR DICHROISM SPECTROSCOPY +##DATA CLASS=XYDATA +##ORIGIN= +##OWNER= +##XUNITS=wavelength (nm) +##YUNITS=ellipticity (deg cm2/dmol) +##FIRSTX=185 +##LASTX=600 +##MINX=185.0 +##MAXX=600.0 +##MINY=-37453.2759527232 +##MAXY=2904.7444922970635 +##NPOINTS=831 +##FIRSTY=-30022.961194330066 +##XUNITS=wavelength (nm) +##YUNITS=ellipticity (deg cm2/dmol) +##XYDATA=(XY..XY) +185, -30022.961194330066 +185.5, -37453.2759527232 +186, -27576.599570868537 +186.5, -14588.226913421553 +187, -4639.456207205171 +187.5, -10773.946935988517 +188, -10398.711971306702 +188.5, -8798.857715332168 +189, -5387.1438142581965 +189.5, -5427.875498696795 +190, -8092.488540960151 +190.5, -7725.865526287409 +191, -7992.306010414839 +191.5, -7337.741027635948 +192, -8479.174560049656 +192.5, -8538.17114945259 +193, -8096.690415470081 +193.5, -7968.552170279847 +194, -7819.669535617197 +194.5, -7535.4941126798585 +195, -8225.775028793134 +195.5, -7630.4716184944045 +196, -6503.366099612297 +196.5, -5253.327360270754 +197, -4540.2011174300815 +197.5, -4627.5130413683755 +198, -4703.033218371201 +198.5, -5487.439908979445 +199, -5792.738268642368 +199.5, -6131.689479110081 +200, -6448.628166807279 +200.5, -7697.928739005182 +201, -7606.2067395676795 +201.5, -8030.160735729493 +202, -7879.347510075817 +202.5, -7424.617622233155 +203, -7781.663391401248 +203.5, -7491.336575600292 +204, -6860.941834934817 +204.5, -6505.410254779294 +205, -6019.563782727973 +205.5, -5922.7313953730145 +206, -6240.029702960684 +206.5, -6207.247510838197 +207, -5855.501403214112 +207.5, -5432.739830899717 +208, -5505.326266690614 +208.5, -5742.675394413721 +209, -5872.365683341814 +209.5, -5513.162194830755 +210, -5402.8724526264305 +210.5, -5147.447693565606 +211, -5366.266933247149 +211.5, -5475.364251604052 +212, -5203.9269437351 +212.5, -5305.756154831613 +213, -5556.524782678729 +213.5, -5817.684532624748 +214, -6287.310254878728 +214.5, -6452.0350920855835 +215, -6374.697888267702 +215.5, -6419.271827325724 +216, -6258.994920343367 +216.5, -6097.203824348375 +217, -6045.834962096372 +217.5, -5623.281590771189 +218, -5622.69484252881 +218.5, -5479.39577985006 +219, -5303.219888235513 +219.5, -5260.065501376784 +220, -5438.455894422249 +220.5, -5222.759669579153 +221, -5393.99551954013 +221.5, -5240.778518828951 +222, -4827.045298502086 +222.5, -4750.919445894253 +223, -4848.963184459293 +223.5, -4623.708641474275 +224, -4374.567766815665 +224.5, -4133.5845854623785 +225, -4337.659409633862 +225.5, -4443.141601723216 +226, -3955.9134321978927 +226.5, -3399.4300427093644 +227, -3226.2068196693717 +227.5, -3183.4309800637775 +228, -2815.199139565173 +228.5, -2084.6597230797183 +229, -2033.1962240144062 +229.5, -1826.5718840929928 +230, -1677.276632924404 +230.5, -1886.4713086946854 +231, -1333.4118791108679 +231.5, -1674.2387912179022 +232, -1454.4201867880554 +232.5, -1181.87941367618 +233, -1161.1198823136076 +233.5, -1075.86536269614 +234, -648.6028635418186 +234.5, -545.8727099828257 +235, -230.60341567199998 +235.5, -110.33876407361825 +236, 46.97298227486007 +236.5, 137.4688671594 +237, 328.06040599465734 +237.5, 541.2979664285442 +238, 747.237135821761 +238.5, 794.6104318168245 +239, 857.4549540479999 +239.5, 914.7045478776653 +240, 1145.0278385823356 +240.5, 1230.06658626551 +241, 1102.3144592735111 +241.5, 1282.3837093866712 +242, 1378.4438603452168 +242.5, 1471.0933005529082 +243, 1501.047744694418 +243.5, 1436.1836728677065 +244, 1475.4257738651731 +244.5, 1447.1161175385878 +245, 1253.2412491031612 +245.5, 1148.4896532123628 +246, 973.9036600610353 +246.5, 911.5777475666702 +247, 892.777198239133 +247.5, 882.9027931407974 +248, 1052.9500047268941 +248.5, 1172.2870262814404 +249, 1221.721512069889 +249.5, 1456.7652870213024 +250, 1544.6204262678868 +250.5, 1567.8878331825604 +251, 1456.9394187577468 +251.5, 1526.3536285672863 +252, 1470.1677525189646 +252.5, 1483.9941909401552 +253, 1295.358416488279 +253.5, 1252.228635200994 +254, 1286.273282412756 +254.5, 1371.620546107246 +255, 1427.7742456390492 +255.5, 1492.8881586528385 +256, 1642.372683448001 +256.5, 1776.401123897174 +257, 1846.2241647401129 +257.5, 2030.6221026930061 +258, 2092.590288033148 +258.5, 1863.3136804834264 +259, 1879.2107723793297 +259.5, 1873.719944472432 +260, 1750.5823084962942 +260.5, 1774.9285750824347 +261, 1852.8638835603085 +261.5, 1887.2549015086995 +262, 2261.5169997499293 +262.5, 2280.084742516784 +263, 2331.340040592868 +263.5, 2336.9425399394395 +264, 2384.3177286707687 +264.5, 2581.5029928349654 +265, 2680.3416806316077 +265.5, 2487.4907825159457 +266, 2429.1566508060155 +266.5, 2713.0860180288114 +267, 2739.2057784959425 +267.5, 2866.075890388113 +268, 2760.612625661398 +268.5, 2510.7146564965037 +269, 2615.023352101119 +269.5, 2855.4387125746844 +270, 2374.68370107818 +270.5, 2339.3463149969243 +271, 2119.1643052040563 +271.5, 1927.9411602769233 +272, 2429.4027065205605 +272.5, 2620.739415623637 +273, 2764.984846435246 +273.5, 2843.514474100557 +274, 2718.764226826013 +274.5, 2904.7444922970635 +275, 2503.4276218734253 +275.5, 1931.1777392913295 +276, 1798.8489760087832 +276.5, 1397.9750058713284 +277, 1448.656804858896 +277.5, 1466.1456879542814 +278, 1570.3389266466866 +278.5, 1852.6821808787963 +279, 2074.5146566953836 +279.5, 1740.4050655954416 +280, 1711.7395748508961 +280.5, 1493.673644203119 +281, 1416.1679868575654 +281.5, 1620.0932848640412 +282, 1450.971621311888 +282.5, 1060.799182020895 +283, 1187.1241858685323 +283.5, 934.2811190741553 +284, 955.328346349119 +284.5, 715.5432670520412 +285, 441.6340456200424 +285.5, 191.54491009230753 +286, 141.36525403604062 +286.5, 103.48384114000825 +287, 215.34796137018174 +287.5, 172.12032561795664 +288, 43.29104241712743 +288.5, -6.684349541341814 +289, 86.6610119365358 +289.5, 92.62104916370623 +290, 81.41491482880011 +290.5, 54.42449567942933 +291, -172.05124074425746 +291.5, -245.42543336896512 +292, -304.29142396956655 +292.5, -486.33858348042037 +293, -617.4294972451754 +293.5, -814.6052977280413 +294, -1016.9369117987691 +294.5, -1034.7343109054698 +295, -1049.7153184487538 +295.5, -1083.801605858365 +296, -1195.2780937013133 +296.5, -1214.5972527656643 +297, -1276.6260056663075 +297.5, -1339.3001816335677 +298, -1336.9001920486148 +298.5, -1464.5728241174547 +299, -1548.5421758104899 +299.5, -1616.3664871568103 +300, -1731.149585256 +300.5, -1857.7793196424202 +301, -1921.0894549949635 +301.5, -2103.18961112126 +302, -2271.8324123981824 +302.5, -2402.828689349649 +303, -2470.7400665641962 +303.5, -2511.623169904055 +304, -2625.0169995841966 +304.5, -2742.0448828945464 +305, -2676.726554364054 +305.5, -2737.483388494125 +306, -2768.4864085268528 +306.5, -2712.4992697864323 +307, -2715.224810009089 +307.5, -2620.4555051837747 +308, -2743.861909709649 +308.5, -2823.2432686945463 +309, -2803.76701252014 +309.5, -2834.5429042009773 +310, -2987.1920840324483 +310.5, -3038.352745295244 +311, -3192.0240027102095 +311.5, -3268.982659274963 +312, -3301.689141946844 +312.5, -3260.162508276644 +313, -3398.2754735872677 +313.5, -3405.354307221108 +314, -3492.6283764341115 +314.5, -3481.6505060928625 +315, -3453.013406392319 +315.5, -3497.852328527539 +316, -3685.06287257132 +316.5, -3704.160581492602 +317, -3736.0342602075607 +317.5, -3721.138425796208 +318, -3658.791693202922 +318.5, -3734.1604513044863 +319, -3672.3058301402716 +319.5, -3644.501534396643 +320, -3678.2679493773385 +320.5, -3728.8607897604124 +321, -3696.059670275231 +321.5, -3831.8067152536983 +322, -3815.4913286430847 +322.5, -3846.645767577067 +323, -3808.469277097197 +323.5, -3839.245168778044 +324, -3888.6077305883755 +324.5, -4033.3074181037914 +325, -3872.5762544176205 +325.5, -3866.311297378033 +326, -3760.7723232006947 +326.5, -3670.1291834346766 +327, -3575.946626851754 +327.5, -3453.2594621068547 +328, -3358.0926826657246 +328.5, -3364.0548019027915 +329, -3324.6291054875496 +329.5, -3337.802549897056 +330, -3368.9759161936986 +330.5, -3320.313666801684 +331, -3298.6796912843342 +331.5, -3274.9637058746853 +332, -3294.0614147959445 +332.5, -3266.843867294685 +333, -3229.803018574267 +333.5, -3084.005544024756 +334, -3013.936447467272 +334.5, -2982.535952818742 +335, -2821.00983990098 +335.5, -2756.732516316644 +336, -2630.8276999199998 +336.5, -2554.9857577520293 +337, -2558.657666107551 +337.5, -2554.9479030267125 +338, -2509.3897411104886 +338.5, -2478.1974474511876 +339, -2394.8224149455923 +339.5, -2287.7313970303485 +340, -2332.570319165595 +340.5, -2172.0095017433555 +341, -2096.016140674125 +341.5, -2021.91551587063 +342, -1934.6793013829365 +342.5, -1879.625281621524 +343, -1893.0391035367832 +343.5, -1908.9948702569243 +344, -1912.250376633986 +344.5, -1856.6853180808243 +345, -1831.1806969000552 +345.5, -1849.3452868423062 +346, -1801.0199445055796 +346.5, -1804.784596938127 +347, -1711.088473575484 +347.5, -1706.2866016693156 +348, -1630.2307803033143 +348.5, -1544.275948267524 +349, -1510.4924986604335 +349.5, -1480.5361617826572 +350, -1414.1862919873427 +350.5, -1273.0033084536926 +351, -1221.1612621352297 +351.5, -1175.0163519766302 +352, -1181.8055969618197 +352.5, -1155.1180156149646 +353, -1138.0531054431049 +353.5, -1118.8929362250753 +354, -1138.5300749820694 +354.5, -1134.7162114066148 +355, -1123.1061671526018 +355.5, -1108.0513428949505 +356, -1047.7260526334699 +356.5, -978.158531186404 +357, -1005.7811242485301 +357.5, -1007.3331679864324 +358, -910.2925796422379 +358.5, -876.1816866611733 +359, -805.0602287399423 +359.5, -752.0863261345736 +360, -719.7091795729233 +360.5, -630.6180835448104 +361, -584.9898903867551 +361.5, -597.1128661687833 +362, -503.6457638942932 +362.5, -438.2460477043791 +363, -372.80469131661596 +363.5, -379.6866803788245 +364, -327.96387644510503 +364.5, -320.2301560633146 +365, -310.61884130591613 +365.5, -324.7689376285454 +366, -310.1797264922658 +366.5, -293.0731761225596 +367, -200.69628993713286 +367.5, -118.89658182550917 +368, -65.91264771793003 +368.5, -12.408343628812709 +369, 35.6279210980491 +369.5, 59.492675578186095 +370, 146.63311761083227 +370.5, 154.60078019506724 +371, 211.0722701458881 +371.5, 174.8850454813146 +372, 225.1409788090908 +372.5, 330.70455855788697 +373, 382.67909641495163 +373.5, 338.74490221472786 +374, 364.04132240626507 +374.5, 358.40664654317544 +375, 462.2894764879989 +375.5, 518.6854462618186 +376, 539.8821997017761 +376.5, 570.9836420203216 +377, 621.618122601245 +377.5, 617.0944829261401 +378, 676.1232488455948 +378.5, 657.737208760252 +379, 619.2446313240151 +379.5, 567.7281356432601 +380, 642.517716447484 +380.5, 633.2489869541824 +381, 712.7344464336926 +381.5, 627.75248083849 +382, 625.6117961219458 +382.5, 660.7144829062531 +383, 712.2328713232744 +383.5, 723.3773024559164 +384, 781.277997560994 +384.5, 756.5550764579729 +385, 793.9725796952721 +385.5, 888.6396767622368 +386, 958.2734439786017 +386.5, 967.9528972415654 +387, 1053.4875418263628 +387.5, 1043.5582473763216 +388, 1071.5158547574829 +388.5, 1135.9389190342802 +389, 1123.8651543951623 +389.5, 1105.8538760904344 +390, 1081.9202260102227 +390.5, 1001.8669456509917 +391, 1002.6429675199445 +391.5, 1015.4340792037772 +392, 946.067187800882 +392.5, 918.0679402218751 +393, 862.2738605805605 +393.5, 814.7907858820826 +394, 865.9628035624747 +394.5, 851.4606582944181 +395, 861.9009915362085 +395.5, 938.8596481009657 +396, 923.2540375899858 +396.5, 983.6171825767832 +397, 1011.5728972216784 +397.5, 947.8387889456067 +398, 1005.2681927205181 +398.5, 965.8387108327407 +399, 908.8976330143911 +399.5, 937.7202208689918 +400, 881.602483326239 +400.5, 926.7234231650776 +401, 941.554904543371 +401.5, 897.8875861566137 +402, 890.433990742152 +402.5, 870.7949592488951 +403, 865.6486093423639 +403.5, 826.6790623671591 +404, 765.3695492474969 +404.5, 751.3689790898587 +405, 726.9791795696067 +405.5, 662.7340325017892 +406, 650.3290390161683 +406.5, 611.2232150298327 +407, 527.7137982493698 +407.5, 489.4407782199587 +408, 439.61449602450296 +408.5, 383.04628725050185 +409, 428.5533452875524 +409.5, 443.477570742868 +410, 453.8024470724487 +410.5, 459.1513197594133 +411, 460.26803415619656 +411.5, 420.03413935548394 +412, 392.8222700630201 +412.5, 363.7876957466583 +413, 329.3342175014963 +413.5, 357.8445038722531 +414, 407.6083257709386 +414.5, 451.53305628983156 +415, 483.33291829043344 +415.5, 437.6820122971873 +416, 447.2346522303509 +416.5, 420.97104380702115 +417, 366.92774521151 +417.5, 306.11602172973414 +418, 268.36918238219573 +418.5, 255.04053359889494 +419, 280.384272197077 +419.5, 266.465089698867 +420, 289.99937242700685 +420.5, 294.2277452446572 +421, 313.191069891049 +421.5, 334.46164004536985 +422, 345.5133271009929 +422.5, 333.1348319230918 +423, 350.4987944249364 +423.5, 313.01504541833555 +424, 304.6037254534125 +424.5, 288.89779992034954 +425, 298.24791707307696 +425.5, 331.23831018482673 +426, 341.290632492139 +426.5, 319.21375668861526 +427, 309.1917181615524 +427.5, 281.86817742941247 +428, 260.9345143303918 +428.5, 207.1221295593006 +429, 112.2390712844153 +429.5, 117.258040040263 +430, 105.7867333545272 +430.5, 153.71365470731732 +431, 130.02946726693156 +431.5, 180.18735685614286 +432, 168.60116107907692 +432.5, 206.41992440471338 +433, 211.71958594876935 +433.5, 219.18453778082508 +434, 162.16434358656772 +434.5, 202.90700589551037 +435, 187.92448416321108 +435.5, 266.5862248198742 +436, 282.719908748993 +436.5, 316.10588374027986 +437, 303.5305439907411 +437.5, 277.5186694907552 +438, 312.9469069127691 +438.5, 274.96915374081107 +439, 213.43251226925864 +439.5, 185.9219691940642 +440, 162.0445333809469 +440.5, 177.88181481085158 +441, 137.42741623518054 +441.5, 50.10792135179576 +442, 0.547861975798113 +442.5, -1.249434956472768 +443, -0.5549124183879706 +443.5, 36.30059956689104 +444, 49.796944783335796 +444.5, 66.0712590169987 +445, 107.87309654024605 +445.5, 116.22990570071612 +446, 131.6842865840628 +446.5, 140.16809834796382 +447, 114.3502293152153 +447.5, 167.10571015552014 +448, 112.7171764651397 +448.5, 217.15552450395816 +449, 253.66072886117476 +449.5, 258.3755348991187 +450, 236.42547242539868 +450.5, 206.44831544869925 +451, 116.05160994448397 +451.5, 122.0139184551735 +452, 85.97054174679587 +452.5, 85.13868415800542 +453, 44.12081799602509 +453.5, 24.90840925706292 +454, 11.557274766925312 +454.5, 54.80531421609527 +455, 75.92086927025322 +455.5, 48.995938795676906 +456, 90.63140480116631 +456.5, 76.7839570074278 +457, 71.00145844198305 +457.5, 148.647556818453 +458, 104.24547821333981 +458.5, -4.780578623178327 +459, 46.35954645113558 +459.5, 69.22588255109788 +460, 87.0204425533987 +460.5, 96.19112830813428 +461, 46.03456363430896 +461.5, 68.98474795084323 +462, 240.43807330875512 +462.5, 163.06680023806993 +463, 83.78197080272722 +463.5, 45.15803746964758 +464, 6.597605438283204 +464.5, 10.323362140567832 +465, 38.382798732825314 +465.5, -39.76979586835524 +466, 55.8614610523748 +466.5, 107.88085675893568 +467, 99.57761203478587 +467.5, 102.90144619104193 +468, 159.87848599844062 +468.5, 49.83782788667539 +469, 57.539561025574905 +469.5, -56.992370971151004 +470, -76.5943048336013 +470.5, -35.4594675703987 +471, -1.2515510356178587 +471.5, -58.18063079877914 +472, 46.90957560995806 +472.5, 89.38333450754122 +473, 152.5475398939987 +473.5, 156.67654405769787 +474, 68.11257507959304 +474.5, 84.94127176548963 +475, 92.98218324320835 +475.5, -27.339439716772016 +476, -43.688706306557954 +476.5, -93.64350529445595 +477, -86.74202104870918 +477.5, -121.72830455267419 +478, -116.20321811936913 +478.5, -127.39383201689634 +479, -124.27649538723205 +479.5, -105.54484165976642 +480, -57.78296690934829 +480.5, 33.3244610626503 +481, 124.81800723285878 +481.5, 95.58602052397892 +482, 163.0900808941385 +482.5, 145.45772838981108 +483, 85.8628450532755 +483.5, 26.065438936306297 +484, -45.24623897963074 +484.5, -65.92457195640424 +485, -28.326690952979035 +485.5, -50.23473468160011 +486, 35.712526409127214 +486.5, 21.989242114420975 +487, 38.64797108365464 +487.5, 128.38032615859717 +488, 22.877692517556653 +488.5, -84.18815200535383 +489, -33.74956962793427 +489.5, -66.59725042524616 +490, 7.749032618179989 +490.5, -17.604207516055794 +491, -39.4792608515649 +491.5, 40.250550879851595 +492, 102.03211242419033 +492.5, 60.15551181844627 +493, -58.04378596676642 +493.5, -111.86336313566703 +494, -115.90700489378195 +494.5, -98.45238032480684 +495, -91.51341990099858 +495.5, -128.00575365160825 +496, -20.150259558633568 +496.5, 47.23455842678468 +497, 94.75473075606865 +497.5, 40.05389558184193 +498, 9.058408639452308 +498.5, 47.232476416892226 +499, 100.14883983978446 +499.5, 54.1142762054755 +500, 71.60845896240423 +500.5, 126.20140816948397 +501, 237.6633219431888 +501.5, 227.05264243748255 +502, 235.72326727081116 +502.5, 201.61615976227984 +503, 139.7365544793762 +503.5, 149.8772675703006 +504, 118.0970900268629 +504.5, 48.559473812798586 +505, -6.306407963800011 +505.5, 14.056860134179292 +506, 24.626202279841966 +506.5, 66.30690468208245 +507, 2.336696484224894 +507.5, -36.6778219046516 +508, -40.536164782350895 +508.5, -13.585852714451342 +509, -56.6779874774126 +509.5, -24.51907340720141 +510, -71.78902600215513 +510.5, 20.55284456235523 +511, -3.8498444918661594 +511.5, 93.20704031157761 +512, 127.24222384201119 +512.5, 189.68435034309104 +513, 48.559473812798586 +513.5, 129.24606372654404 +514, 64.31423194151766 +514.5, 87.33785442516229 +515, 61.62995336945323 +515.5, -38.93282789164747 +516, -33.50919212218609 +516.5, 73.48889244241118 +517, 104.18263936931733 +517.5, 138.65636989252167 +518, 150.6515859766125 +518.5, 171.59357711520272 +519, 216.10316314020966 +519.5, 224.17379057730057 +520, 171.68102153067971 +520.5, 104.15935871324878 +521, 107.19341494722097 +521.5, 133.36314365176935 +522, 117.05627435433568 +522.5, 141.92796452784344 +523, 130.58574245543073 +523.5, 208.32780256057347 +524, 236.06585253490917 +524.5, 191.4408095976922 +525, 211.95617798198586 +525.5, 300.9147824714963 +526, 321.8919785046293 +526.5, 293.73184834303487 +527, 363.79148121918735 +527.5, 417.46569624288213 +528, 481.61809923367736 +528.5, 476.2540846565866 +529, 405.9275759669636 +529.5, 342.4073468889223 +530, 320.87936460246135 +530.5, 325.2080524421957 +531, 273.69155676144044 +531.5, 261.5458681442238 +532, 313.18160620972014 +532.5, 363.1006324821955 +533, 450.3784871677349 +533.5, 436.68643302141226 +534, 346.18335573906353 +534.5, 334.88561296889515 +535, 350.6899607877762 +535.5, 261.9054880347133 +536, 186.60808609039293 +536.5, 157.6017135443888 +537, 184.45528786174685 +537.5, 228.52708398848952 +538, 213.37762291755237 +538.5, 194.43890384261553 +539, 237.51379577819577 +539.5, 324.2105804301538 +540, 275.66189521407006 +540.5, 279.58175202040553 +541, 257.0297994141819 +541.5, 273.8902940693425 +542, 259.3029756693287 +542.5, 259.99382440632155 +543, 227.455795262084 +543.5, 233.09804207023757 +544, 171.49345136674535 +544.5, 124.27233136744746 +545, 80.09643474608951 +545.5, 102.5249809477875 +546, 66.02545479936774 +546.5, 40.76537514413133 +547, 107.16104915707679 +547.5, 176.8805573262783 +548, 98.48114991604628 +548.5, 99.41975783022367 +549, 162.69885230801128 +549.5, 198.88304859455957 +550, 234.64440759934263 +550.5, 282.90350416676915 +551, 313.58286629805605 +551.5, 444.30848196352304 +552, 472.9115124113015 +552.5, 418.81900267287995 +553, 441.6662221365606 +553.5, 422.20700058854646 +554, 422.5155165998587 +554.5, 471.52602946478214 +555, 497.7101429649527 +555.5, 553.9490156287137 +556, 495.09627418197283 +556.5, 518.5359200968245 +557, 501.92337389247587 +557.5, 382.1775213045301 +558, 361.7548969972591 +558.5, 347.64265539994346 +559, 421.46694070864424 +559.5, 456.3103226245465 +560, 449.958299716742 +560.5, 459.87055954039107 +561, 539.653178613623 +561.5, 489.5259513519164 +562, 410.3206168397327 +562.5, 287.0126345996782 +563, 331.59982281158176 +563.5, 258.96796135029376 +564, 257.34210089802787 +564.5, 160.37684345720837 +565, 103.95418610204334 +565.5, 138.0315776512028 +566, 104.086109819765 +566.5, 129.2841077254854 +567, 156.1386284109762 +567.5, 245.48410819320267 +568, 262.49602174962246 +568.5, 404.8108615701803 +569, 340.2799113262379 +569.5, 404.7995051525866 +570, 393.32005970090927 +570.5, 423.55462880974903 +571, 451.72232991640516 +571.5, 434.7671984479565 +572, 371.21290011713415 +572.5, 435.6321789213992 +573, 344.7335197595111 +573.5, 394.59197847148175 +574, 449.7387423099163 +574.5, 441.6170109936501 +575, 458.439650923497 +575.5, 507.8627802943487 +576, 521.250103901888 +576.5, 510.0167141647561 +577, 448.09395449499186 +577.5, 410.84111931281257 +578, 276.9394921934404 +578.5, 249.9661076704615 +579, 239.53523810999997 +579.5, 219.96434512230755 +580, 229.68922405565053 +580.5, 239.20590199976218 +581, 134.95663831389103 +581.5, 181.18728942533014 +582, 255.11245757699302 +582.5, 281.8833193195385 +583, 334.2647954737349 +583.5, 356.58204878300813 +584, 379.3194895432743 +584.5, 390.7156545992602 +585, 451.99677667493637 +585.5, 396.9332932321966 +586, 398.1654645411896 +586.5, 374.72771136260076 +587, 224.4217390281118 +587.5, 150.6542358073848 +588, 139.2253264140015 +588.5, 194.1455297214266 +589, 126.01894839346724 +589.5, 151.76281143822519 +590, 188.14082391838457 +590.5, 347.04833621250293 +591, 380.9680628307279 +591.5, 335.7013822994275 +592, 193.97518345751035 +592.5, 279.814558581091 +593, 268.9559306245733 +593.5, 181.96633967230613 +594, 150.6366333601134 +594.5, 133.4513451617525 +595, 292.52996081429364 +595.5, 276.8562117977483 +596, 167.5949824802126 +596.5, 167.57946204283368 +597, 157.26878123524628 +597.5, 226.2652641509371 +598, 196.10640449272742 +598.5, 121.05146206404768 +599, 97.65137433714828 +599.5, 105.26206686166572 +600, 77.65329077427972 +##END=$$ End of the data block + +`; + +export default cdsJcamp; diff --git a/src/components/cmd_bar/03_peak.js b/src/components/cmd_bar/03_peak.js index 9d9278e1..e6556ac1 100644 --- a/src/components/cmd_bar/03_peak.js +++ b/src/components/cmd_bar/03_peak.js @@ -30,7 +30,7 @@ const Peak = ({ }) => { let onSweepPeakAdd = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.PEAK_ADD); let onSweepPeakDELETE = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.PEAK_DELETE); - const onSweepAnchorShift = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT); + let onSweepAnchorShift = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT); if (isHandleMaxAndMinPeaksSt) { const { curveIdx } = curveSt; const { spectraList } = cyclicVotaSt; @@ -44,7 +44,8 @@ const Peak = ({ else { onSweepPeakAdd = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MIN_PEAK, curveIdx); onSweepPeakDELETE = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK, curveIdx); - } + } + onSweepAnchorShift = () => setUiSweepTypeAct(LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF, curveIdx); } } diff --git a/src/components/cmd_bar/r01_layout.js b/src/components/cmd_bar/r01_layout.js index ca7f6f6e..b49dd297 100644 --- a/src/components/cmd_bar/r01_layout.js +++ b/src/components/cmd_bar/r01_layout.js @@ -161,6 +161,9 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => { CV (CYCLIC VOLTAMMETRY) + + CDS (CIRCULAR DICHROISM SPECTROSCOPY) + ); diff --git a/src/components/d3_line/line_focus.js b/src/components/d3_line/line_focus.js index cadc0ad8..1f1f8fdb 100644 --- a/src/components/d3_line/line_focus.js +++ b/src/components/d3_line/line_focus.js @@ -778,7 +778,7 @@ class LineFocus { } reverseXAxis(layoutSt) { - return [LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY].indexOf(layoutSt) < 0; + return [LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS, LIST_LAYOUT.TGA, LIST_LAYOUT.XRD, LIST_LAYOUT.CYCLIC_VOLTAMMETRY, LIST_LAYOUT.CDS].indexOf(layoutSt) < 0; } create({ diff --git a/src/components/panel/cyclic_voltamery_data.js b/src/components/panel/cyclic_voltamery_data.js index 2661b149..c008dcd9 100644 --- a/src/components/panel/cyclic_voltamery_data.js +++ b/src/components/panel/cyclic_voltamery_data.js @@ -36,16 +36,16 @@ const styles = () => ({ table: { width: '100%', wordWrap: 'break-all', - fontSize: '14px !important' + fontSize: '14px !important', }, td: { wordWrap: 'break-all', - fontSize: '14px !important' + fontSize: '14px !important', }, cellSelected: { backgroundColor: '#2196f3', color: '#fff', - fontSize: '14px !important' + fontSize: '14px !important', }, btnRemove: { color: 'red' @@ -116,21 +116,21 @@ const CyclicVoltammetryPanel = ({ }; const getDelta = (data) => { - return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x).toExponential(2) : "undefined"; + return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x) : "undefined"; }; const getRatio = (feature, data) => { const featureData = feature.data[0]; const idx = featureData.x.indexOf(feature.maxX); const y_pecker = data.pecker ? data.pecker.y : featureData.y[idx]; - return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toExponential(2) : "undefined"; + return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toFixed(8) : "undefined"; }; const rows = list.map((o, idx) => ( { idx, - max: o.max ? `x:${parseFloat(o.max.x).toExponential(2)}, y:${parseFloat(o.max.y).toExponential(2)}` : "undefined", - min: o.min ? `x:${parseFloat(o.min.x).toExponential(2)}, y:${parseFloat(o.min.y).toExponential(2)}` : "undefined", + max: o.max ? `x:${parseFloat(o.max.x)}, y:${parseFloat(o.max.y).toExponential(2)}` : "undefined", + min: o.min ? `x:${parseFloat(o.min.x)}, y:${parseFloat(o.min.y).toExponential(2)}` : "undefined", pecker: o.pecker ? `${parseFloat(o.pecker.y).toExponential(2)}` : "undefined", delta: getDelta(o), ratio: getRatio(feature, o), diff --git a/src/constants/action_type.js b/src/constants/action_type.js index d245450c..4f7c35ae 100644 --- a/src/constants/action_type.js +++ b/src/constants/action_type.js @@ -136,6 +136,7 @@ const CYCLIC_VOLTA_METRY = { ADD_PECKER: 'ADD_PECKER', REMOVE_PECKER: 'REMOVE_PECKER', RESETALL: 'RESETALL_VOLTA_METRY', + SET_REF: 'VOLTA_METRY_SET_REF', }; const CURVE = { diff --git a/src/constants/list_layout.js b/src/constants/list_layout.js index f5613ed2..2d3ac38a 100644 --- a/src/constants/list_layout.js +++ b/src/constants/list_layout.js @@ -13,7 +13,8 @@ const LIST_LAYOUT = { TGA: 'THERMOGRAVIMETRIC ANALYSIS', XRD: 'X-RAY DIFFRACTION', HPLC_UVVIS: 'HPLC UV/VIS', - CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY' + CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY', + CDS: 'CIRCULAR DICHROISM SPECTROSCOPY' }; export { diff --git a/src/constants/list_ui.js b/src/constants/list_ui.js index 2967e365..c8aab9bd 100644 --- a/src/constants/list_ui.js +++ b/src/constants/list_ui.js @@ -25,6 +25,7 @@ const LIST_UI_SWEEP_TYPE = { CYCLIC_VOLTA_RM_MIN_PEAK: 'cyclic voltammetry remove min peak', CYCLIC_VOLTA_ADD_PECKER: 'cyclic voltammetry add pecker', CYCLIC_VOLTA_RM_PECKER: 'cyclic voltammetry remove pecker', + CYCLIC_VOLTA_SET_REF: 'cyclic voltammetry set ref', }; const LIST_NON_BRUSH_TYPES = [ @@ -43,6 +44,7 @@ const LIST_NON_BRUSH_TYPES = [ LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_PECKER, LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER, + LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF, ]; export { diff --git a/src/helpers/cfg.js b/src/helpers/cfg.js index 7516a15c..bc7bac45 100644 --- a/src/helpers/cfg.js +++ b/src/helpers/cfg.js @@ -16,7 +16,7 @@ const btnCmdAddPeak = layoutSt => Format.isMsLayout(layoutSt); const btnCmdRmPeak = layoutSt => Format.isMsLayout(layoutSt); -const btnCmdSetRef = layoutSt => !Format.isNmrLayout(layoutSt); +const btnCmdSetRef = layoutSt => !(Format.isNmrLayout(layoutSt)); const btnCmdIntg = layoutSt => !(Format.isNmrLayout(layoutSt) || Format.isHplcUvVisLayout(layoutSt)); diff --git a/src/helpers/chem.js b/src/helpers/chem.js index 86cde73e..894bf191 100644 --- a/src/helpers/chem.js +++ b/src/helpers/chem.js @@ -293,6 +293,9 @@ const readLayout = (jcamp) => { if (dataType.includes('CYCLIC VOLTAMMETRY')) { return LIST_LAYOUT.CYCLIC_VOLTAMMETRY; } + if (dataType.includes('CIRCULAR DICHROISM SPECTROSCOPY')) { + return LIST_LAYOUT.CDS; + } } return false; }; @@ -698,7 +701,7 @@ const ExtractJcamp = (source) => { if (Format.isMsLayout(layout)) { features = extrFeaturesMs(jcamp, layout, peakUp); } - else if (Format.isXRDLayout(layout)) { + else if (Format.isXRDLayout(layout) || Format.isCDSLayout(layout)) { features = extrFeaturesXrd(jcamp, layout, peakUp); } else if (Format.isCyclicVoltaLayout(layout)) { diff --git a/src/helpers/format.js b/src/helpers/format.js index 7a1f2435..76404877 100644 --- a/src/helpers/format.js +++ b/src/helpers/format.js @@ -11,6 +11,7 @@ const spectraDigit = (layout) => { case LIST_LAYOUT.TGA: case LIST_LAYOUT.XRD: case LIST_LAYOUT.CYCLIC_VOLTAMMETRY: + case LIST_LAYOUT.CDS: case LIST_LAYOUT.MS: return 0; case LIST_LAYOUT.C13: @@ -63,6 +64,7 @@ const spectraOps = { [LIST_LAYOUT.MS]: { head: 'MASS', tail: ' m/z' }, [LIST_LAYOUT.XRD]: { head: 'X-RAY DIFFRACTION', tail: '.' }, [LIST_LAYOUT.CYCLIC_VOLTAMMETRY]: { head: 'CYCLIC VOLTAMMETRY', tail: '.' }, + [LIST_LAYOUT.CDS]: { head: 'CIRCULAR DICHROISM SPECTROSCOPY', tail: '.' }, }; const rmRef = (peaks, shift) => { @@ -249,6 +251,9 @@ const peaksBody = ({ if (layout === LIST_LAYOUT.CYCLIC_VOLTAMMETRY) { return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false); } + if (layout === LIST_LAYOUT.CDS) { + return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false); + } return ordered.map(o => fixDigit(o.x, decimal)).join(', '); }; @@ -283,6 +288,7 @@ const isHplcUvVisLayout = layoutSt => (LIST_LAYOUT.HPLC_UVVIS === layoutSt); const isTGALayout = layoutSt => (LIST_LAYOUT.TGA === layoutSt); const isXRDLayout = layoutSt => (LIST_LAYOUT.XRD === layoutSt); const isCyclicVoltaLayout = layoutSt => (LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt); +const isCDSLayout = layoutSt => (LIST_LAYOUT.CDS === layoutSt); const isEmWaveLayout = layoutSt => ( [LIST_LAYOUT.IR, LIST_LAYOUT.RAMAN, LIST_LAYOUT.UVVIS, LIST_LAYOUT.HPLC_UVVIS].indexOf(layoutSt) >= 0 ); @@ -363,6 +369,7 @@ const Format = { isTGALayout, isXRDLayout, isCyclicVoltaLayout, + isCDSLayout, isEmWaveLayout, fixDigit, formatPeaksByPrediction, diff --git a/src/index.js b/src/index.js index 8c8f4d03..c7a671b1 100644 --- a/src/index.js +++ b/src/index.js @@ -32,6 +32,7 @@ import xrdJcamp2 from './__tests__/fixtures/xrd_jcamp_2'; import cyclicVoltaJcamp1 from './__tests__/fixtures/cyclic_voltammetry_1'; import cyclicVoltaJcamp2 from './__tests__/fixtures/cyclic_voltammetry_2'; import cyclicVoltaJcamp3 from './__tests__/fixtures/cyclic_voltammetry_3'; +import cdsJcamp from './__tests__/fixtures/cds_jcamp'; import { q1H, qIR, q13C } from './__tests__/fixtures/qDescValue'; import './__tests__/style/svg.css'; @@ -56,6 +57,7 @@ const xrdEntity2 = FN.ExtractJcamp(xrdJcamp2); const cyclicVoltaEntity1 = FN.ExtractJcamp(cyclicVoltaJcamp1); const cyclicVoltaEntity2 = FN.ExtractJcamp(cyclicVoltaJcamp2); const cyclicVoltaEntity3 = FN.ExtractJcamp(cyclicVoltaJcamp3); +const cdsEntity = FN.ExtractJcamp(cdsJcamp); class DemoWriteIr extends React.Component { constructor(props) { @@ -271,6 +273,8 @@ class DemoWriteIr extends React.Component { return xrdEntity1; case 'cyclic volta': return cyclicVoltaEntity2; + case 'cds': + return cdsEntity; case 'ms': default: return msEntity; @@ -309,6 +313,7 @@ class DemoWriteIr extends React.Component { case 'xrd': case 'ms': case 'cyclic volta': + case 'cds': default: return false; } @@ -471,6 +476,13 @@ class DemoWriteIr extends React.Component { > CV +