Accepting request 899444 from devel:languages:python:numeric

OBS-URL: https://build.opensuse.org/request/show/899444
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2021-06-11 20:30:48 +00:00 committed by Git OBS Bridge
commit b20946ac29
7 changed files with 34 additions and 385 deletions

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
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>

View File

@ -20,19 +20,13 @@
%define skip_python2 1
%define skip_python36 1
Name: python-sherpa
Version: 4.13.0
Version: 4.13.1
Release: 0
Summary: Modeling and fitting package for scientific data analysis
License: GPL-3.0-only
URL: https://github.com/sherpa/sherpa/
Source: https://github.com/sherpa/sherpa/archive/%{version}.tar.gz#/sherpa-%{version}.tar.gz
Patch1: reproducible.patch
# PATCH-FIX-UPSTREAM - https://github.com/sherpa/sherpa/issues/970
Patch2: sherpa-fix-aarch64.patch
# PATCH-FIX-UPSTREAM sherpa-numpy-1.20.patch badshah400@gmail.com - Fix test errors with numpy 1.20 [https://github.com/sherpa/sherpa/pull/1092]
Patch3: sherpa-numpy-1.20.patch
# PATCH-FIX-UPSTREAM sherpa-mpl-3.4.patch -- https://github.com/sherpa/sherpa/pull/1125
Patch4: sherpa-mpl-3.4.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy-devel}
BuildRequires: %{python_module setuptools}

View File

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

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

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

View File

@ -1,25 +0,0 @@
diff -purN sherpa-4.12.1.orig/sherpa/utils/src/cephes/mconf.h sherpa-4.12.1/sherpa/utils/src/cephes/mconf.h
--- sherpa-4.12.1.orig/sherpa/utils/src/cephes/mconf.h 2020-06-26 20:27:19.000000000 +0200
+++ sherpa-4.12.1/sherpa/utils/src/cephes/mconf.h 2020-10-14 14:44:53.565068804 +0200
@@ -173,6 +173,10 @@ typedef struct
/* Define to support tiny denormal numbers, else undefine. */
#define DENORMAL 1
+/* https://github.com/sherpa/sherpa/issues/970 */
+#define NOINFINITIES
+#define NONANS
+
/* Define to ask for infinity support, else undefine. */
#define INFINITIES 1
#ifdef NOINFINITIES
--- sherpa-4.12.1.orig/sherpa/tests/test_fit_unit.py 2020-06-26 20:27:19.000000000 +0200
+++ sherpa-4.12.1/sherpa/tests/test_fit_unit.py 2020-10-14 15:08:34.798995079 +0200
@@ -1867,7 +1867,7 @@ def test_fit_single(stat, usestat, usesy
assert fit.method.name == 'levmar'
fr = fit.fit()
assert fr.succeeded
- assert_almost_equal(fr.statval, finalstat)
+ assert fr.statval == pytest.approx(finalstat, rel=7e-5)
@pytest.mark.parametrize("stat,usestat,usesys,finalstat", [

View File

@ -1,150 +0,0 @@
From 0187ded7223bbaded8022a28561182846b17ceb3 Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Tue, 13 Apr 2021 16:29:45 -0400
Subject: [PATCH 1/2] matlpotlib 3.4 has removed drawstyle from axes.errorbar
The drawstyle argument has now been removed from some commands -
this appears to just be the axes.errorbar function - in matplotlib
version 3.4.
---
sherpa/plot/pylab_backend.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Index: sherpa-4.13.0/sherpa/plot/pylab_backend.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/plot/pylab_backend.py
+++ sherpa-4.13.0/sherpa/plot/pylab_backend.py
@@ -1,6 +1,6 @@
#
-# Copyright (C) 2010, 2015, 2017, 2019, 2020
-# Smithsonian Astrophysical Observatory
+# Copyright (C) 2010, 2015, 2017, 2019, 2020, 2021
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -316,7 +316,6 @@ def histo(xlo, xhi, y, yerr=None, title=
color=color,
alpha=alpha,
linestyle='',
- drawstyle=drawstyle,
marker=marker,
markersize=markersize,
markerfacecolor=markerfacecolor,
@@ -446,7 +445,6 @@ def plot(x, y, yerr=None, xerr=None, tit
objs = axes.errorbar(x, y, yerr, xerr,
color=color,
linestyle=linestyle,
- drawstyle=drawstyle,
marker=marker,
markersize=markersize,
markerfacecolor=markerfacecolor,
Index: sherpa-4.13.0/sherpa/astro/ui/tests/test_astro_ui_plot.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/astro/ui/tests/test_astro_ui_plot.py
+++ sherpa-4.13.0/sherpa/astro/ui/tests/test_astro_ui_plot.py
@@ -1,5 +1,6 @@
#
-# Copyright (C) 2019, 2020 Smithsonian Astrophysical Observatory
+# Copyright (C) 2019, 2020, 2021
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -1168,7 +1169,8 @@ def test_img_contour_function_kwarg(clea
for i, ax in enumerate(axes, 1):
- assert ax.get_geometry() == (2, 2, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 2, w, w)
assert ax.get_xscale() == 'linear'
assert ax.get_yscale() == 'linear'
Index: sherpa-4.13.0/sherpa/ui/tests/test_ui_plot.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/ui/tests/test_ui_plot.py
+++ sherpa-4.13.0/sherpa/ui/tests/test_ui_plot.py
@@ -1,5 +1,6 @@
#
-# Copyright (C) 2019, 2020 Smithsonian Astrophysical Observatory
+# Copyright (C) 2019, 2020, 2021
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -1113,7 +1114,7 @@ def test_plot_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == ''
assert ax.xaxis.get_label().get_text() == 'x'
assert ax.yaxis.get_label().get_text() == 'y'
@@ -1127,7 +1128,7 @@ def test_plot_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == 'Model'
assert ax.xaxis.get_label().get_text() == 'x'
assert ax.yaxis.get_label().get_text() == 'y'
@@ -1179,7 +1180,8 @@ def test_plot_multiple(session):
'Data / Model']),
1):
- assert ax.get_geometry() == (2, 3, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 3, w, w)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x'
assert ax.yaxis.get_label().get_text() == ylabel
@@ -1226,7 +1228,7 @@ def test_contour_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == ''
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1240,7 +1242,7 @@ def test_contour_single(session):
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == 'Model'
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1287,7 +1289,8 @@ def test_contour_multiple(session):
'Ratio of Data to Model']),
1):
- assert ax.get_geometry() == (2, 3, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 3, w, w)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1343,7 +1346,8 @@ def test_contour_xxx(plotfunc, title, pc
['', 'Residuals']),
1):
- assert ax.get_geometry() == (2, 1, i)
+ w = i - 1
+ assert ax.get_subplotspec().get_geometry() == (2, 1, w, w)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'
@@ -1352,7 +1356,7 @@ def test_contour_xxx(plotfunc, title, pc
assert len(fig.axes) == 1
ax = fig.axes[0]
- assert ax.get_geometry() == (1, 1, 1)
+ assert ax.get_subplotspec().get_geometry() == (1, 1, 0, 0)
assert ax.get_title() == title
assert ax.xaxis.get_label().get_text() == 'x0'
assert ax.yaxis.get_label().get_text() == 'x1'

View File

@ -1,200 +0,0 @@
From 1ca81268c560b712677f91c98c5481ef473bfa0e Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Sun, 31 Jan 2021 19:03:24 -0500
Subject: [PATCH 1/3] Whitelist np.bool/int/float warning from NumPy 1.20 in
tests
As well as white-listing the warnings I've had to tweak one set
of tests which was explicitly checking the warning messages
(and so needed to ignore the known warnings).
---
.../astro/tests/test_astro_data_swift_unit.py | 21 ++++++----
sherpa/conftest.py | 38 +++++++++++++++----
2 files changed, 43 insertions(+), 16 deletions(-)
Index: sherpa-4.13.0/sherpa/astro/tests/test_astro_data_swift_unit.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/astro/tests/test_astro_data_swift_unit.py
+++ sherpa-4.13.0/sherpa/astro/tests/test_astro_data_swift_unit.py
@@ -172,7 +172,12 @@ def test_read_pha_fails_rmf(make_data_pa
assert emsg in str(excinfo.value)
-def validate_replacement_warning(ws, rtype, label):
+def validate_replacement_warning(ws, rtype, label, is_known_warning):
+ """Check that there is one expected warning."""
+
+ # Filter out the "allowed" warnings.
+ #
+ ws = [w for w in ws if not is_known_warning(w)]
assert len(ws) == 1
w = ws[0]
@@ -185,7 +190,7 @@ def validate_replacement_warning(ws, rty
@requires_data
@requires_fits
-def test_read_arf(make_data_path):
+def test_read_arf(make_data_path, is_known_warning):
"""Can we read in a Swift ARF."""
infile = make_data_path(ARFFILE)
@@ -194,7 +199,7 @@ def test_read_arf(make_data_path):
warnings.simplefilter("always")
arf = io.read_arf(infile)
- validate_replacement_warning(ws, 'ARF', infile)
+ validate_replacement_warning(ws, 'ARF', infile, is_known_warning)
assert isinstance(arf, DataARF)
@@ -262,7 +267,7 @@ def test_read_arf_fails_rmf(make_data_pa
@requires_data
@requires_fits
-def test_read_rmf(make_data_path):
+def test_read_rmf(make_data_path, is_known_warning):
"""Can we read in a Swift RMF."""
infile = make_data_path(RMFFILE)
@@ -271,7 +276,7 @@ def test_read_rmf(make_data_path):
warnings.simplefilter("always")
rmf = io.read_rmf(infile)
- validate_replacement_warning(ws, 'RMF', infile)
+ validate_replacement_warning(ws, 'RMF', infile, is_known_warning)
assert isinstance(rmf, DataRMF)
@@ -362,7 +367,7 @@ def test_read_rmf_fails_arf(make_data_pa
@requires_data
@requires_fits
-def test_can_use_swift_data(make_data_path):
+def test_can_use_swift_data(make_data_path, is_known_warning):
"""A basic check that we can read in and use the Swift data.
Unlike the previous tests, that directly access the io module,
@@ -383,14 +388,14 @@ def test_can_use_swift_data(make_data_pa
warnings.simplefilter("always")
ui.load_rmf(rmffile)
- validate_replacement_warning(ws, 'RMF', rmffile)
+ validate_replacement_warning(ws, 'RMF', rmffile, is_known_warning)
arffile = make_data_path(ARFFILE)
with warnings.catch_warnings(record=True) as ws:
warnings.simplefilter("always")
ui.load_arf(arffile)
- validate_replacement_warning(ws, 'ARF', arffile)
+ validate_replacement_warning(ws, 'ARF', arffile, is_known_warning)
assert ui.get_analysis() == 'energy'
Index: sherpa-4.13.0/sherpa/conftest.py
===================================================================
--- sherpa-4.13.0.orig/sherpa/conftest.py
+++ sherpa-4.13.0/sherpa/conftest.py
@@ -116,7 +116,12 @@ known_warnings = {
# Matplotlib version 2 warnings (from HTML notebook represention)
#
r'np.asscalar\(a\) is deprecated since NumPy v1.16, use a.item\(\) instead',
- r"Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working"
+ r"Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working",
+
+ # numpy 1.20 bool/float issue
+ r'`np.bool` is a deprecated alias for the builtin `bool`. .*',
+ r'`np.int` is a deprecated alias for the builtin `int`. .*',
+ r'`np.float` is a deprecated alias for the builtin `float`. .*',
],
UserWarning:
[
@@ -140,18 +145,11 @@ known_warnings = {
# See https://github.com/ContinuumIO/anaconda-issues/issues/6678
r"numpy.dtype size changed, may indicate binary " +
r"incompatibility. Expected 96, got 88",
- # I am getting the following from astropy with at least python 2.7 during the conda tests
- r"numpy.ufunc size changed, may indicate binary ",
+ # See https://github.com/numpy/numpy/pull/432
+ r"numpy.ufunc size changed",
+ # numpy 1.20 shows this in some tests
+ r"numpy.ndarray size changed, may indicate binary "
],
- VisibleDeprecationWarning:
- [],
-}
-
-# Since Sherpa now requires Python 3.5 at a minumum, the following
-# are always added, but kept as a separate dict and then merged
-# to make it clearer where they came from.
-#
-python3_warnings = {
ResourceWarning:
[
r"unclosed file .*king_kernel.txt.* closefd=True>",
@@ -166,17 +164,9 @@ python3_warnings = {
r"unclosed file .*/dev/null.* closefd=True>",
r"unclosed file .*table.txt.* closefd=True>",
],
- RuntimeWarning:
- [r"invalid value encountered in sqrt",
- # See https://github.com/ContinuumIO/anaconda-issues/issues/6678
- r"numpy.dtype size changed, may indicate binary " +
- r"incompatibility. Expected 96, got 88",
- # See https://github.com/numpy/numpy/pull/432
- r"numpy.ufunc size changed"
- ],
+ VisibleDeprecationWarning:
+ [],
}
-known_warnings.update(python3_warnings)
-
if have_astropy:
astropy_warnings = {
@@ -230,13 +220,8 @@ def capture_all_warnings(request, recwar
pytestconfig injected service for accessing the configuration data
"""
- def known(warning):
- message = warning.message
- for known_warning in known_warnings[type(message)]:
- pattern = re.compile(known_warning)
- if pattern.match(str(message)):
- return True
- return False
+
+ known = check_known_warning
def fin():
warnings = [w for w in recwarn.list
@@ -263,6 +248,28 @@ def capture_all_warnings(request, recwar
request.addfinalizer(fin)
+def check_known_warning(warning):
+ """Return True if this is an "allowed" warning."""
+
+ message = warning.message
+ for known_warning in known_warnings[type(message)]:
+ pattern = re.compile(known_warning)
+ if pattern.match(str(message)):
+ return True
+
+ return False
+
+
+@pytest.fixture
+def is_known_warning():
+ """Returns a function that returns True if this is an "allowed" warning.
+
+ It is not expected that this will see much use.
+ """
+
+ return check_known_warning
+
+
def pytest_configure(config):
"""
This configuration hook overrides the default mechanism for test data self-discovery, if the --test-data command line