You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now for value/uncertainty formatting sciform first looks to the uncertainty to determine the decimal place to which the value and uncertainty should be rounded and displayed. sciform succeeds if the uncertainty is non-zero and finite. If the uncertainty is zero or non-finite (recall non-finite includes nan) then it falls back to the value to determine the decimal place to which to round. Typically sciform is configured to round to one or two digits of uncertainty, or use the PDG rounding convention. This means the value will be rounded the same. However, this is a little strange because, for example, the PDG rules are meant to apply to uncertainty, not values.
This issue proposes a new option called fallback_ndigits which instructs sciform how to behave in this fallback scenario. Options would be
It's not so strange for PDG rounding to be applied to values alone. It's just a rounding algorithm that outputs to round to 1 or 2 sig figs.
Without any such fallback feature the user could easily write two of their own Formatters, detect if their uncertainty is zero or non-finite and select which formatter to use based on that.
One general way this approach could be wrapped intosciform is to have an entire fallback formatter. In the event the uncertainty is invalid the fallback formatter could be merged into the main formatter and the result could be used.
It's an open question which formatter should be used if both the uncertainty and value are invalid.
I don't think this functionality needs to be built into sciform at this time. #196 provides an example implementation for a helper function users could write themselves. Closing this issue for now.
Right now for value/uncertainty formatting
sciform
first looks to the uncertainty to determine the decimal place to which the value and uncertainty should be rounded and displayed.sciform
succeeds if the uncertainty is non-zero and finite. If the uncertainty is zero or non-finite (recall non-finite includes nan) then it falls back to the value to determine the decimal place to which to round. Typicallysciform
is configured to round to one or two digits of uncertainty, or use the PDG rounding convention. This means the value will be rounded the same. However, this is a little strange because, for example, the PDG rules are meant to apply to uncertainty, not values.This issue proposes a new option called
fallback_ndigits
which instructssciform
how to behave in this fallback scenario. Options would beAutoDigits
, show as many digits as necessary for the float to round trip.NoFallback
, in this mode the regularndigits
option is used.None
, use the global default settingThe text was updated successfully, but these errors were encountered: