Skip to content

0.35.0

Compare
Choose a tag to compare
@jagerber48 jagerber48 released this 17 Feb 06:56
· 165 commits to main since this release
288a3f1

0.35.0 (2024-02-16)

Added

  • The Formatter formatting method and the SciNum constructor now accept formatted inputs for the value and optional uncertainty inputs. E.g. formatter("123.456(7)e-03") or SciNum("24 +/- 2") are now valid inputs. [#104]
  • Added the paren_uncertainties_trim option.
    The previous behavior was paren_uncertainties_trim=True. Now paren_uncertainties_trim=False allows a more verbose presentation of the uncertainty in paren_uncertainty mode in which leading zeros and separator characters are not stripped from the string. E.g. paren_uncertainties_trim=True will give
    123.002 3(21)
    while paren_uncertainties_trim=False will give
    123.002 3(0.002 1)
  • Added value and uncertainty attributes to the FormattedNumber class.
  • Added badge for Zenodo.

Removed

  • [BREAKING] Removed the paren_uncertainties_separators option. This option made it possible (when False) to optionally strip all separator characters, including the decimal separator, from the uncertainty in paren_uncertainty mode. This lead to the possibility of value/uncertainty pairs like
    123 456.789 8 ± 123.456 7
    being represented as
    123 456.789 8(1234567)
    sciform will now display this as
    123 456.789 8(123.456 7)
    if paren_uncertainty_strip=False or
    123 456.789 8(123.4567)
    if paren_uncertainty_strip=True, but always retaining the decimal separator. In most cases many fewer significant digits of the uncertainty are displayed and the resulting outputs don't look as egregious when the decimal separator is stripped. Nonetheless, given that more outputs look better when the decimal is retained and that there is no official BIPM guidance on how parentheses should handle cases when the uncertainty digits span decimal or other separator characters, sciform will not presently provide an option to strip the decimal separator character.

Changed

  • Previously, when using paren_uncertainty=True, redundant parentheses were included around the value and uncertainty numbers if there was an ASCII exponent (e.g. e+02) or in percent formatting mode. E.g. outputs would look like (32.4(1.2))e+02 or (32.4(1.2))%. Now these redundant parentheses are excluded so outputs look like 32.4(1.2)e+02 or 32.4(1.2)%. This is consistent with how the uncertainties package handles these cases. The extra parentheses were originally included for increased clarity, but the extra parentheses only clutter the output and there is sufficient clarity without them. This change eliminates an issue where the redundant parentheses were erroneously included or excluded after LaTeX/HTML/ASCII output conversion. [#145]

Fixed

  • Previously, when formatting individual Decimal input values, the values were always normalized at an early stage in formatting. This meant that even if ndigits=AutoDigits then Decimal("1.0") would be formatted the same as Decimal("1.00"). However, for value/uncertainty formatting, Decimal input to the uncertainty was not necessarily normalized at an early stage. This meant that with ndigits=AutoDigits, an uncertainty of Decimal("1.0") would be formatted to the tenths decimal place while an uncertainty of Decimal("1.00") would be formatted to the hundredths place. This behavior was inconsistent and undocumented. Now all Decimal inputs are immediately normalized before any formatting. [#148]
  • Fixed the behavior around the sign symbols for zero and non-finite inputs. Previously 0 was treated as positive for the sake of resolving its sign symbol, the sign of infinite numbers was preserved but +inf did not respect the "+" and " " sign modes, and nan never had a sign but also never had an extra character added for "+" or " " sign modes. Now both 0 and nan are treated as having no sign. In both "+" and " " sign modes 0 and nan are prepended by a space. The sign of infinite numbers is retained as before, but now formatting of these numbers respects the sign mode. [#147]