LISE-B26 / pylabcontrol

pylabcontrol: Laboratory Equipment Control for Scientific Experiments.
GNU General Public License v3.0
9 stars 9 forks source link

Settings with negative scientific notation breaks on saving #160

Open akabcenell opened 5 years ago

akabcenell commented 5 years ago

If a setting is shown in the gui with positive scientific notation, ex. 2.8e+3, it will be saved in the json file as 2800. However, if it has negative scientific notation ex. 2.8e-3, it will be saved as "2.8e-3". On loading, this loads as a string, but the Parameter expects a float, so the load fails.

The two fixes are to fix how things are saved in the json (so it saves as .0028), or to change Parameters to allow scientific notation for numbers. The first is likely the better fix to keep things consistent.

jdschae commented 4 years ago

Problem is with yaml.safe_load. Will work if decimal point is included (ex. 2.8e3) but not if integer in notation (ex. 2e-10)