Skip to content

Commit 7672f9e

Browse files
authored
Merge pull request #719 from manbhav234/fix-wavelength-grid-xRange
fix: wavelength grid to show nm range correctly
2 parents a6e5022 + 598e5c1 commit 7672f9e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

backend/src/routes/calculateSpectrum.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ async def calc_spectrum(payload: Payload):
3030
wunit = spectrum.get_waveunit()
3131
iunit = "default"
3232
xNan, yNan = spectrum.get(payload.mode, wunit=wunit, Iunit=iunit)
33+
# if the specified units were nm, convert the spectrum range (cm-1 by default) to nm
34+
if (payload.wavelength_units == 'u.nm'):
35+
xNan = 1e7 / xNan
36+
xNan = np.sort(xNan)
3337
# to remove the nan values from x and y
3438
x = xNan[~np.isnan(xNan)]
3539
y = yNan[~np.isnan(yNan)]

0 commit comments

Comments
 (0)