Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'wavelength' of undefined on calibration copy #50

Open
jywarren opened this issue Nov 28, 2016 · 0 comments
Open

Comments

@jywarren
Copy link
Member

Please describe your problem in detail, including:

What happened before you saw the error

A contributor tried to copy this spectrum's calibration:

https://spectralworkbench.org/spectrums/92343

to copy over to this spectrum: https://spectralworkbench.org/spectrums/92347

This was done using the "Copy calibration" button, which generates the power tag calibrate:92343#25653 (the #25653 was added to refer to the most recent data snapshot of 92343). This was reproducible simply by entering calibrate:92343#25653 into the tags input (though you have to be an admin to do this unless you fork 92347 and do it on your own fork).

That made a request to:

https://spectralworkbench.org/snapshots/25653.json

But the JavaScript console showed this error:

querying latest snapshot of 92343 for tag.reference_id
application-0add874….js:57 parsing calibrate:92343#25653
application-0add874….js:58 Uncaught TypeError: Cannot read property 'wavelength' of undefined()(anonymous function) @ application-0add874….js:58(anonymous function) @ application-0add874….js:58success @ application-0add874….js:57c @ application-0add874….js:24fireWith @ application-0add874….js:24n @ application-0add874….js:26e @ application-0add874….js:26

The use of .wavelength mentioned is most likely on one of these lines:

src/api/SpectralWorkbench.API.Core.js:          line.wavelength = source.json.data.lines[i].wavelength;
src/api/SpectralWorkbench.API.Core.js:      var nmPerPx         = (tempCalibration[tempCalibration.length-1].wavelength - tempCalibration[0].wavelength) / tempCalibration.length,
src/api/SpectralWorkbench.API.Core.js:          startWavelength = tempCalibration[0].wavelength,
src/SpectralWorkbench.Spectrum.js:        if (line.wavelength == null) var x = line.pixel; // change graph labels
src/SpectralWorkbench.Spectrum.js:        else                         var x = line.wavelength;
src/SpectralWorkbench.Spectrum.js:        if (_spectrum.isCalibrated()) lines[lines.length-1].wavelength = _spectrum.average[i].x;
src/SpectralWorkbench.Spectrum.js:        var start =  _spectrum.json.data.lines[0].wavelength;
src/SpectralWorkbench.Spectrum.js:        var end =  _spectrum.json.data.lines[_spectrum.json.data.lines.length-1].wavelength;
src/SpectralWorkbench.Spectrum.js:            w1 = lines[0].wavelength,
src/SpectralWorkbench.Spectrum.js:            w2 = lines[lines.length-1].wavelength,
src/SpectralWorkbench.Spectrum.js:            w1 = lines[0].wavelength,
src/SpectralWorkbench.Spectrum.js:            w2 = lines[lines.length-1].wavelength,
src/SpectralWorkbench.Spectrum.js:        if (keepCalibrated) lines[lines.length - 1].wavelength = _spectrum.pxToNm(index);

What you expected to happen

Browser, version, and operating system

(to help reproduce the issue)

For bug reports, fill out the above template; for feature requests, you can delete the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant