Skip to content

Commit

Permalink
Update CV layout and add CDS layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Lan Le committed Apr 24, 2023
1 parent 7e5c5f2 commit 3524e2d
Show file tree
Hide file tree
Showing 27 changed files with 1,044 additions and 40 deletions.
3 changes: 3 additions & 0 deletions dist/components/cmd_bar/03_peak.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
}

Expand Down
9 changes: 9 additions & 0 deletions dist/components/cmd_bar/r01_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
)
)
)
);
Expand Down
2 changes: 1 addition & 1 deletion dist/components/d3_line/line_focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions dist/components/panel/cyclic_voltamery_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion dist/constants/action_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
3 changes: 2 additions & 1 deletion dist/constants/list_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
5 changes: 3 additions & 2 deletions dist/constants/list_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion dist/helpers/chem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion dist/helpers/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(', ');
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -449,6 +456,7 @@ var Format = {
isTGALayout: isTGALayout,
isXRDLayout: isXRDLayout,
isCyclicVoltaLayout: isCyclicVoltaLayout,
isCDSLayout: isCDSLayout,
isEmWaveLayout: isEmWaveLayout,
fixDigit: fixDigit,
formatPeaksByPrediction: formatPeaksByPrediction,
Expand Down
17 changes: 17 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -498,6 +505,7 @@ var DemoWriteIr = function (_React$Component) {
case 'xrd':
case 'ms':
case 'cyclic volta':
case 'cds':
default:
return false;
}
Expand Down Expand Up @@ -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,
{
Expand Down
28 changes: 28 additions & 0 deletions dist/reducers/reducer_voltammetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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:
Expand Down
Loading

0 comments on commit 3524e2d

Please sign in to comment.