sciform 0.39.0__tar.gz → 0.39.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sciform-0.39.0 → sciform-0.39.1}/CHANGELOG.rst +11 -0
- {sciform-0.39.0 → sciform-0.39.1}/PKG-INFO +3 -2
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/formatting/number_formatting.py +8 -2
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform.egg-info/PKG-INFO +3 -2
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_val_unc_fsml.py +21 -0
- {sciform-0.39.0 → sciform-0.39.1}/.github/workflows/python-package.yml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/.github/workflows/python-publish.yml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/.gitignore +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/.pre-commit-config.yaml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/.readthedocs.yaml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/CODE_OF_CONDUCT.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/CONTRIBUTING.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/LICENSE +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/README.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/coverage_feature.toml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/coverage_unit.toml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/Makefile +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/make.bat +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/requirements.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/_static/css/custom.css +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/api.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/conf.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/examples.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/exp replacement.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/fsml.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/index.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/options.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/project.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/docs/source/usage.rst +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/data/fit_data.json +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/fit_plot_no_sciform.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/fit_plot_with_sciform.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/jupyter_output_example.ipynb +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/outputs/fit_plot_no_sciform.png +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/outputs/fit_plot_no_sciform_table.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/outputs/fit_plot_with_sciform.png +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/outputs/fit_plot_with_sciform_table.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/examples/outputs/jupyter_output.png +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/pyproject.toml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/ruff.toml +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/setup.cfg +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/api/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/api/formatted_number.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/api/formatter.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/api/global_configuration.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/api/scinum.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/exp_translations.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/exponents.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/grouping.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/make_strings.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/numbers.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/format_utils/rounding.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/formatting/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/formatting/fsml.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/formatting/output_conversion.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/formatting/parser.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/conversion.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/finalized_options.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/global_options.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/input_options.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/option_types.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/populated_options.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform/options/validation.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform.egg-info/SOURCES.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform.egg-info/dependency_links.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform.egg-info/requires.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/src/sciform.egg-info/top_level.txt +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_global_config.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_options_printout.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_output_conversion.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_sci_num.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_separators.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_string_parser.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_val_formatter.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_val_fsml.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/feature/test_val_unc_formatter.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/test_docstrings.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/__init__.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/test_exp_translations.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/test_exponent_utils.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/test_grouping.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/test_make_strings.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/test_number_utils.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/format_utils/test_rounding_utils.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/test_invalid_options.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/test_options_strings.py +0 -0
- {sciform-0.39.0 → sciform-0.39.1}/tests/unit/test_validation.py +0 -0
@@ -12,6 +12,17 @@ Unreleased
|
|
12
12
|
documentation
|
13
13
|
`changelog <https://sciform.readthedocs.io/en/latest/project.html#changelog>`_.
|
14
14
|
|
15
|
+
0.39.1 (2025-09-11)
|
16
|
+
-------------------
|
17
|
+
|
18
|
+
Fixed
|
19
|
+
-----
|
20
|
+
|
21
|
+
* Fixed a value/uncertainty formatting bug when one of the value/uncertainty is 0, the
|
22
|
+
other one is 0 or non-finite and a positive fixed exponent is used. In this case the
|
23
|
+
zero values would erroneously be formatted with trailing zeros.
|
24
|
+
[`#205 <https://github.com/jagerber48/sciform/issues/205>`_]
|
25
|
+
|
15
26
|
----
|
16
27
|
|
17
28
|
0.39.0 (2024-11-15)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: sciform
|
3
|
-
Version: 0.39.
|
3
|
+
Version: 0.39.1
|
4
4
|
Summary: A package for formatting numbers into scientific formatted strings.
|
5
5
|
Author-email: Justin Gerber <justin.gerber48@gmail.com>
|
6
6
|
Project-URL: homepage, https://github.com/jagerber48/sciform
|
@@ -41,6 +41,7 @@ Provides-Extra: all
|
|
41
41
|
Requires-Dist: sciform[docs]; extra == "all"
|
42
42
|
Requires-Dist: sciform[test]; extra == "all"
|
43
43
|
Requires-Dist: sciform[examples]; extra == "all"
|
44
|
+
Dynamic: license-file
|
44
45
|
|
45
46
|
.. container::
|
46
47
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
from dataclasses import replace
|
6
6
|
from decimal import Decimal
|
7
|
+
from math import isfinite
|
7
8
|
from typing import TYPE_CHECKING, cast
|
8
9
|
|
9
10
|
from sciform.api.formatted_number import FormattedNumber
|
@@ -177,7 +178,7 @@ def format_num(num: Decimal, options: FinalizedOptions) -> str:
|
|
177
178
|
return result
|
178
179
|
|
179
180
|
|
180
|
-
def format_val_unc(val: Decimal, unc: Decimal, options: FinalizedOptions) -> str:
|
181
|
+
def format_val_unc(val: Decimal, unc: Decimal, options: FinalizedOptions) -> str: # noqa: PLR0915
|
181
182
|
"""Format value/uncertainty pair according to input options."""
|
182
183
|
exp_mode = options.exp_mode
|
183
184
|
|
@@ -259,7 +260,12 @@ def format_val_unc(val: Decimal, unc: Decimal, options: FinalizedOptions) -> str
|
|
259
260
|
ndigits that will be used for separate digits-past-the-decimal rounding for the
|
260
261
|
value and uncertainty.
|
261
262
|
"""
|
262
|
-
|
263
|
+
if (isfinite(val) and val_rounded != 0) or (
|
264
|
+
isfinite(unc_rounded) and unc_rounded != 0
|
265
|
+
):
|
266
|
+
ndigits = -round_digit + exp_val
|
267
|
+
else:
|
268
|
+
ndigits = 0
|
263
269
|
|
264
270
|
val_mantissa, _ = get_mantissa_exp(
|
265
271
|
val_rounded,
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: sciform
|
3
|
-
Version: 0.39.
|
3
|
+
Version: 0.39.1
|
4
4
|
Summary: A package for formatting numbers into scientific formatted strings.
|
5
5
|
Author-email: Justin Gerber <justin.gerber48@gmail.com>
|
6
6
|
Project-URL: homepage, https://github.com/jagerber48/sciform
|
@@ -41,6 +41,7 @@ Provides-Extra: all
|
|
41
41
|
Requires-Dist: sciform[docs]; extra == "all"
|
42
42
|
Requires-Dist: sciform[test]; extra == "all"
|
43
43
|
Requires-Dist: sciform[examples]; extra == "all"
|
44
|
+
Dynamic: license-file
|
44
45
|
|
45
46
|
.. container::
|
46
47
|
|
@@ -671,10 +671,31 @@ class TestValUncFSML(unittest.TestCase):
|
|
671
671
|
|
672
672
|
def test_zero(self):
|
673
673
|
cases_list = [
|
674
|
+
(
|
675
|
+
(0, 0),
|
676
|
+
[
|
677
|
+
("!3f", "0 ± 0"),
|
678
|
+
("!3e", "(0 ± 0)e+00"),
|
679
|
+
("ex-2", "(0 ± 0)e-02"),
|
680
|
+
("ex+2", "(0 ± 0)e+02"),
|
681
|
+
],
|
682
|
+
),
|
674
683
|
(
|
675
684
|
(0, float("nan")),
|
676
685
|
[
|
677
686
|
("!3f", "0 ± nan"),
|
687
|
+
("!3e", "(0 ± nan)e+00"),
|
688
|
+
("ex-2", "(0 ± nan)e-02"),
|
689
|
+
("ex+2", "(0 ± nan)e+02"),
|
690
|
+
],
|
691
|
+
),
|
692
|
+
(
|
693
|
+
(float("inf"), 0),
|
694
|
+
[
|
695
|
+
("!3f", "inf ± 0"),
|
696
|
+
("!3e", "(inf ± 0)e+00"),
|
697
|
+
("ex-2", "(inf ± 0)e-02"),
|
698
|
+
("ex+2", "(inf ± 0)e+02"),
|
678
699
|
],
|
679
700
|
),
|
680
701
|
]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|