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

pdg_sig_figs makes it impossible to control number of digits for single value formatting. #73

Closed
jagerber48 opened this issue Oct 23, 2023 · 3 comments · Fixed by #112
Closed

Comments

@jagerber48
Copy link
Owner

jagerber48 commented Oct 23, 2023

If pdg_sig_figs=True then an exception is raised if ndigits != AutoDigits. This limits the functionally for using one formatter for both uncertainty formatting and single-value formatting. It's not clear what the desired behavior should be here.

@jagerber48
Copy link
Owner Author

jagerber48 commented Dec 27, 2023

One proposed desired behavior would be:

  • Users can pass in options including pdg_sig_figs = True and ndigits != AutoDigits, but if they do this they get a warning that this is a possibly confusing combination of options and encouraging them to use different formatters for values and value/uncertainty pairs.
  • When formatting a value (on its own with no uncertainty) then ndigits is always respected and the state of pdg_sig_figs is ignored.
  • When formatting value/uncertainty pairs, if pdg_sig_figs=True then this is always used and ndigits is ignored. If pdg_sig_figs=False then the uncertainty is rounded according to ndigits.

@jagerber48
Copy link
Owner Author

I'm going to move forward with the strategy discussed in the last post. But there will be no warning about the possibly confusing combination of options. Rather, it will simply be clearly stated in the documentation for pdg_sig_figs that pdg_sig_figs=True takes precedence over ndigits when formatting value/uncertainty pairs.

@jagerber48
Copy link
Owner Author

Taking the suggested approach will in fact not be breaking. I was worried that pdg_sig_figs=True while formatting a value resulted in the value being rounded according to pdg sig fig rounding rules but I was thinking about #71 in which the value of a value/uncertainty pair was erroneously getting rounded according to pdg sig fig rounding rules. The current behavior with pdg_sig_figs=True and ndigits=AutoDigits is that formatting a value alone result in the value being rounded according to AutoDigits.

Instead the proposed change is simply going to add the functionality for the formatter to be configured with pdg_sig_figs=True and ndigits!=AutoDigits, a case which currently always just raises an error.

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

Successfully merging a pull request may close this issue.

1 participant