diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03b2a8d..5be5c45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,7 @@ jobs: - "3.9" - "3.10" # not 3.10 which truncates to 3.1 - "3.11" + - "3.12" max-parallel: 5 steps: @@ -68,6 +69,7 @@ jobs: - name: Run tests with pytest & coverage run: | + set -vxeuo pipefail coverage run --concurrency=thread --parallel-mode -m pytest -vvv . coverage combine coverage report --precision 3 diff --git a/CHANGES.rst b/CHANGES.rst index 9971eb9..0037940 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,10 +20,20 @@ Change History release expected TBA - 1.0.6 (developing) - ****************** +1.0.6 (developing) +****************** - release expected TBA +release expected TBA + +Fixes +-------------- + +* Fixed *math domain error* in standard deviation functions. + +Maintenance +-------------- + +* Add Python 3.12 1.0.5 ****** diff --git a/pyproject.toml b/pyproject.toml index c124e5a..792da1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +requires = ["setuptools>=61", "setuptools_scm[toml]>=8"] build-backend = "setuptools.build_meta" [tool.black] line-length = 115 -target-version = ['py311'] +target-version = ['py312'] include = '\.pyi?$' exclude = ''' diff --git a/pysumreg/__init__.py b/pysumreg/__init__.py index 46f5f67..6d254aa 100644 --- a/pysumreg/__init__.py +++ b/pysumreg/__init__.py @@ -18,7 +18,7 @@ # ----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2014-2022, Pete R. Jemian +# :copyright: (c) 2014-2024, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. # diff --git a/pysumreg/sum_registers.py b/pysumreg/sum_registers.py index 28a0278..ee0f8b7 100644 --- a/pysumreg/sum_registers.py +++ b/pysumreg/sum_registers.py @@ -180,7 +180,9 @@ def stddev_x(self): .. math:: \sigma_x^2 = {{\sum{x^2} - \bar{x}\sum{x}} \over {n-1}} """ - return math.sqrt((self.XX - self.mean_x * self.X) / (self.n - 1)) + numerator = max(0, self.XX - self.mean_x * self.X) + denominator = self.n - 1 + return math.sqrt(numerator / denominator) @property def stddev_y(self): @@ -189,7 +191,9 @@ def stddev_y(self): .. math:: \sigma_y^2 = {{\sum{y^2} - \bar{y}\sum{y}} \over {n-1}} """ - return math.sqrt((self.YY - self.mean_y * self.Y) / (self.n - 1)) + numerator = max(0, self.YY - self.mean_y * self.Y) + denominator = self.n - 1 + return math.sqrt(numerator / denominator) @property def slope(self): diff --git a/setup.cfg b/setup.cfg index e29b72c..9ef9abb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,7 @@ profile=black [metadata] name = pysumreg -copyright = 2022-2022, Pete R. Jemian +copyright = 2014-2024, Pete R. Jemian description = Statistics of list of (x, y) pairs from calculator-style summation registers. description_file = README.md description_file_content_type = text/markdown @@ -54,6 +54,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Scientific/Engineering Topic :: Scientific/Engineering :: Astronomy Topic :: Scientific/Engineering :: Bio-Informatics @@ -70,7 +71,7 @@ classifiers = # python_requires = >=3.8 packages = find: setup_requires = - setuptools_scm[toml]>=6.2 + setuptools_scm[toml]>=8 # Specify any package dependencies below. Examples shown # None diff --git a/setup.py b/setup.py index 5266a05..fd0bef4 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ # ----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: prjemian@gmail.com -# :copyright: (c) 2014-2022, Pete R. Jemian +# :copyright: (c) 2014-2024, Pete R. Jemian # # Distributed under the terms of the Creative Commons Attribution 4.0 International Public License. #