resultwizard / ResultWizard

Intelligent interface between Python-computed values and your LaTeX work.
https://resultwizard.github.io/ResultWizard
MIT License
7 stars 0 forks source link

Multiple uncertainties: print same number of digits #31

Open Splines opened 7 months ago

Splines commented 7 months ago

With the following code:

wiz.res("Wellenlänge", 5.4066e-7, 1.0297e-9, 3.6457e-9, r"\m")

will print to the console:

Wellenlaenge = (5.407 ± 0.010 (sys) ± 0.04 (stat))e-7 m

We end up with the following string in results.tex:

\qty{5.407 \pm 0.010\UncertSys \pm 0.04\UncertStat e-7}{\m}

This will show up in the document as image

Note the additional 0 after the text "stat". The problem is that siunitx tries to show the same number of digits for systematic and statistical error, which I find a reasonable way of doing things.

Splines commented 7 months ago

Note that a similar problem arises if I do

wavelength = 5.4066e-7
wavelength_err_sys = 1.0297e-9
wavelength_err_stat = 3.6457e-9
wiz.res("Wellenlänge", wavelength * 1e9,
        wavelength_err_sys*1e9, wavelength_err_stat * 1e9, r"\nm")

This will output to the console

Wellenlaenge = (540.7 ± 1.0 (sys) ± 4 (stat)) nm

and to the results.tex:

\qty{540.7 \pm 1.0\UncertSys \pm 4\UncertStat}{\nm}

which shows up as follows in the document: image

Splines commented 7 months ago

@paul019 Maybe, we can both take a look here if we find a solution to this problem.