Skip to content

Commit

Permalink
feat: change values for peak reference (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
baolanlequang authored Oct 6, 2023
1 parent e401ab1 commit 3c54b03
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 45 deletions.
6 changes: 3 additions & 3 deletions dist/components/multi_jcamps_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class MultiJcampsViewer extends _react.default.Component {
operations,
entityFileNames,
entities,
userManualLink
userManualLink,
molSvg
} = this.props;
if (!entities || entities.length === 0) return /*#__PURE__*/_react.default.createElement("div", null);
const seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit');
Expand All @@ -66,8 +67,7 @@ class MultiJcampsViewer extends _react.default.Component {
const entity = entities[curveIdx];
const {
feature,
topic,
molSvg
topic
} = entity;
return /*#__PURE__*/_react.default.createElement("div", {
className: classes.root
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 @@ -137,18 +137,18 @@ const CyclicVoltammetryPanel = _ref => {
}
};
const getDelta = data => {
return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x).toFixed(5) : 'undefined';
return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x).toFixed(3) : '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 ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(5) : 'undefined';
return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(3) : 'undefined';
};
const rows = list.map((o, idx) => ({
idx,
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',
max: o.max ? `x:${parseFloat(o.max.x).toFixed(3)}, y:${parseFloat(o.max.y).toExponential(2)}` : 'undefined',
min: o.min ? `x:${parseFloat(o.min.x).toFixed(3)}, 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
48 changes: 34 additions & 14 deletions dist/constants/list_shift.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,37 @@ const cActicAcidD4S = {
};
const cAcetoneD6Sep = {
name: 'Acetone-d6 (sep)',
value: 29.920,
value: 29.640,
label: 'Acetone-d6',
nsdb: 'Acetone-D6 ((CD3)2CO)'
};
const cAcetoneD6Broad = {
name: 'Acetone-d6 (broad)',
value: 206.68,
value: 206.260,
label: 'Acetone-d6',
nsdb: 'Acetone-D6 ((CD3)2CO)'
};
const cAcetonitrileD3Sep = {
name: 'Acetonitrile-d3 (sep)',
value: 1.39,
value: 1.32,
label: 'Acetonitrile-d3',
nsdb: 'Acetonitrile-D3(CD3CN)'
};
const cAcetonitrileD3S = {
name: 'Acetonitrile-d3 (s)',
value: 118.69,
value: 118.26,
label: 'Acetonitrile-d3',
nsdb: 'Acetonitrile-D3(CD3CN)'
};
const cBenzeneT = {
name: 'Benzene (t)',
value: 128.390,
value: 128.060,
label: 'Benzene-d6',
nsdb: 'Benzene-D6 (C6D6)'
};
const cChloroformDT = {
name: 'Chloroform-d (t)',
value: 77.00,
value: 77.16,
label: 'CDCl$3',
nsdb: 'Chloroform-D1 (CDCl3)'
};
Expand All @@ -65,7 +65,7 @@ const cCyclohexaneD12Quin = {
};
const cDichloromethaneD2Quin = {
name: 'Dichloromethane-d2 (quin)',
value: 54.0,
value: 53.84,
label: 'CD$2Cl$2'
};
const cDmfD7Sep1 = {
Expand All @@ -90,7 +90,7 @@ const cDioxaneD8Quin = {
};
const cDmsoD6 = {
name: 'DMSO-d6',
value: 39.51,
value: 39.52,
label: 'DMSO-d6',
nsdb: 'Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)'
};
Expand All @@ -106,7 +106,7 @@ const cEthanolD6Quin = {
};
const cMethanolD4Sep = {
name: 'Methanol-d4 (sep)',
value: 49.15,
value: 49.00,
label: 'Methanol-d4',
nsdb: 'Methanol-D4 (CD3OD)'
};
Expand Down Expand Up @@ -182,15 +182,35 @@ const cTfaDQ2 = {
};
const cTrifluoroethanolD3Quin = {
name: 'Trifluoroethanol-d3 (quin)',
value: 61.50,
value: 61.80,
label: 'Trifluoroethanol-d3'
};
const cTrifluoroethanolD3Broad = {
name: 'Trifluoroethanol-d3 (broad)',
value: 126.3,
value: 126.28,
label: 'Trifluoroethanol-d3'
};
const LIST_SHIFT_13C = [noReference, cActicAcidD4Sept, cActicAcidD4S, cAcetoneD6Sep, cAcetoneD6Broad, cAcetonitrileD3Sep, cAcetonitrileD3S, cBenzeneT, cChloroformDT, cCyclohexaneD12Quin, cDichloromethaneD2Quin, cDmfD7Sep1, cDmfD7Sep2, cDmfD7T3, cDioxaneD8Quin, cDmsoD6, cEthanolD6Sep, cEthanolD6Quin, cMethanolD4Sep, cPyridineD5T1, cPyridineD5T2, cPyridineD5T3, cThfD8Quin1, cThfD8Quin2, cTmsS, cTolueneD8Sep1, cTolueneD8T2, cTolueneD8T3, cTolueneD8T4, cTolueneD8T5, cTfaDQ1, cTfaDQ2, cTrifluoroethanolD3Quin, cTrifluoroethanolD3Broad];
const cC6D5Cl1 = {
name: 'C6D5Cl (s)',
value: 134.19,
label: 'C6D5Cl'
};
const cC6D5Cl2 = {
name: 'C6D5Cl (t)-1',
value: 129.26,
label: 'C6D5Cl'
};
const cC6D5Cl3 = {
name: 'C6D5Cl (t)-2',
value: 128.25,
label: 'C6D5Cl'
};
const cC6D5Cl4 = {
name: 'C6D5Cl (t)-3',
value: 125.96,
label: 'C6D5Cl'
};
const LIST_SHIFT_13C = [noReference, cActicAcidD4Sept, cActicAcidD4S, cAcetoneD6Sep, cAcetoneD6Broad, cAcetonitrileD3Sep, cAcetonitrileD3S, cBenzeneT, cChloroformDT, cCyclohexaneD12Quin, cDichloromethaneD2Quin, cDmfD7Sep1, cDmfD7Sep2, cDmfD7T3, cDioxaneD8Quin, cDmsoD6, cEthanolD6Sep, cEthanolD6Quin, cMethanolD4Sep, cPyridineD5T1, cPyridineD5T2, cPyridineD5T3, cThfD8Quin1, cThfD8Quin2, cTmsS, cTolueneD8Sep1, cTolueneD8T2, cTolueneD8T3, cTolueneD8T4, cTolueneD8T5, cTfaDQ1, cTfaDQ2, cTrifluoroethanolD3Quin, cTrifluoroethanolD3Broad, cC6D5Cl1, cC6D5Cl2, cC6D5Cl3, cC6D5Cl4];
exports.LIST_SHIFT_13C = LIST_SHIFT_13C;
const hActicAcidD4Quin = {
name: 'Acetic acid-d4 (quin)',
Expand Down Expand Up @@ -232,8 +252,8 @@ const hCyclohexaneD12S = {
label: 'C$6D$1$2'
};
const hDeuteriumOxideS = {
name: 'Deuterium oxide (s)',
value: 4.75,
name: 'D2O (s)',
value: 4.79,
label: 'D$2O',
nsdb: 'Deuteriumoxide (D2O)'
};
Expand Down
29 changes: 27 additions & 2 deletions dist/helpers/chem.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,32 @@ const extrSpectraShare = (spectra, layout) => spectra.map(s => Object.assign({
const extrSpectraMs = (jcamp, layout) => {
const scanCount = jcamp.info.$CSSCANCOUNT || 1;
const spc = extrSpectraShare(jcamp.spectra.slice(0, scanCount), layout);
return spc || [];
let spectra = spc || [];
if (jcamp.info.UNITS && jcamp.info.SYMBOL) {
const units = jcamp.info.UNITS.split(',');
const symbol = jcamp.info.SYMBOL.split(',');
let xUnit = null;
let yUnit = null;
symbol.forEach((sym, idx) => {
const currSymbol = sym.replace(' ', '').toLowerCase();
if (currSymbol === 'x') {
xUnit = units[idx].trim();
} else if (currSymbol === 'y') {
yUnit = units[idx].trim();
}
});
spectra = spectra.map(sp => {
const spectrum = sp;
if (xUnit) {
spectrum.xUnit = xUnit;
}
if (yUnit) {
spectrum.yUnit = yUnit;
}
return spectrum;
});
}
return spectra;
};
const extrSpectraNi = (jcamp, layout) => {
const categorys = jcamp.info.$CSCATEGORY || ['SPECTRUM'];
Expand Down Expand Up @@ -762,7 +787,7 @@ const extrFeaturesMs = (jcamp, layout, peakUp) => {
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)/ // 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)/ // eslint-disable-line
});

const layout = readLayout(jcamp);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@complat/react-spectra-editor",
"version": "1.0.0-rc17",
"version": "1.0.0-rc18",
"description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS, CV, UIVIS, XRD).",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/components/multi_jcamps_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ const seperatingSubLayout = (entities, featureCondition) => {
class MultiJcampsViewer extends React.Component { // eslint-disable-line
render() {
const {
classes, curveSt, operations, entityFileNames, entities, userManualLink,
classes, curveSt, operations, entityFileNames, entities, userManualLink, molSvg,
} = this.props;
if (!entities || entities.length === 0) return (<div />);

const seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit');
const { curveIdx } = curveSt;
const entity = entities[curveIdx];
const { feature, topic, molSvg } = entity;
const { feature, topic } = entity;

return (
<div className={classes.root}>
Expand Down
8 changes: 4 additions & 4 deletions src/components/panel/cyclic_voltamery_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,21 @@ const CyclicVoltammetryPanel = ({
};

const getDelta = (data) => {
return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x).toFixed(5) : 'undefined';
return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x).toFixed(3) : '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).toFixed(5) : 'undefined';
return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toFixed(3) : 'undefined';
};

const rows = list.map((o, idx) => (
{
idx,
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',
max: o.max ? `x:${parseFloat(o.max.x).toFixed(3)}, y:${parseFloat(o.max.y).toExponential(2)}` : 'undefined',
min: o.min ? `x:${parseFloat(o.min.x).toFixed(3)}, 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
51 changes: 38 additions & 13 deletions src/constants/list_shift.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,42 @@ const cActicAcidD4S = {

const cAcetoneD6Sep = {
name: 'Acetone-d6 (sep)',
value: 29.920,
value: 29.640,
label: 'Acetone-d6',
nsdb: 'Acetone-D6 ((CD3)2CO)',
};

const cAcetoneD6Broad = {
name: 'Acetone-d6 (broad)',
value: 206.68,
value: 206.260,
label: 'Acetone-d6',
nsdb: 'Acetone-D6 ((CD3)2CO)',
};

const cAcetonitrileD3Sep = {
name: 'Acetonitrile-d3 (sep)',
value: 1.39,
value: 1.32,
label: 'Acetonitrile-d3',
nsdb: 'Acetonitrile-D3(CD3CN)',
};

const cAcetonitrileD3S = {
name: 'Acetonitrile-d3 (s)',
value: 118.69,
value: 118.26,
label: 'Acetonitrile-d3',
nsdb: 'Acetonitrile-D3(CD3CN)',
};

const cBenzeneT = {
name: 'Benzene (t)',
value: 128.390,
value: 128.060,
label: 'Benzene-d6',
nsdb: 'Benzene-D6 (C6D6)',
};

const cChloroformDT = {
name: 'Chloroform-d (t)',
value: 77.00,
value: 77.16,
label: 'CDCl$3',
nsdb: 'Chloroform-D1 (CDCl3)',
};
Expand All @@ -69,7 +69,7 @@ const cCyclohexaneD12Quin = {

const cDichloromethaneD2Quin = {
name: 'Dichloromethane-d2 (quin)',
value: 54.0,
value: 53.84,
label: 'CD$2Cl$2',
};

Expand Down Expand Up @@ -99,7 +99,7 @@ const cDioxaneD8Quin = {

const cDmsoD6 = {
name: 'DMSO-d6',
value: 39.51,
value: 39.52,
label: 'DMSO-d6',
nsdb: 'Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)',
};
Expand All @@ -118,7 +118,7 @@ const cEthanolD6Quin = {

const cMethanolD4Sep = {
name: 'Methanol-d4 (sep)',
value: 49.15,
value: 49.00,
label: 'Methanol-d4',
nsdb: 'Methanol-D4 (CD3OD)',
};
Expand Down Expand Up @@ -208,16 +208,40 @@ const cTfaDQ2 = {

const cTrifluoroethanolD3Quin = {
name: 'Trifluoroethanol-d3 (quin)',
value: 61.50,
value: 61.80,
label: 'Trifluoroethanol-d3',
};

const cTrifluoroethanolD3Broad = {
name: 'Trifluoroethanol-d3 (broad)',
value: 126.3,
value: 126.28,
label: 'Trifluoroethanol-d3',
};

const cC6D5Cl1 = {
name: 'C6D5Cl (s)',
value: 134.19,
label: 'C6D5Cl',
};

const cC6D5Cl2 = {
name: 'C6D5Cl (t)-1',
value: 129.26,
label: 'C6D5Cl',
};

const cC6D5Cl3 = {
name: 'C6D5Cl (t)-2',
value: 128.25,
label: 'C6D5Cl',
};

const cC6D5Cl4 = {
name: 'C6D5Cl (t)-3',
value: 125.96,
label: 'C6D5Cl',
};

const LIST_SHIFT_13C = [
noReference, cActicAcidD4Sept, cActicAcidD4S, cAcetoneD6Sep, cAcetoneD6Broad,
cAcetonitrileD3Sep, cAcetonitrileD3S, cBenzeneT, cChloroformDT,
Expand All @@ -227,6 +251,7 @@ const LIST_SHIFT_13C = [
cThfD8Quin1, cThfD8Quin2, cTmsS,
cTolueneD8Sep1, cTolueneD8T2, cTolueneD8T3, cTolueneD8T4, cTolueneD8T5,
cTfaDQ1, cTfaDQ2, cTrifluoroethanolD3Quin, cTrifluoroethanolD3Broad,
cC6D5Cl1, cC6D5Cl2, cC6D5Cl3, cC6D5Cl4,
];

const hActicAcidD4Quin = {
Expand Down Expand Up @@ -276,8 +301,8 @@ const hCyclohexaneD12S = {
};

const hDeuteriumOxideS = {
name: 'Deuterium oxide (s)',
value: 4.75,
name: 'D2O (s)',
value: 4.79,
label: 'D$2O',
nsdb: 'Deuteriumoxide (D2O)',
};
Expand Down
Loading

0 comments on commit 3c54b03

Please sign in to comment.