commit de47efe118df226b817e54f75573c34c0e0804e6a7bdc68948e64f49465b705f Author: Benjamin Greiner Date: Fri Dec 6 17:18:04 2024 +0000 - 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 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=46 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/numpy2.patch b/numpy2.patch new file mode 100644 index 0000000..ea0c3cb --- /dev/null +++ b/numpy2.patch @@ -0,0 +1,297 @@ +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 new file mode 100644 index 0000000..ec4aec0 --- /dev/null +++ b/python-sherpa.changes @@ -0,0 +1,367 @@ +------------------------------------------------------------------- +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á + +- Add numpy2.patch to fix build with the new numpy + +------------------------------------------------------------------- +Wed May 29 12:53:04 UTC 2024 - John Paul Adrian Glaubitz + +- Update to 4.16.1: + * enhancements: + + minor plotting changes; add support for splitting model expression into + + additive components and plot the results; support of log scale axes for + + confidence plots; improved error messages for unavailable plot backends + + improved RMF plot display to allow choice of energy units + * documentation changes: + + updates to fake_pha documentation + + updates to install.rst to fix incorrect links and outdated version references + + updated read the docs documentation to match current code + * bug fixes: + + fixed multi-panel plot issue with Bokeh backend + +------------------------------------------------------------------- +Wed May 8 19:28:20 UTC 2024 - Atri Bhattacharya + +- Do not run tests in parallel to avoid random failures + (gh#sherpa/sherpa#2031). + +------------------------------------------------------------------- +Sun Feb 18 15:31:44 UTC 2024 - Ben Greiner + +- Skip python312: Requires setuptools < 60 and distutils + +------------------------------------------------------------------- +Fri Dec 15 03:54:30 UTC 2023 - Steve Kowalik + +- Update to 4.16.0: + * enhancements: + + the grouping commands like group_counts and group_snr now default to + only grouping within the noticed range of channels, which is a change + in behaviour + + new plotting backend: Users can now choose between matplotlib and + bokeh (experimental) support use of arbitrary python functions when + linking model parameters + + updates to fake_pha, save_all, allowing to write out RMF/ARF files + + get_plot_prefs and get_contour_prefs call to simplify access to the + plot and contour preferences + + implementation of RMFPlot and DataIMGPlot classes and associated UI + functions (plot_rmf, get_rmf_plot) + + update support for XSPEC to include version 12.13.1, allow XSPEC + table models which include the ESCALE parameter, and provide + experimental support for writing out XSPEC table models. + * changes to use the NumPy random generator API + * bug fixes: + + PHA source plot Y axis scaling (#1825) + + fix model display for grouped data (#1779, #1784) + + Change in the ordering of operations when grouping background PHA + datasets. (#1881) +- Drop patch numpy125.patch and numpy125-CI.patch: Included upstream. +- Skip a misbehaving test. + +------------------------------------------------------------------- +Thu Sep 7 12:24:59 UTC 2023 - Markéta Machová + +- Add upstream patches numpy125.patch and numpy125-CI.patch + +------------------------------------------------------------------- +Mon May 29 13:52:34 UTC 2023 - Dirk Müller + +- update to 4.15.1: + * further improvements to filtering/grouping including + reporting a filter change in the UI + * fake_pha can be called with a list of ARF/RMF names + * added linewidth option for line and histogram plots + * documentation changes: + * fixed broken URLs + * improved documentation for templates, plot_pvalue + * added documentation testing with doctestplus + * Infrastructure changes: + * dropped support for Python 3.8 + * experimental support of Python 3.11 + * supported versions of Xspec are 12.12.0 - 12.13.0 + * bug fixes: + * various updates to notice/ignore and group/ungroup code + * fixed issue with show_bkg + * fixed issue when binning values into a 1D histogram + * fixed cache errors with the TableModel class + +------------------------------------------------------------------- +Fri Jan 20 10:59:30 UTC 2023 - Ben Greiner + +- Update to 4.15.0 + * This release of Sherpa includes various enhancements, + documentation updates, bug fixes, and infrastructure changes. + ## Enhancements: + * Improved validation of arguments when creating Data objects: + - arrays sent to Data objects are now converted to ndarrays + - the independent axis is now made read-only + - the size of a data object is now fixed. + * Filter setting with notice/ignore are reported to the screen + for the users of the UI layer. + * Increased test coverage for plotting + ## Documentation changes: + * updated readthedocs to use pip and pytest instead of setup.py + * several updates to documentation, including updates to + fake_pha, calc_ftest, calc_mlr + ## Infrastructure changes: + * Drop support for Python 3.7 + * Updates to start creating Python 3.10 Conda packages. + * Use Numpy 1.20 for Python 3.8/3.9 and Numpy 1.21 for Python + 3.10. + * Moves toward PEP-517 with some distutils cleanup and more + configuration moved from setup.py to setup.cfg + * Various improvements to the GitHub Actions and GitLab workflows + ## Bug fixes: + * Ensure chi2xspecvar errors match XSPEC when 0 counts are + present during background subtraction + * Remove model instances from the global symbol table when clean + is called + * Addresses new warnings in the tests for Matplotlib 3.6.0 and + AstroPy 5.1 + * Minor copy and paste error in fake_pha docstring + * Test issues in test_fake_pha.py due to randomness + ## Caveats + * There are known issues (#1602, #1605, #1606) in the + histogram1d/histogram2d functions leading to failures which + were not fully addressed in this release (see the failed case + in the second histogram1d example). This is not the Sherpa core + functionality and numpy.histogram can be used if needed. +- Drop reproducible.patch: the patched fftw sources are not used in + this build. + +------------------------------------------------------------------- +Mon Aug 8 15:24:05 UTC 2022 - Ben Greiner + +- Sherpa requires a build with setuptools < 60: + * Use python3X bundled setuptools instead of distribution package + * Enable early skip_python311 because that bundles setuptools 62 + +------------------------------------------------------------------- +Thu Jun 9 20:00:36 UTC 2022 - Ben Greiner + +- Update to 4.14.1 + * enhancements: + - various plotting backend improvements + - various i/o backend improvements + - data object class improvements + - basic support for Xspec 12.12.1 + - beta support for python 3.10 + * documentation changes: + - updated build with CIAO documentation + - Add a missing class (DataOgipResponse) to the documentation + - Improves the docstrings for DataPHA + - fixed typos in plot docs + - clean up readthedocs issues such as missing bullets + * Infrastructure changes: + - updates for compatibility with Clang 12.0 + - updates to the regression tests + * bug fixes: + - Improve the FITS headers created when writing out a PHA file (to better match OGIP standards) + - addresses delete_model_component call failing if a key does not exist + - fixed issue with writing a PHA dataset as a table rather than a PHA file + - ensure FITS column access is case insensitive + - image handling and image coordinates + - Drop sherpa-pr1318-py310tests.patch fixed upstream + - Drop sherpa-pr1319-distutils-hack.patch fixed upstream + +------------------------------------------------------------------- +Fri Feb 4 17:05:32 UTC 2022 - Ben Greiner + +- Add sherpa-pr1318-py310tests.patch -- gh#sherpa/sherpa#1318 +- Skip two tests failing on non x86_64 due to floating point + precision +- Disable 32-bit ARM build +- Add sherpa-pr1319-distutils-hack.patch -- another attempt for + python310 compatibility (gh#sherpa/sherpa#1319) + +------------------------------------------------------------------- +Fri Dec 3 13:21:21 UTC 2021 - Guillaume GARDET + +- Update to 4.14.0: + * enhancements: + - filtering and grouping area for binned (1D) spectral data has been improved + with changes to the default behavior and many bug fixes resulting in changes + to the statistics, degrees-of-freedom and energy flux in comparison to the + previous version for the same data with the same filter. + - updates to allow users to change the hard limits of XSPEC model parameters + - the sample_flux routine now returns correct information for the clip column + * documentation changes: + - improved PHA simulation documentation + - improved Filtering and grouping of PHA data documentation + - added sherpa.image module documentation + - added section on running tests to developer docs + * Infrastructure Changes: + - updates to support Apple ARM + - update to support Xspec version 12.12 + - update fftw from version 3.3.8 to 3.3.9 + - clean up of compiler and sphinx warnings + - changes to support gcc 9.3.0 in conda defaults + - updates to support python 3.9 including readline 8.1 upgrade, numpy minimum + 1.19 (numpy 1.18 minimum for python 3.7/8) + - test infrastructure clean up and updates + * bug fixes: + - updates to fix several 'unable to parse region string: None' errors + - fix issue where save_all() of a loaded image with no region filter would fail + on reload + - fixed issue with plot_model() being called before notice or ignore could + lead to filters not getting applied + - fix to error out instead of crash when grouping data using an unsupported + method +- Drop upstream patch: + * sherpa-pr1227-astropy43.patch +- Refresh patch: + * reproducible.patch + +------------------------------------------------------------------- +Thu Aug 5 19:36:45 UTC 2021 - Ben Greiner + +- Add sherpa-pr1227-astropy43.patch in order to fix test failure + gh#sherpa/sherpa#1227 + +------------------------------------------------------------------- +Fri Jun 11 09:52:54 UTC 2021 - Guillaume GARDET + +- Update to 4.13.1: + * documentation changes: + - updates to documentation for TableModel, Notice2D, cache + support for evaluating models, and low level optimization code + - jupyter notebook uopdates + * Infrastructure Changes: + - the master branch has been migrated from master to main + - updates to support numpy 1.20 + - updates to support astropy 4.2.1 + - updates to support matplotlib 3.4 + - test infrastructure clean up and updates + * bug fixes: + - fix an issue with cache evaluation on 1D models using + integrated bins + - fix for aarch64 build issue + - fix to sherpa citation command + - fix to honor clearwindow setting for plot_source + - fix errors from save_data when the output file exists + - fix build issues using gcc 7.3 with -Werror=format-security + compilation flag + - fix for reg_proj and reg_unc erroring out when the min or max + arguments are tuples rather than lists +- Drop upstreamed patches: + * sherpa-fix-aarch64.patch + * sherpa-numpy-1.20.patch + * sherpa-mpl-3.4.patch + +------------------------------------------------------------------- +Sat Apr 24 18:40:06 UTC 2021 - Ben Greiner + +- Fix python3 flavor multibuild: + * Compile bundled libs for every flavor + * Fix bundled lib location configuration + * Use system fftw3 +- Enable tests with matplotlib and astropy +- Add sherpa-mpl-3.4.patch for Matplotlib 3.4 gh#sherpa/sherpa#1125 + +------------------------------------------------------------------- +Wed Feb 17 00:07:40 UTC 2021 - Atri Bhattacharya + +- Update to version 4.13.0: + * A few minor documentation updates. + * Version number update to coincide with CIAO version 4.13.0. +- Add sherpa-numpy-1.20.patch: Fix test errors with numpy 1.20 + [gh#sherpa/sherpa#/1092]; patch committed upstream. +- Disable python 3.6 flavour: dependency numpy not supported. + +------------------------------------------------------------------- +Wed Oct 14 13:39:10 UTC 2020 - Guillaume GARDET + +- Fix aarch64 build and test: + * sherpa-fix-aarch64.patch + +------------------------------------------------------------------- +Mon Sep 14 09:33:07 UTC 2020 - Atri Bhattacharya + +- Update to version 4.12.1: + - [gh#sherpa/sherpa#832] Support building with NumPy 1.19. + - [gh#sherpa/sherpa#781] Docs: fix typo in docstring for + calc_kcor. + - [gh#sherpa/sherpa#759] Revert the ARF cache added in #444, as + well as some of the related code changes, as they caused + problems with Analysis in wavelength space (e.g. + gh#sherpa/sherpa#746). + - [gh#sherpa/sherpa#756] + calculate_photon_flux/calculate_energy_flux fix and + improvement. + - [gh#sherpa/sherpa#747] reworked regrid to eval usr grid, but 0 + every where else. + - [gh#sherpa/sherpa#745] ensure that min/max limits are applied + to linked parameters before use. + - [gh#sherpa/sherpa#735] Remove ChIPS support. + - [gh#sherpa/sherpa#734] Change datastack + query_by_header_keyword to not error if keyword is missing. + - [gh#sherpa/sherpa#733] fix a bug with fit(cache=False) passing + the runtime option while fitting. + - [gh#sherpa/sherpa#732] Remove unused Python 2.7 compatibility + code. + - [gh#sherpa/sherpa#696] Support python 3.8. +- Drop already incorporated patches: + * python-sherpa-python3.8.patch. + * config_with_build.patch. + +------------------------------------------------------------------- +Tue May 19 09:28:01 UTC 2020 - Petr Gajdos + +- %python3_only -> %python_alternative + +------------------------------------------------------------------- +Thu Mar 12 12:56:22 UTC 2020 - Atri Bhattacharya + +- Add python-sherpa-python3.8.patch: Fix building with python3.8; + taken from upstream commit [gh#sherpa/sherpa#696]. +- Disbale bytecode generation when running tests. +- Remove hashbangs from non executable files. + +------------------------------------------------------------------- +Sat Jan 4 20:12:21 UTC 2020 - Bernhard Wiedemann + +- Add reproducible.patch to disable optimizing for build CPU + to make package build reproducible + +------------------------------------------------------------------- +Tue Jan 8 19:14:59 UTC 2019 - Todd R + +- initial version +- Add config_with_build.patch to make build step work + From: https://github.com/sherpa/sherpa/pull/714 diff --git a/python-sherpa.spec b/python-sherpa.spec new file mode 100644 index 0000000..163487c --- /dev/null +++ b/python-sherpa.spec @@ -0,0 +1,128 @@ +# +# spec file for package python-sherpa +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-sherpa +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 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 +BuildRequires: fftw3-devel +BuildRequires: flex +BuildRequires: gcc-c++ +BuildRequires: python-rpm-macros +BuildRequires: wcslib-devel +Requires: python-numpy +Requires(post): update-alternatives +Requires(postun): update-alternatives +ExcludeArch: %{ix86} %{arm} +# SECTION test requirements +BuildRequires: %{python_module pytest >= 8} +# doctestplus tests don’t look ready gh#sherpa/sherpa#1719 +# BuildRequires: %%{python_module pytest-doctestplus} +BuildRequires: %{python_module pytest-xdist} +BuildRequires: %{python_module pytest-xvfb} +# Highly recommended by upstream when building from source +BuildRequires: %{python_module astropy} +BuildRequires: %{python_module matplotlib} +# /SECTION +%python_subpackages + +%description +Sherpa is the CIAO modeling and fitting application. It enables the +user to construct models from definitions and fit those models to +data, using a variety of statistics and optimization methods. + +%prep +%autosetup -p1 -n sherpa-%{version} -a1 +sed -i -e 's|@_LIB@|%{_lib}|' setup.cfg helpers/sherpa_config.py +rm -r extern/fftw-* +# 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 # rebuild and install extern/ into build/ for every wheel +%$python_pyproject_wheel +rm -r extern +cp -r extern0 extern +} + +%install +%pyproject_install + +%python_clone -a %{buildroot}%{_bindir}/sherpa_test +%python_clone -a %{buildroot}%{_bindir}/sherpa_smoke +%python_expand %fdupes %{buildroot}%{$python_sitearch} + +%check +# avoid conftest import mismatch +mv sherpa sherpa_temp +export PYTHONPATH=$PWD/sherpa-test-data-%{version} +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 +# 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 +%python_install_alternative sherpa_test + +%postun +%python_uninstall_alternative sherpa_smoke +%python_uninstall_alternative sherpa_test + +%files %{python_files} +%doc README.md +%license LICENSE +%python_alternative %{_bindir}/sherpa_test +%python_alternative %{_bindir}/sherpa_smoke +%{python_sitearch}/sherpa +%{python_sitearch}/sherpa-%{version}.dist-info +%{python_sitearch}/stk.so +%{python_sitearch}/group.so + +%changelog diff --git a/sherpa-4.16.1.tar.gz b/sherpa-4.16.1.tar.gz new file mode 100644 index 0000000..32b90cc --- /dev/null +++ b/sherpa-4.16.1.tar.gz @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..908bc50 --- /dev/null +++ b/sherpa-test-data-4.16.1.tar.gz @@ -0,0 +1,3 @@ +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