Skip to content

Commit

Permalink
update formatedEmissions
Browse files Browse the repository at this point in the history
  • Loading branch information
f-idiris committed Sep 12, 2023
1 parent 2cd7aa3 commit 4544297
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
8 changes: 1 addition & 7 deletions dist/helpers/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ const formatedEmissions = function (peaks, maxY) {
x: k,
y: ordered[k]
}));
return ordered.map(o => `${o.x}`).join(', ');
return `λex = ${fixedWavelength} nm; λem = ${ordered.map(o => `${o.x}`).join(', ')}`;
};
const formatedDLSIntensity = function (peaks, maxY) {
let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
Expand Down Expand Up @@ -422,12 +422,6 @@ const peaksWrapper = function (layout, shift) {
};
}
const ops = spectraOps[layout];
if (layout === _list_layout.LIST_LAYOUT.EMISSIONS) {
return {
head: `${ops.head}${solvTxt}: λex = ${fixedWavelength} nm; λem = `,
tail: ops.tail
};
}
return {
head: `${ops.head}${solvTxt} = `,
tail: ops.tail
Expand Down
8 changes: 5 additions & 3 deletions src/__tests__/units/helpers/format.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ describe('Test format helper', () => {
interface ParamForPeaks {
peaks: any, layout: string, decimal: number, shift: any, isAscend: boolean,
isIntensity: boolean, boundary: any,
integration: any, atIndex: number
integration: any, atIndex: number,
fixedWavelength: number
}
let params: ParamForPeaks
beforeEach(() => {
Expand All @@ -100,7 +101,8 @@ describe('Test format helper', () => {
shift: { shifts: [{ ref: LIST_SHIFT_1H[1], peak: { x: 2, y: 2 } }] },
isAscend: false,
isIntensity: false, boundary: {},
integration: null, atIndex: 0
integration: null, atIndex: 0,
fixedWavelength: 10,
}
})

Expand Down Expand Up @@ -137,7 +139,7 @@ describe('Test format helper', () => {
it('Get peaks for Emission layout', () => {
params.layout = LIST_LAYOUT.EMISSIONS
const body = Format.peaksBody(params)
expect(body).toEqual('2.0, 1.0')
expect(body).toEqual('λex = 10 nm; λem = 2.0, 1.0')
})


Expand Down
6 changes: 2 additions & 4 deletions src/helpers/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ const formatedEmissions = (

ordered = Object.keys(ordered).sort(sortFunc)
.map((k) => ({ x: k, y: ordered[k] }));
return ordered.map((o) => `${o.x}`).join(', ');
return `λex = ${fixedWavelength} nm; λem = ${ordered.map((o) => `${o.x}`)
.join(', ')}`;
};

const formatedDLSIntensity = (
Expand Down Expand Up @@ -347,9 +348,6 @@ const peaksWrapper = (layout, shift, atIndex = 0) => {
}

const ops = spectraOps[layout];
if (layout === LIST_LAYOUT.EMISSIONS) {
return { head: `${ops.head}${solvTxt}: λex = ${fixedWavelength} nm; λem = `, tail: ops.tail };
}
return { head: `${ops.head}${solvTxt} = `, tail: ops.tail };
};

Expand Down

0 comments on commit 4544297

Please sign in to comment.