1
0
forked from pool/python-sherpa

- Add numpy2.patch to fix build with the new numpy

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=44
This commit is contained in:
Matej Cepl 2024-09-12 07:17:27 +00:00 committed by Git OBS Bridge
commit 7ae14f2442
7 changed files with 791 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

297
numpy2.patch Normal file
View File

@ -0,0 +1,297 @@
From 72028ffe7ce2566a8f1e88c2c06d79cf5f0be9c1 Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
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 <https://pypi.org/project/pytest-doctestplus/>` is installed
(and it probably is because it's part of
`sphinx-astropy <https://pypi.org/project/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

331
python-sherpa.changes Normal file
View File

@ -0,0 +1,331 @@
-------------------------------------------------------------------
Thu Sep 12 06:18:49 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add numpy2.patch to fix build with the new numpy
-------------------------------------------------------------------
Wed May 29 12:53:04 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- 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 <badshah400@gmail.com>
- Do not run tests in parallel to avoid random failures
(gh#sherpa/sherpa#2031).
-------------------------------------------------------------------
Sun Feb 18 15:31:44 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Skip python312: Requires setuptools < 60 and distutils
-------------------------------------------------------------------
Fri Dec 15 03:54:30 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- 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á <mmachova@suse.com>
- Add upstream patches numpy125.patch and numpy125-CI.patch
-------------------------------------------------------------------
Mon May 29 13:52:34 UTC 2023 - Dirk Müller <dmueller@suse.com>
- 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 <code@bnavigator.de>
- 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 <code@bnavigator.de>
- 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 <code@bnavigator.de>
- 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 <code@bnavigator.de>
- 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 <guillaume.gardet@opensuse.org>
- 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 <code@bnavigator.de>
- 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 <guillaume.gardet@opensuse.org>
- 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 <code@bnavigator.de>
- 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 <badshah400@gmail.com>
- 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 <guillaume.gardet@opensuse.org>
- Fix aarch64 build and test:
* sherpa-fix-aarch64.patch
-------------------------------------------------------------------
Mon Sep 14 09:33:07 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- 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 <pgajdos@suse.com>
- %python3_only -> %python_alternative
-------------------------------------------------------------------
Thu Mar 12 12:56:22 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- 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 <bwiedemann@suse.com>
- Add reproducible.patch to disable optimizing for build CPU
to make package build reproducible
-------------------------------------------------------------------
Tue Jan 8 19:14:59 UTC 2019 - Todd R <toddrme2178@gmail.com>
- initial version
- Add config_with_build.patch to make build step work
From: https://github.com/sherpa/sherpa/pull/714

133
python-sherpa.spec Normal file
View File

@ -0,0 +1,133 @@
#
# 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/
#
# 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
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}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: bison
BuildRequires: fdupes
BuildRequires: fftw3-devel
BuildRequires: flex
BuildRequires: gcc-c++
BuildRequires: python-rpm-macros
Requires: python-numpy >= 1.19
Requires(post): update-alternatives
Requires(postun): update-alternatives
ExcludeArch: %{ix86} %{arm}
# SECTION test requirements
BuildRequires: %{python_module pytest >= 5}
# doctestplus tests dont 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
# 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
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
%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/
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}
%{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"
# 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)"
%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

3
sherpa-4.16.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ed4dfba237c4a6b60b4141e5619b53b25cb9e23be26cbcd7dbf00f8822d4669c
size 13738921

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c61443bf3530e42322cec52887cc2f170c2d5d9aaba2822e107da2626c269a1c
size 137775313