diff --git a/numpy2.patch b/numpy2.patch deleted file mode 100644 index ea0c3cb..0000000 --- a/numpy2.patch +++ /dev/null @@ -1,297 +0,0 @@ -From 72028ffe7ce2566a8f1e88c2c06d79cf5f0be9c1 Mon Sep 17 00:00:00 2001 -From: Douglas Burke -Date: Thu, 27 Jun 2024 12:42:52 -0400 -Subject: [PATCH 1/7] root: internal code cleanup - -The root-finding code is not documented well. This adds a small -wrapper routine to avoid some replicated code, but could we -just add this to transformed_quad_coef() instead - which is -not explicitly marked as an external routine? - -Several comments have been added for potential future work. ---- - sherpa/utils/__init__.py | 38 ++++++++++++++++++++++----------- - sherpa/utils/tests/test_root.py | 5 +++++ - 2 files changed, 30 insertions(+), 13 deletions(-) - -Index: sherpa-4.16.1/sherpa/utils/__init__.py -=================================================================== ---- sherpa-4.16.1.orig/sherpa/utils/__init__.py -+++ sherpa-4.16.1/sherpa/utils/__init__.py -@@ -1480,7 +1480,7 @@ def create_expr_integrated(lovals, hival - delim : str, optional - The separator for a range. - eps : number, optional -- The tolerance for comparing two numbers with sao_fcmp. -+ This value is unused. - - Raises - ------ -@@ -3389,6 +3389,7 @@ def bisection(fcn, xa, xb, fa=None, fb=N - return [[None, None], [[xa, fa], [xb, fb]], nfev[0]] - - -+# Is this used at all? - def quad_coef(x, f): - """ - p( x ) = f( xc ) + A ( x - xc ) + B ( x - xc ) ( x - xb ) -@@ -3461,6 +3462,11 @@ def transformed_quad_coef(x, f): - xa, xb, xc = x[0], x[1], x[2] - fa, fb, fc = f[0], f[1], f[2] - -+ # What happens if xb_xa or xc_xa are 0? That is, either -+ # xa == xb -+ # xc == xa -+ # Is the assumption that this just never happen? -+ # - xc_xb = xc - xb - fc_fb = fc - fb - A = fc_fb / xc_xb -@@ -3472,6 +3478,21 @@ def transformed_quad_coef(x, f): - return [B, C] - - -+def _get_discriminant(xa, xb, xc, fa, fb, fc): -+ """Wrap up code to transformed_quad_coef. -+ -+ This is common code that could be added to transformed_quad_coef -+ but is left out at the moment, to make it easier to look back -+ at code changes. There is no description of the parameters as -+ the existing code has none. -+ -+ """ -+ -+ [B, C] = transformed_quad_coef([xa, xb, xc], [fa, fb, fc]) -+ discriminant = max(C * C - 4.0 * fc * B, 0.0) -+ return B, C, discriminant -+ -+ - def demuller(fcn, xa, xb, xc, fa=None, fb=None, fc=None, args=(), - maxfev=32, tol=1.0e-6): - """A root-finding algorithm using Muller's method. -@@ -3578,10 +3599,7 @@ def demuller(fcn, xa, xb, xc, fa=None, f - - while nfev[0] < maxfev: - -- [B, C] = transformed_quad_coef([xa, xb, xc], [fa, fb, fc]) -- -- discriminant = max(C * C - 4.0 * fc * B, 0.0) -- -+ B, C, discriminant = _get_discriminant(xa, xb, xc, fa, fb, fc) - if is_nan(B) or is_nan(C) or \ - 0.0 == C + mysgn(C) * np.sqrt(discriminant): - return [[None, None], [[None, None], [None, None]], nfev[0]] -@@ -3685,11 +3703,7 @@ def new_muller(fcn, xa, xb, fa=None, fb= - if abs(fc) <= tol: - return [[xc, fc], [[xa, fa], [xb, fb]], nfev[0]] - -- tran = transformed_quad_coef([xa, xb, xc], [fa, fb, fc]) -- B = tran[0] -- C = tran[1] -- -- discriminant = max(C * C - 4.0 * fc * B, 0.0) -+ B, C, discriminant = _get_discriminant(xa, xb, xc, fa, fb, fc) - - xd = xc - 2.0 * fc / (C + mysgn(C) * np.sqrt(discriminant)) - -@@ -3827,11 +3841,9 @@ def apache_muller(fcn, xa, xb, fa=None, - oldx = 1.0e128 - while nfev[0] < maxfev: - -- tran = transformed_quad_coef([xa, xb, xc], [fa, fb, fc]) -- B = tran[0] -- C = tran[1] -- discriminant = max(C * C - 4.0 * fc * B, 0.0) -- den = mysgn(C) * np.sqrt(discriminant) -+ -+ B, C, discriminant = _get_discriminant(xa, xb, xc, fa, fb, fc) -+ den = np.sign(C) * np.sqrt(discriminant) - xplus = xc - 2.0 * fc / (C + den) - if C != den: - xminus = xc - 2.0 * fc / (C - den) -@@ -4008,9 +4020,13 @@ def zeroin(fcn, xa, xb, fa=None, fb=None - warning('%s: %s fa * fb < 0 is not met', __name__, fcn.__name__) - return [[None, None], [[None, None], [None, None]], nfev[0]] - -+ # With NumPy 2.0 the casting rules changed, leading to some -+ # behavioural changes in this code. The simplest fix was to -+ # make sure DBL_EPSILON did not remain a np.float32 value. -+ # - xc = xa - fc = fa -- DBL_EPSILON = np.finfo(np.float32).eps -+ DBL_EPSILON = float(np.finfo(np.float32).eps) - while nfev[0] < maxfev: - - prev_step = xb - xa -Index: sherpa-4.16.1/sherpa/utils/tests/test_root.py -=================================================================== ---- sherpa-4.16.1.orig/sherpa/utils/tests/test_root.py -+++ sherpa-4.16.1/sherpa/utils/tests/test_root.py -@@ -1,5 +1,6 @@ - # --# Copyright (C) 2007, 2016, 2018, 2020, 2021 Smithsonian Astrophysical Observatory -+# Copyright (C) 2007, 2016, 2018, 2020, 2021, 2024 -+# Smithsonian Astrophysical Observatory - # - # - # This program is free software; you can redistribute it and/or modify -@@ -27,7 +28,7 @@ from sherpa.utils import demuller, bisec - zeroin - - --def sqr(x, *args): -+def sqr(x): - return x * x - - -@@ -177,9 +178,7 @@ def prob34(x, *args): - return 1.0 / x - numpy.sin(x) + 1.0 - - --def prob35(x, *args): -- return (x*x - 2.0) * x - 5.0 -- -+# prob35 was the same as prob16 - - def prob36(x, *args): - return 1.0 / x - 1.0 -@@ -288,7 +287,6 @@ def demuller2(fcn, xa, xb, fa=None, fb=N - (prob32, 0.1, 0.9), - (prob33, 2.8, 3.1), - (prob34, -1.3, -0.5), -- (prob35, 2.0, 3.0), - (prob36, 0.5, 1.5), - (prob37, 0.5, 5.0), - (prob38, 1.0, 4.0), -Index: sherpa-4.16.1/sherpa/estmethods/__init__.py -=================================================================== ---- sherpa-4.16.1.orig/sherpa/estmethods/__init__.py -+++ sherpa-4.16.1/sherpa/estmethods/__init__.py -@@ -380,6 +380,11 @@ def covariance(pars, parmins, parmaxes, - eflag = est_success - ubound = diag[num] - lbound = -diag[num] -+ -+ # What happens when lbound or ubound is NaN? This is -+ # presumably why the code is written as it is below (e.g. a -+ # pass if the values can be added to pars[num]). -+ # - if pars[num] + ubound < parhardmaxes[num]: - pass - else: -@@ -1093,6 +1098,7 @@ def confidence(pars, parmins, parmaxes, - print_status(myblog.blogger.info, verbose, status_prefix[dirn], - delta_zero, lock) - -+ # This should really set the error flag appropriately. - error_flags.append(est_success) - - # -Index: sherpa-4.16.1/sherpa/fit.py -=================================================================== ---- sherpa-4.16.1.orig/sherpa/fit.py -+++ sherpa-4.16.1/sherpa/fit.py -@@ -277,7 +277,7 @@ class FitResults(NoNewAttributesAfterIni - - self.succeeded = results[0] - self.parnames = tuple(p.fullname for p in fit.model.get_thawed_pars()) -- self.parvals = tuple(results[1]) -+ self.parvals = tuple(float(r) for r in results[1]) - self.istatval = init_stat - self.statval = results[2] - self.dstatval = np.abs(results[2] - init_stat) -@@ -439,25 +439,28 @@ class ErrorEstResults(NoNewAttributesAft - self.sigma = fit.estmethod.sigma - self.percent = erf(self.sigma / sqrt(2.0)) * 100.0 - self.parnames = tuple(p.fullname for p in parlist if not p.frozen) -- self.parvals = tuple(p.val for p in parlist if not p.frozen) -+ self.parvals = tuple(float(p.val) for p in parlist if not p.frozen) - self.parmins = () - self.parmaxes = () -- self.nfits = 0 - - for i in range(len(parlist)): - if (results[2][i] == est_hardmin or -- results[2][i] == est_hardminmax): -+ results[2][i] == est_hardminmax or -+ results[0][i] is None # It looks like confidence does not set the flag -+ ): - self.parmins = self.parmins + (None,) - warning("hard minimum hit for parameter %s", self.parnames[i]) - else: -- self.parmins = self.parmins + (results[0][i],) -+ self.parmins = self.parmins + (float(results[0][i]),) - - if (results[2][i] == est_hardmax or -- results[2][i] == est_hardminmax): -+ results[2][i] == est_hardminmax or -+ results[1][i] is None # It looks like confidence does not set the flag -+ ): - self.parmaxes = self.parmaxes + (None,) - warning("hard maximum hit for parameter %s", self.parnames[i]) - else: -- self.parmaxes = self.parmaxes + (results[1][i],) -+ self.parmaxes = self.parmaxes + (float(results[1][i]),) - - self.nfits = results[3] - self.extra_output = results[4] -Index: sherpa-4.16.1/sherpa/astro/tests/test_astro.py -=================================================================== ---- sherpa-4.16.1.orig/sherpa/astro/tests/test_astro.py -+++ sherpa-4.16.1/sherpa/astro/tests/test_astro.py -@@ -206,7 +206,7 @@ def test_sourceandbg(parallel, run_threa - assert fit_results.numpoints == 1330 - assert fit_results.dof == 1325 - -- assert covarerr[0] == approx(0.012097, rel=1e-3) -+ assert covarerr[0] == approx(0.012097, rel=1.05e-3) - assert covarerr[1] == approx(0, rel=1e-3) - assert covarerr[2] == approx(0.000280678, rel=1e-3) - assert covarerr[3] == approx(0.00990783, rel=1e-3) -Index: sherpa-4.16.1/docs/developer/index.rst -=================================================================== ---- sherpa-4.16.1.orig/docs/developer/index.rst -+++ sherpa-4.16.1/docs/developer/index.rst -@@ -100,6 +100,17 @@ files and shows exactly which lines were - - Run doctests locally - -------------------- -+ -+.. note:: -+ The documentation tests are known to fail if NumPy 2.0 is installed -+ because the representation of NumPy types such as ``np.float64`` -+ have changed, leading to errors like:: -+ -+ Expected: -+ 2.5264364698914e-06 -+ Got: -+ np.float64(2.5264364698914e-06) -+ - If `doctestplus ` is installed - (and it probably is because it's part of - `sphinx-astropy `, -Index: sherpa-4.16.1/docs/install.rst -=================================================================== ---- sherpa-4.16.1.orig/docs/install.rst -+++ sherpa-4.16.1/docs/install.rst -@@ -34,17 +34,14 @@ Requirements - Sherpa has the following requirements: - - * Python 3.9 to 3.11 --* NumPy (the exact lower limit has not been determined, -- 1.21.0 or later will work, earlier version may work) -+* NumPy (version 2.0 should work but there has been limited testing) - * Linux or OS-X (patches to add Windows support are welcome) - - Sherpa can take advantage of the following Python packages - if installed: - - * :term:`Astropy`: for reading and writing files in -- :term:`FITS` format. The minimum required version of astropy -- is version 1.3, although only versions 2 and higher are used in testing -- (version 3.2 is known to cause problems, but version 3.2.1 is okay). -+ :term:`FITS` format. - * :term:`matplotlib`: for visualisation of - one-dimensional data or models, one- or two- dimensional - error analysis, and the results of Monte-Carlo Markov Chain diff --git a/python-sherpa.changes b/python-sherpa.changes index f531399..ec4aec0 100644 --- a/python-sherpa.changes +++ b/python-sherpa.changes @@ -1,3 +1,39 @@ +------------------------------------------------------------------- +Fri Dec 6 12:40:33 UTC 2024 - Ben Greiner + +- Update to 4.17.0 + * This release of Sherpa includes various enhancements, + documentation updates, bug fixes, and infrastructure changes. + ## enhancements: + * add calc_model and calc_source functions to return an evaluated + model/source array + * added wstat to plot_pvalue for the likelihood ratio test + * changed XSpec interface to use FunctionUtility C++ API instead + of XSFortran API + * improved support for PHA data starting at channel 0 and + handling of STAT_ERR and SYS_ERR PHA columns which are set to 0 + * improved guess for complex models + * improved filtering handling + * several updates to enhance plotting capabilities and layout + ## documentation changes: + * added paper citations to front page of Sherpa Read the Docs + documentation + * cleaned up various typos and URL references + * added examples such as use of set_x/y_label + ## infrastructure and testing: + * improved test coverage + * many updates to CI + * drop support for Python 3.9 and numpy <1.24 + * initial/experimental support for Python 3.12 + ## bug fixes: + * fixed an issue with plotting 1D data with asymmetric errs after + filter + * include the default identifier in save_all output if it has + been changed +- Drop numpy2.patch +- Add sherpa-pr2188-np2docstrings.patch gh#sherpa/sherpa#2188 +- Add sherpa-suse-libdir.patch + ------------------------------------------------------------------- Thu Sep 12 06:18:49 UTC 2024 - Markéta Machová diff --git a/python-sherpa.spec b/python-sherpa.spec index a468044..163487c 100644 --- a/python-sherpa.spec +++ b/python-sherpa.spec @@ -16,22 +16,23 @@ # -# requires distutils and setuptools < 60, which does not backport distutils. Unsuitable for python312 -# Track upstream progress in https://github.com/sherpa/sherpa/pull/1949 -%define skip_python312 1 Name: python-sherpa -Version: 4.16.1 +Version: 4.17.0 Release: 0 Summary: Modeling and fitting package for scientific data analysis License: GPL-3.0-only URL: https://github.com/sherpa/sherpa/ Source0: https://github.com/sherpa/sherpa/archive/%{version}.tar.gz#/sherpa-%{version}.tar.gz Source1: https://github.com/sherpa/sherpa-test-data/archive/refs/tags/%{version}.tar.gz#/sherpa-test-data-%{version}.tar.gz -# PATCH-FIX-UPSTREAM https://github.com/sherpa/sherpa/pull/2069 Allow the tests to pass with NumPy 2.0 -Patch: numpy2.patch -BuildRequires: %{python_module devel >= 3.8} -BuildRequires: %{python_module numpy-devel >= 1.19} +# PATCH-FIX-UPSTREAM sherpa-pr2188-np2docstrings.patch gh#sherpa/sherpa#2188 +Patch0: https://github.com/sherpa/sherpa/pull/2188.patch#/sherpa-pr2188-np2docstrings.patch +# PATCH-FIX-OPENSUSE sherpa-suse-libdir.patch -- UPSTREAM struggles with library paths, see e.g. gh#sherpa/sherpa#2159 code@bnavigator.de +Patch1: sherpa-suse-libdir.patch +BuildRequires: %{python_module devel >= 3.9} +BuildRequires: %{python_module numpy-devel} BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools >= 64} +BuildRequires: %{python_module tomli if %python-base < 3.11} BuildRequires: %{python_module wheel} BuildRequires: bison BuildRequires: fdupes @@ -39,14 +40,15 @@ BuildRequires: fftw3-devel BuildRequires: flex BuildRequires: gcc-c++ BuildRequires: python-rpm-macros -Requires: python-numpy >= 1.19 +BuildRequires: wcslib-devel +Requires: python-numpy Requires(post): update-alternatives Requires(postun): update-alternatives ExcludeArch: %{ix86} %{arm} # SECTION test requirements -BuildRequires: %{python_module pytest >= 5} +BuildRequires: %{python_module pytest >= 8} # doctestplus tests don’t look ready gh#sherpa/sherpa#1719 -# BuildRequires: %{python_module pytest-doctestplus} +# BuildRequires: %%{python_module pytest-doctestplus} BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module pytest-xvfb} # Highly recommended by upstream when building from source @@ -62,23 +64,19 @@ data, using a variety of statistics and optimization methods. %prep %autosetup -p1 -n sherpa-%{version} -a1 -# uncomment system libs https://sherpa.readthedocs.io/en/latest/install.html#fftw -sed -i "s|#fftw=local|fftw=local|" setup.cfg -sed -i "s|#fftw-include[-_]dirs.*$|fftw-include-dirs=%{_includedir}|" setup.cfg -sed -i "s|#fftw-lib-dirs.*$|fftw-lib-dirs=%{_libdir}|" setup.cfg -sed -i "s|#fftw-libraries|fftw-libraries|" setup.cfg +sed -i -e 's|@_LIB@|%{_lib}|' setup.cfg helpers/sherpa_config.py rm -r extern/fftw-* -# adjust the "install path" for stk.so and group.so for the build phase -sed -i "/pydir =/ s/libdir,/self.install_dir, '%{_lib}',/" helpers/sherpa_config.py +# Remove shebangs +sed -i "1{/\\/usr\\/bin\\/env python/d}" \ + sherpa/optmethods/ncoresde.py \ + sherpa/optmethods/ncoresnm.py \ + sherpa/optmethods/opt.py \ + sherpa/utils/akima.py %build cp -r extern extern0 -%{python_expand # -# use the python3X bundled setuptools instead of setuptools 60+ from the distribution -# https://sherpa.readthedocs.io/en/latest/install.html#building-from-source -mkdir -p build -$python -m venv build/buildenv --system-site-packages -build/buildenv/bin/pip wheel --no-deps --disable-pip-version-check --use-pep517 --no-build-isolation --progress-bar off --verbose . -w build/ +%{python_expand # rebuild and install extern/ into build/ for every wheel +%$python_pyproject_wheel rm -r extern cp -r extern0 extern } @@ -90,27 +88,24 @@ cp -r extern0 extern %python_clone -a %{buildroot}%{_bindir}/sherpa_smoke %python_expand %fdupes %{buildroot}%{$python_sitearch} -%{python_expand # REMOVE HASHBANGS FROM NON-EXEC FILES -sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresde.py -sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresnm.py -sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/opt.py -sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/utils/akima.py -} - %check # avoid conftest import mismatch mv sherpa sherpa_temp export PYTHONPATH=$PWD/sherpa-test-data-%{version} -# unclosed resource warnings by pytest although the tests use Path.to_text which should have closed it. -donttest="test_save" +donttest="test_Griewank" # precision issues %ifnarch x86_64 donttest+=" or (test_regproj and sherpa.plot.dummy_backend)" donttest+=" or (test_fit_single and Chi2XspecVar)" %endif -donttest+=" or test_Griewank" -# Tests must not be run in parallel https://github.com/sherpa/sherpa/issues/2031 -%pytest_arch -n1 --pyargs sherpa -k "not ($donttest)" +# gh#sherpa/sherpa#1923 +donttest+=" or test_integrate1d_basic_epsabs" +# flaky +donttest+=" or test_scaling_staterr" +donttest+=" or (test_Shekel7 and montecarlo)" +# docstring mismatches +python313_donttest=" or test_show_fit or test_modify_doctring or test_modelwrapper_str_with_doc" +%pytest_arch --pyargs sherpa -n auto --dist=loadgroup -r fE -k "not ($donttest ${$python_donttest})" %post %python_install_alternative sherpa_smoke diff --git a/sherpa-4.16.1.tar.gz b/sherpa-4.16.1.tar.gz deleted file mode 100644 index 32b90cc..0000000 --- a/sherpa-4.16.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ed4dfba237c4a6b60b4141e5619b53b25cb9e23be26cbcd7dbf00f8822d4669c -size 13738921 diff --git a/sherpa-4.17.0.tar.gz b/sherpa-4.17.0.tar.gz new file mode 100644 index 0000000..8c292bf --- /dev/null +++ b/sherpa-4.17.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f22f9dcb1b6326508d4142ea88931492972782fd292871ed942d1a212e70091a +size 13985328 diff --git a/sherpa-pr2188-np2docstrings.patch b/sherpa-pr2188-np2docstrings.patch new file mode 100644 index 0000000..c7bb771 --- /dev/null +++ b/sherpa-pr2188-np2docstrings.patch @@ -0,0 +1,248 @@ +From 388a7b3c87b8068c572041aeb57d2136a583e83b Mon Sep 17 00:00:00 2001 +From: Douglas Burke +Date: Tue, 29 Oct 2024 14:35:02 -0400 +Subject: [PATCH] TEST: address numpy 2 changes to output for docstring tests + +The str/repr output in NumPy 2 is much-more verbose and no-longet +matches the behaviour of the associated Python types. This breaks +a number of doctests, which had things like + + >>> (a == b).all() + True + >>> x.val + 3.4 + +which now fails for "textual" reasons even though the values are +the same. The simplest approach is just to print the values, so +we now have + + >>> print((a == b).all()) + True + >>> print(x.val) + 3.4 + +It is not ideal, but is a simple fix that works with versions 1 +and 2 of NumPy. +--- + sherpa/astro/data.py | 14 +++++++------- + sherpa/data.py | 8 ++++---- + sherpa/models/basic.py | 24 ++++++++++++------------ + sherpa/models/model.py | 2 +- + sherpa/models/parameter.py | 10 +++++----- + 5 files changed, 29 insertions(+), 29 deletions(-) + +diff --git a/sherpa/astro/data.py b/sherpa/astro/data.py +index 15f91fad72..87db02f617 100644 +--- a/sherpa/astro/data.py ++++ b/sherpa/astro/data.py +@@ -2563,9 +2563,9 @@ def _get_ebins(self, + >>> pha.ungroup() + >>> pha.units = 'channel' + >>> clo, chi = pha._get_ebins() +- >>> (clo == pha.channel).all() ++ >>> print((clo == pha.channel).all()) + True +- >>> (chi == clo + 1).all() ++ >>> print((chi == clo + 1).all()) + True + + >>> pha.units = 'energy' +@@ -2574,7 +2574,7 @@ def _get_ebins(self, + True + >>> elo[0:5] + array([0.00146, 0.0146 , 0.0292 , 0.0438 , 0.0584 ]) +- >>> (elo[1:] == ehi[:-1]).all() ++ >>> print((elo[1:] == ehi[:-1]).all()) + True + + >>> pha.group() +@@ -2587,7 +2587,7 @@ def _get_ebins(self, + + >>> pha.units = 'wave' + >>> wlo, whi = pha._get_ebins() +- >>> (wlo == glo).all() ++ >>> print((wlo == glo).all()) + True + """ + +@@ -2702,7 +2702,7 @@ def _get_indep(self, + array([0.1 , 0.11, 0.12, 0.13, 0.14]) + >>> ehi[0:5] + array([0.11 , 0.12 , 0.13 , 0.14 , 0.15000001]) +- >>> (elo[1:] == ehi[:-1]).all() ++ >>> print((elo[1:] == ehi[:-1]).all()) + True + + >>> pha.units = 'wave' +@@ -2711,7 +2711,7 @@ def _get_indep(self, + array([112.71289825, 103.32015848, 95.37245534, 88.56013348]) + >>> whi[0:4] + array([123.98418555, 112.71289825, 103.32015848, 95.37245534]) +- >>> (wlo[:-1] == whi[1:]).all() ++ >>> print((wlo[:-1] == whi[1:]).all()) + True + + """ +@@ -3425,7 +3425,7 @@ def apply_grouping(self, data, groupfunc=np.sum): + >>> v1 = pha.apply_grouping(dvals) + >>> pha.notice(1.2, 4.5) + >>> v2 = pha.apply_grouping(dvals) +- >>> np.all(v1 == v2) ++ >>> print(np.all(v1 == v2)) + True + + """ +diff --git a/sherpa/data.py b/sherpa/data.py +index 30fe9dbf0f..daf79d93e2 100644 +--- a/sherpa/data.py ++++ b/sherpa/data.py +@@ -2042,8 +2042,8 @@ def notice(self, + >>> x = np.arange(0.4, 2.6, 0.2) + >>> y = np.ones_like(x) + >>> d = Data1D('example', x, y) +- >>> d.x[0], d.x[-1] +- (0.4, 2.4000000000000004) ++ >>> print(d.x[0], d.x[-1]) ++ 0.4 2.4000000000000004 + >>> d.notice() + >>> d.get_filter(format='%.1f') + '0.4:2.4' +@@ -2326,8 +2326,8 @@ def notice(self, + >>> xlo, xhi = edges[:-1], edges[1:] + >>> y = np.ones_like(xlo) + >>> d = Data1DInt('example', xlo, xhi, y) +- >>> d.xlo[0], d.xhi[-1] +- (0.4, 2.400000000000001) ++ >>> print(d.xlo[0], d.xhi[-1]) ++ 0.4 2.400000000000001 + >>> d.get_filter(format='%.1f') + '0.4:2.4' + >>> d.notice(0.8, 1.9) +diff --git a/sherpa/models/basic.py b/sherpa/models/basic.py +index c1061e033a..d5280eda0f 100644 +--- a/sherpa/models/basic.py ++++ b/sherpa/models/basic.py +@@ -539,14 +539,14 @@ class Gauss1D(RegriddableModel1D): + >>> m1.pos, m2.pos = 10, 10 + >>> m1.ampl, m2.ampl = 10, 10 + >>> m1.fwhm, m2.fwhm = 5, 5 +- >>> m1(10) ++ >>> print(m1(10)) + 10.0 +- >>> m2(10) ++ >>> print(m2(10)) + 1.8788745573993026 + >>> m1.fwhm, m2.fwhm = 1, 1 +- >>> m1(10) ++ >>> print(m1(10)) + 10.0 +- >>> m2(10) ++ >>> print(m2(10)) + 9.394372786996513 + + The normalised version will sum to the amplitude when given +@@ -558,9 +558,9 @@ class Gauss1D(RegriddableModel1D): + >>> m1.fwhm, m2.fwhm = 12.2, 12.2 + >>> grid = np.arange(-90, 110, 0.01) + >>> glo, ghi = grid[:-1], grid[1:] +- >>> m1(glo, ghi).sum() ++ >>> print(m1(glo, ghi).sum()) + 129.86497637060958 +- >>> m2(glo, ghi).sum() ++ >>> print(m2(glo, ghi).sum()) + 10.000000000000002 + + """ +@@ -1923,12 +1923,12 @@ class TableModel(ArithmeticModel): + >>> d.staterror = [.2, .2, .2, .2, .2] + >>> tm1 = TableModel('tabmodel') + >>> tm1.load(None, [.6, .2, 1.1, .2, .5]) +- >>> tm1.ampl.val ++ >>> print(tm1.ampl.val) + 1.0 + >>> tm1.fold(d) + >>> fit1 = Fit(d, tm1) + >>> res1 = fit1.fit() +- >>> tm1.ampl.val ++ >>> print(tm1.ampl.val) + 1.9894736842102083 + + In this case the `fold` method is necessary, to ensure that the +@@ -1941,11 +1941,11 @@ class TableModel(ArithmeticModel): + >>> tm2 = TableModel('tabmodel') + >>> tm2.load(None, [.6, .2, 1.1, .2, .5]) + >>> tm2.fold(d) +- >>> tm2.ampl.val ++ >>> print(tm2.ampl.val) + 1.0 + >>> fit2 = Fit(d, tm2) + >>> res2 = fit2.fit() +- >>> tm2.ampl.val ++ >>> print(tm2.ampl.val) + 1.9866666666663104 + + The masking also holds if the notice or ignore method has been +@@ -1957,11 +1957,11 @@ class TableModel(ArithmeticModel): + >>> tm3 = TableModel('tabmodel') + >>> tm3.load(None, [.6, .2, 1.1, .2, .5]) + >>> tm3.fold(d) +- >>> tm3.ampl.val ++ >>> print(tm3.ampl.val) + 1.0 + >>> fit3 = Fit(d, tm3) + >>> res = fit3.fit() +- >>> tm3.ampl.val ++ >>> print(tm3.ampl.val) + 1.9866666666663104 + + """ +diff --git a/sherpa/models/model.py b/sherpa/models/model.py +index 5b89181d28..020ef7a30f 100644 +--- a/sherpa/models/model.py ++++ b/sherpa/models/model.py +@@ -152,7 +152,7 @@ + + >>> m1.ampl = 10 + >>> m2.ampl = 12 +- >>> m3.ampl.val ++ >>> print(m3.ampl.val) + 11.0 + >>> m3.ampl.link + +diff --git a/sherpa/models/parameter.py b/sherpa/models/parameter.py +index 3e1ee5215a..09af7c9bcf 100644 +--- a/sherpa/models/parameter.py ++++ b/sherpa/models/parameter.py +@@ -60,7 +60,7 @@ + + The `val` attribute is used to retrieve or change the parameter value: + +- >>> p.val ++ >>> print(p.val) + 2.0 + >>> p.val = 3 + +@@ -72,9 +72,9 @@ + for these are the 32-bit floating point maximum value, and it's + negative: + +- >>> p.max ++ >>> print(p.max) + 3.4028234663852886e+38 +- >>> p.min ++ >>> print(p.min) + -3.4028234663852886e+38 + + Setting a value outside this range will raise a +@@ -578,9 +578,9 @@ def _set_link(self, link: Optional[Parameter]) -> None: + >>> a = Parameter("mdl", "a", 2) + >>> b = Parameter("mdl", "b", 1) + >>> b.link = 10 - a +->>> a.val ++>>> print(a.val) + 2.0 +->>> b.val ++>>> print(b.val) + 8.0 + """) + diff --git a/sherpa-suse-libdir.patch b/sherpa-suse-libdir.patch new file mode 100644 index 0000000..4e97cf6 --- /dev/null +++ b/sherpa-suse-libdir.patch @@ -0,0 +1,63 @@ +diff -ur sherpa-4.17.0.orig/helpers/sherpa_config.py sherpa-4.17.0/helpers/sherpa_config.py +--- sherpa-4.17.0.orig/helpers/sherpa_config.py 2024-12-06 15:08:24.931381043 +0100 ++++ sherpa-4.17.0/helpers/sherpa_config.py 2024-12-06 16:38:48.368539972 +0100 +@@ -79,7 +79,7 @@ + def finalize_options(self): + incdir = os.path.join(self.install_dir, 'include') + libdir = os.path.join(self.install_dir, 'lib') +- pydir = os.path.join(libdir, f'python{version}', 'site-packages') ++ pydir = os.path.join(self.install_dir, '@_LIB@', f'python{version}', 'site-packages') + + if self.fftw_include_dirs is None: + self.fftw_include_dirs = incdir +@@ -144,7 +144,7 @@ + # normal installs: editable installs do not seem to care about + # the data_files setting. + # +- libdir = os.path.join('lib', ++ libdir = os.path.join('@_LIB@', + f'python{version}', + 'site-packages') + dfiles = [] +diff -ur sherpa-4.17.0.orig/setup.cfg sherpa-4.17.0/setup.cfg +--- sherpa-4.17.0.orig/setup.cfg 2024-12-06 15:08:24.934714481 +0100 ++++ sherpa-4.17.0/setup.cfg 2024-12-06 16:38:22.761072281 +0100 +@@ -20,15 +20,15 @@ + + # FFTW Library + # Uncomment to use a local installation +-#fftw=local ++fftw=local + + # If fftw=local uncomment the following lines and + # change the default location of libraries and the name + # of the library to be linked (usually fftw3) + # (include multiple values by separating them with spaces) +-#fftw-include_dirs=build/include +-#fftw-lib-dirs=build/lib +-#fftw-libraries=fftw3 ++fftw-include_dirs=include ++fftw-lib-dirs=@_LIB@ ++fftw-libraries=fftw3 + + # Region Library + # Uncomment to use a local installation +@@ -50,13 +50,10 @@ + #region-use-cxc-parser=False + + # WCS Subroutines +-# Uncomment to use a local installation +-#wcs=local +- +-# Uncomment and change default location if needed +-#wcs-include-dirs=build/include +-#wcs-lib-dirs=build/lib +-#wcs-libraries=wcs ++# sherpa is not compatible with wcs.h from system. Make it build and find vendored wcssubs in extern/ ++wcs-include-dirs=build/include ++wcs-lib-dirs=build/lib ++wcs-libraries=wcs + + + [build_sphinx] +Nur in sherpa-4.17.0: sherpa-suse-libdir.patch. diff --git a/sherpa-test-data-4.16.1.tar.gz b/sherpa-test-data-4.16.1.tar.gz deleted file mode 100644 index 908bc50..0000000 --- a/sherpa-test-data-4.16.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c61443bf3530e42322cec52887cc2f170c2d5d9aaba2822e107da2626c269a1c -size 137775313 diff --git a/sherpa-test-data-4.17.0.tar.gz b/sherpa-test-data-4.17.0.tar.gz new file mode 100644 index 0000000..3873a83 --- /dev/null +++ b/sherpa-test-data-4.17.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:215d3465c7a9d1b4307ec5eeb1f489a1251de9cee71e75e7162f491ad6037126 +size 137775257