GLS icon indicating copy to clipboard operation
GLS copied to clipboard

Issue variable definition in Javascript version

Open avazquezgit opened this issue 10 months ago • 1 comments

Variables Abest, Bbest and Cbest.

Uncaught ReferenceError: Abest is not defined at GLS (gls.js:104:34) at runGLS (gls.html?run:85:10) at loaddata (gls.html?run:78:4) at FileReader.loadHandler (read-csv.js:55:4)

avazquezgit avatar Apr 18 '24 07:04 avazquezgit

Hi,

Indeed, Abest is only defined, if it goes through here: https://github.com/mzechmeister/GLS/blob/e6fbf7a0e9e31f00063b8dad0956f3ed7f3c2d0d/javascript/gls.js#L102

I can reproduce the error when passing a file with content

0 1
1 foo

foo is a string and float parsing converts it to a NaN. image

NaN data values will lead to NaN power values p. Thus the if condition will never become true.

@avazquezgit Is such an invalid data format the case for you?

[The error only occurs, when running the code the first the time on invalid data. If a valid data set was processed before, Abest (as yet a global variable) it is already defined, but contains a misleading values.]

mzechmeister avatar Apr 18 '24 15:04 mzechmeister