Compare commits
55 Commits
Author | SHA256 | Date | |
---|---|---|---|
cbfafa462b | |||
78f7e6e3ac | |||
c3d2b4e05c | |||
417686b0dd | |||
45278798b7 | |||
45f8ea50e6 | |||
de47efe118 | |||
5258946ee6 | |||
7ae14f2442 | |||
9b4ec04117 | |||
e1bfbace1a | |||
3b8e0a2a55 | |||
da2366ddf7 | |||
603ff0adc1 | |||
0cf622083d | |||
1019696aa2 | |||
c21dedd431 | |||
898d30b293 | |||
7fcc21ca5f | |||
f50f69dd2d | |||
66ebaa0d74 | |||
d49bf1d729 | |||
8a95e0eb93 | |||
79996de9c9 | |||
e5206e31b5 | |||
f06ed7f1b8 | |||
2403224e1f | |||
6951b439d9 | |||
d0305603b7 | |||
6273b367ad | |||
e635a6f41a | |||
10e1774ca2 | |||
902ac9b232 | |||
ab152915d1 | |||
7ec0f4a8b5 | |||
f476be3318 | |||
80d61407f3 | |||
b20946ac29 | |||
e6b2dc634a | |||
b40171e0be | |||
f2cfdec32b | |||
ba8c84b5c1 | |||
14bc0b2cc6 | |||
a2e2b9a0e3 | |||
|
2e12bdc119 | ||
969376c5c6 | |||
|
9af53e5796 | ||
7eb9c82140 | |||
|
18219ebf9c | ||
bf66c7bfcb | |||
|
a9249c5ebb | ||
a84ca1a1bc | |||
|
edbc2bdf07 | ||
afae7db087 | |||
|
58ba0f8406 |
297
numpy2.patch
297
numpy2.patch
@@ -1,297 +0,0 @@
|
|||||||
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
|
|
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:ed4dfba237c4a6b60b4141e5619b53b25cb9e23be26cbcd7dbf00f8822d4669c
|
|
||||||
size 13738921
|
|
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:f22f9dcb1b6326508d4142ea88931492972782fd292871ed942d1a212e70091a
|
|
||||||
size 13985328
|
|
@@ -1,248 +0,0 @@
|
|||||||
From 388a7b3c87b8068c572041aeb57d2136a583e83b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Douglas Burke <dburke.gw@gmail.com>
|
|
||||||
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
|
|
||||||
<BinaryOpParameter '(gauss1d.ampl + gmdl.ampl) / 2'>
|
|
||||||
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
|
|
||||||
""")
|
|
||||||
|
|
@@ -1,86 +0,0 @@
|
|||||||
From 5e3d13df1c09134fe5b1cbb27bfc3559ef0641a0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Doug Burke <dburke@cfa.harvard.edu>
|
|
||||||
Date: Fri, 3 Jan 2025 16:46:36 -0500
|
|
||||||
Subject: [PATCH] TESTS: avoid matplotlib version differences (fix #2206)
|
|
||||||
|
|
||||||
The matlpotlib get_linestyles method can return
|
|
||||||
|
|
||||||
[(x, None)]
|
|
||||||
|
|
||||||
where x = None, 0.0, or np.float64(0.0) depending on matplotlib
|
|
||||||
version (and probably NumPy).
|
|
||||||
|
|
||||||
Since we don't really care too much here, just check the return
|
|
||||||
has length of 1, the first element has length of 2, and the
|
|
||||||
second element is None.
|
|
||||||
---
|
|
||||||
sherpa/astro/ui/tests/test_astro_ui_plot.py | 35 +++++++++++----------
|
|
||||||
1 file changed, 18 insertions(+), 17 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sherpa/astro/ui/tests/test_astro_ui_plot.py b/sherpa/astro/ui/tests/test_astro_ui_plot.py
|
|
||||||
index a6b7c07aa8..5a41d3ce4e 100644
|
|
||||||
--- a/sherpa/astro/ui/tests/test_astro_ui_plot.py
|
|
||||||
+++ b/sherpa/astro/ui/tests/test_astro_ui_plot.py
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
#
|
|
||||||
-# Copyright (C) 2019 - 2024
|
|
||||||
+# Copyright (C) 2019 - 2025
|
|
||||||
# Smithsonian Astrophysical Observatory
|
|
||||||
#
|
|
||||||
#
|
|
||||||
@@ -32,6 +32,7 @@
|
|
||||||
|
|
||||||
import copy
|
|
||||||
import logging
|
|
||||||
+
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
@@ -1843,15 +1844,15 @@ def test_pha1_plot_data_options(caplog, clean_astro_ui, requires_pylab,
|
|
||||||
|
|
||||||
assert len(coll.get_segments()) == 42
|
|
||||||
|
|
||||||
- # The return value depends on matplotlib version (>= 3.3
|
|
||||||
- # returns something). What has changed? Maybe this should
|
|
||||||
- # not be tested?
|
|
||||||
+ # The linestyles return value has changed with matplotib
|
|
||||||
+ # and NumPy version, so just check the second element
|
|
||||||
+ # and not the first (which can be None, 0.0, np.float64(0)).
|
|
||||||
#
|
|
||||||
- expected = [(None, None)]
|
|
||||||
- if matplotlib.__version__ >= '3.3.0':
|
|
||||||
- expected = [(0.0, None)]
|
|
||||||
-
|
|
||||||
- assert coll.get_linestyles() == expected
|
|
||||||
+ #
|
|
||||||
+ ls = coll.get_linestyles()
|
|
||||||
+ assert len(ls) == 1
|
|
||||||
+ assert len(ls[0]) == 2
|
|
||||||
+ assert ls[0][1] is None
|
|
||||||
|
|
||||||
# looks like the color has been converted to individual channels
|
|
||||||
# - e.g. floating-point values for R, G, B, and alpha.
|
|
||||||
@@ -2041,15 +2042,15 @@ def test_pha1_plot_fit_options(clean_astro_ui, requires_pylab, basic_pha1):
|
|
||||||
|
|
||||||
assert len(coll.get_segments()) == 42
|
|
||||||
|
|
||||||
- # The return value depends on matplotlib version (>= 3.3
|
|
||||||
- # returns something). What has changed? Maybe this should
|
|
||||||
- # not be tested?
|
|
||||||
+ # The linestyles return value has changed with matplotib
|
|
||||||
+ # and NumPy version, so just check the second element
|
|
||||||
+ # and not the first (which can be None, 0.0, np.float64(0)).
|
|
||||||
#
|
|
||||||
- expected = [(None, None)]
|
|
||||||
- if matplotlib.__version__ >= '3.3.0':
|
|
||||||
- expected = [(0.0, None)]
|
|
||||||
-
|
|
||||||
- assert coll.get_linestyles() == expected
|
|
||||||
+ #
|
|
||||||
+ ls = coll.get_linestyles()
|
|
||||||
+ assert len(ls) == 1
|
|
||||||
+ assert len(ls[0]) == 2
|
|
||||||
+ assert ls[0][1] is None
|
|
||||||
|
|
||||||
# looks like the color has been converted to individual channels
|
|
||||||
# - e.g. floating-point values for R, G, B, and alpha.
|
|
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:c61443bf3530e42322cec52887cc2f170c2d5d9aaba2822e107da2626c269a1c
|
|
||||||
size 137775313
|
|
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:215d3465c7a9d1b4307ec5eeb1f489a1251de9cee71e75e7162f491ad6037126
|
|
||||||
size 137775257
|
|
@@ -1,965 +0,0 @@
|
|||||||
From 0fafdd4522408e15561ae79a502b096317bb0d9e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Douglas Burke <dburke.gw@gmail.com>
|
|
||||||
Date: Fri, 6 Dec 2024 12:06:50 -0500
|
|
||||||
Subject: [PATCH 1/2] TEST: handle pytest 8.3.4 change in bool tests with
|
|
||||||
approx
|
|
||||||
|
|
||||||
Fix #2202
|
|
||||||
|
|
||||||
In pytest 8.3.3 and earlier
|
|
||||||
|
|
||||||
>>> import numpy as np; import pytest
|
|
||||||
>>> pytest.__version__
|
|
||||||
'8.3.3'
|
|
||||||
>>> np.ones(2, dtype=bool) == pytest.approx([True, True])
|
|
||||||
True
|
|
||||||
|
|
||||||
However, pytest 8.3.4 now causes this to fail
|
|
||||||
|
|
||||||
>>> import numpy as np; import pytest
|
|
||||||
>>> pytest.__version__
|
|
||||||
'8.3.4'
|
|
||||||
>>> np.ones(2, dtype=bool) == pytest.approx([True, True])
|
|
||||||
False
|
|
||||||
|
|
||||||
This is because of "pytest.approx considers boolean numeric types"
|
|
||||||
https://github.com/pytest-dev/pytest/issues/9353
|
|
||||||
|
|
||||||
The solution is to make the "expected" value be a ndarray, and so
|
|
||||||
|
|
||||||
>>> np.ones(2, dtype=bool) == pytest.approx(np.asarray([True, True]))
|
|
||||||
True
|
|
||||||
|
|
||||||
holds with both pytest 8.3.3 and 8.3.4.
|
|
||||||
|
|
||||||
So this commit basically goes through and updates the tests so that
|
|
||||||
we use a ndarray for boolean arrays.
|
|
||||||
|
|
||||||
An alternative would be to change from
|
|
||||||
|
|
||||||
assert got == pytest.approx(expected)
|
|
||||||
|
|
||||||
to something like
|
|
||||||
|
|
||||||
assert np.all(got == expected)
|
|
||||||
|
|
||||||
However, the error message when the array lengths are different or
|
|
||||||
an element is different are a **lot less** useful, and the change would
|
|
||||||
be even-more invasive than this change.
|
|
||||||
---
|
|
||||||
sherpa/astro/io/tests/test_io_pha.py | 2 +-
|
|
||||||
sherpa/astro/tests/test_astro_data.py | 43 +++---
|
|
||||||
sherpa/astro/tests/test_astro_data2.py | 131 +++++++++++-------
|
|
||||||
sherpa/astro/tests/test_astro_instrument.py | 3 +-
|
|
||||||
sherpa/astro/tests/test_astro_plot.py | 6 +-
|
|
||||||
sherpa/astro/ui/tests/test_astro_ui.py | 3 +-
|
|
||||||
sherpa/astro/ui/tests/test_astro_ui_unit.py | 9 +-
|
|
||||||
sherpa/astro/ui/tests/test_filtering.py | 8 +-
|
|
||||||
.../utils/tests/test_astro_utils_unit.py | 8 +-
|
|
||||||
sherpa/tests/test_data.py | 6 +-
|
|
||||||
sherpa/ui/tests/test_session.py | 3 +-
|
|
||||||
sherpa/ui/tests/test_ui_unit.py | 10 +-
|
|
||||||
sherpa/utils/tests/test_utils.py | 10 +-
|
|
||||||
13 files changed, 146 insertions(+), 96 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sherpa/astro/io/tests/test_io_pha.py b/sherpa/astro/io/tests/test_io_pha.py
|
|
||||||
index 84dcd4a98c..ceab1609a4 100644
|
|
||||||
--- a/sherpa/astro/io/tests/test_io_pha.py
|
|
||||||
+++ b/sherpa/astro/io/tests/test_io_pha.py
|
|
||||||
@@ -1504,7 +1504,7 @@ def test_write_pha_with_bad_quality(tmp_path):
|
|
||||||
counts = chans * 2
|
|
||||||
group = [1, -1, -1, 1, -1, 1, 1, 1, -1]
|
|
||||||
quality = [0, 5, 0, 0, 0, 0, 0, 2, 2]
|
|
||||||
- qfilt = [True, False] + [True] * 5 + [False] * 2
|
|
||||||
+ qfilt = np.asarray([True, False] + [True] * 5 + [False] * 2)
|
|
||||||
|
|
||||||
pha0 = DataPHA("qual", chans, counts, grouping=group,
|
|
||||||
quality=quality)
|
|
||||||
diff --git a/sherpa/astro/tests/test_astro_data.py b/sherpa/astro/tests/test_astro_data.py
|
|
||||||
index b4ab684ce5..9ca381763c 100644
|
|
||||||
--- a/sherpa/astro/tests/test_astro_data.py
|
|
||||||
+++ b/sherpa/astro/tests/test_astro_data.py
|
|
||||||
@@ -2367,7 +2367,7 @@ def test_pha_check_limit(ignore, lo, hi, evals):
|
|
||||||
pha.units = 'energy'
|
|
||||||
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 10)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(np.ones(10, dtype=bool))
|
|
||||||
|
|
||||||
func = pha.ignore if ignore else pha.notice
|
|
||||||
func(lo, hi)
|
|
||||||
@@ -2380,7 +2380,7 @@ def test_pha_check_limit(ignore, lo, hi, evals):
|
|
||||||
vin = True
|
|
||||||
|
|
||||||
c1, c2, c3 = evals
|
|
||||||
- expected = [vout] * c1 + [vin] * c2 + [vout] * c3
|
|
||||||
+ expected = np.asarray([vout] * c1 + [vin] * c2 + [vout] * c3)
|
|
||||||
assert pha.mask == pytest.approx(pha.get_mask())
|
|
||||||
assert pha.mask == pytest.approx(expected)
|
|
||||||
|
|
||||||
@@ -2449,7 +2449,7 @@ def test_pha_check_limit_channel(ignore, lo, hi, evals):
|
|
||||||
pha.units = 'channel'
|
|
||||||
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 10)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(np.ones(10, dtype=bool))
|
|
||||||
|
|
||||||
func = pha.ignore if ignore else pha.notice
|
|
||||||
func(lo, hi)
|
|
||||||
@@ -2462,7 +2462,7 @@ def test_pha_check_limit_channel(ignore, lo, hi, evals):
|
|
||||||
vin = True
|
|
||||||
|
|
||||||
c1, c2, c3 = evals
|
|
||||||
- expected = [vout] * c1 + [vin] * c2 + [vout] * c3
|
|
||||||
+ expected = np.asarray([vout] * c1 + [vin] * c2 + [vout] * c3)
|
|
||||||
assert pha.mask == pytest.approx(pha.get_mask())
|
|
||||||
assert pha.mask == pytest.approx(expected)
|
|
||||||
|
|
||||||
@@ -2672,7 +2672,9 @@ def test_is_mask_reset_pha(caplog):
|
|
||||||
# Pick a value somewhere within the independent axis
|
|
||||||
assert data.mask is True
|
|
||||||
data.ignore(None, 2)
|
|
||||||
- assert data.mask == pytest.approx([False, False, True])
|
|
||||||
+
|
|
||||||
+ mask = np.asarray([False, False, True])
|
|
||||||
+ assert data.mask == pytest.approx(mask)
|
|
||||||
|
|
||||||
# Change the independent axis, but to something of the same
|
|
||||||
# length.
|
|
||||||
@@ -2683,7 +2685,7 @@ def test_is_mask_reset_pha(caplog):
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
# The mask has *not* been cleared
|
|
||||||
- assert data.mask == pytest.approx([False, False, True])
|
|
||||||
+ assert data.mask == pytest.approx(mask)
|
|
||||||
|
|
||||||
|
|
||||||
def test_is_mask_reset_pha_channel(caplog):
|
|
||||||
@@ -2703,7 +2705,8 @@ def test_is_mask_reset_pha_channel(caplog):
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
# The mask has not been cleared
|
|
||||||
- assert data.mask == pytest.approx([False, False, True])
|
|
||||||
+ mask = np.asarray([False, False, True])
|
|
||||||
+ assert data.mask == pytest.approx(mask)
|
|
||||||
|
|
||||||
|
|
||||||
@requires_region
|
|
||||||
@@ -3376,9 +3379,11 @@ def test_pha_notice_bkg_id_none():
|
|
||||||
|
|
||||||
pha.notice(lo=2, bkg_id=None) # the default
|
|
||||||
|
|
||||||
- assert pha.mask == pytest.approx([False, True])
|
|
||||||
- assert b1.mask == pytest.approx([False, True])
|
|
||||||
- assert bup.mask == pytest.approx([False, True])
|
|
||||||
+ bfilt = np.asarray([False, True])
|
|
||||||
+
|
|
||||||
+ assert pha.mask == pytest.approx(bfilt)
|
|
||||||
+ assert b1.mask == pytest.approx(bfilt)
|
|
||||||
+ assert bup.mask == pytest.approx(bfilt)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("bkg_id", [1, "up"])
|
|
||||||
@@ -3394,13 +3399,15 @@ def test_pha_notice_bkg_id_scalar(bkg_id):
|
|
||||||
|
|
||||||
pha.notice(lo=2, bkg_id=bkg_id)
|
|
||||||
|
|
||||||
+ bfilt = np.asarray([False, True])
|
|
||||||
+
|
|
||||||
assert pha.mask is True
|
|
||||||
if bkg_id == 1:
|
|
||||||
- assert b1.mask == pytest.approx([False, True])
|
|
||||||
+ assert b1.mask == pytest.approx(bfilt)
|
|
||||||
assert bup.mask is True
|
|
||||||
else:
|
|
||||||
assert b1.mask is True
|
|
||||||
- assert bup.mask == pytest.approx([False, True])
|
|
||||||
+ assert bup.mask == pytest.approx(bfilt)
|
|
||||||
|
|
||||||
|
|
||||||
def test_pha_notice_bkg_id_array_all():
|
|
||||||
@@ -3415,9 +3422,11 @@ def test_pha_notice_bkg_id_array_all():
|
|
||||||
|
|
||||||
pha.notice(lo=2, bkg_id=["up", 1])
|
|
||||||
|
|
||||||
+ bfilt = np.asarray([False, True])
|
|
||||||
+
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert b1.mask == pytest.approx([False, True])
|
|
||||||
- assert bup.mask == pytest.approx([False, True])
|
|
||||||
+ assert b1.mask == pytest.approx(bfilt)
|
|
||||||
+ assert bup.mask == pytest.approx(bfilt)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("bkg_id", [1, "up"])
|
|
||||||
@@ -3433,13 +3442,15 @@ def test_pha_notice_bkg_id_array_subset(bkg_id):
|
|
||||||
|
|
||||||
pha.notice(lo=2, bkg_id=[bkg_id])
|
|
||||||
|
|
||||||
+ bfilt = np.asarray([False, True])
|
|
||||||
+
|
|
||||||
assert pha.mask is True
|
|
||||||
if bkg_id == 1:
|
|
||||||
- assert b1.mask == pytest.approx([False, True])
|
|
||||||
+ assert b1.mask == pytest.approx(bfilt)
|
|
||||||
assert bup.mask is True
|
|
||||||
else:
|
|
||||||
assert b1.mask is True
|
|
||||||
- assert bup.mask == pytest.approx([False, True])
|
|
||||||
+ assert bup.mask == pytest.approx(bfilt)
|
|
||||||
|
|
||||||
|
|
||||||
def get_img_spatial_mask():
|
|
||||||
diff --git a/sherpa/astro/tests/test_astro_data2.py b/sherpa/astro/tests/test_astro_data2.py
|
|
||||||
index b5eaf3b598..d6bdb19e49 100644
|
|
||||||
--- a/sherpa/astro/tests/test_astro_data2.py
|
|
||||||
+++ b/sherpa/astro/tests/test_astro_data2.py
|
|
||||||
@@ -97,7 +97,7 @@ def test_get_mask_is_none():
|
|
||||||
"""
|
|
||||||
pha = DataPHA('name', [1, 2, 3], [1, 1, 1])
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 3)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(np.asarray([True] * 3))
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_mask_is_none_when_all_filtered():
|
|
||||||
@@ -497,7 +497,7 @@ def test_288_a():
|
|
||||||
# with bools the use of approx is okay (it can tell the
|
|
||||||
# difference between 0 and 1, aka False and True).
|
|
||||||
#
|
|
||||||
- assert pha.mask == pytest.approx([True, False, True])
|
|
||||||
+ assert pha.mask == pytest.approx(np.asarray([True, False, True]))
|
|
||||||
|
|
||||||
|
|
||||||
def test_288_a_energy():
|
|
||||||
@@ -525,7 +525,7 @@ def test_288_a_energy():
|
|
||||||
# with bools the use of approx is okay (it can tell the
|
|
||||||
# difference between 0 and 1, aka False and True).
|
|
||||||
#
|
|
||||||
- assert pha.mask == pytest.approx([True, False, True])
|
|
||||||
+ assert pha.mask == pytest.approx(np.asarray([True, False, True]))
|
|
||||||
|
|
||||||
|
|
||||||
def test_288_b():
|
|
||||||
@@ -565,7 +565,7 @@ def test_288_b_energy():
|
|
||||||
assert pha.mask is True
|
|
||||||
pha.ignore(3.1, 4)
|
|
||||||
|
|
||||||
- assert pha.mask == pytest.approx([True, False, True])
|
|
||||||
+ assert pha.mask == pytest.approx(np.asarray([True, False, True]))
|
|
||||||
|
|
||||||
|
|
||||||
@requires_group
|
|
||||||
@@ -621,8 +621,8 @@ def test_416_a():
|
|
||||||
# grouped)
|
|
||||||
# - pha.get_mask() always returns the ungrouped mask
|
|
||||||
#
|
|
||||||
- mask_ungrouped = [False] * 3 + [True] * 3 + [False] * 4
|
|
||||||
- mask_grouped = [False] * 3 + [True] * 2 + [False] * 4
|
|
||||||
+ mask_ungrouped = np.asarray([False] * 3 + [True] * 3 + [False] * 4)
|
|
||||||
+ mask_grouped = np.asarray([False] * 3 + [True] * 2 + [False] * 4)
|
|
||||||
|
|
||||||
assert pha.mask == pytest.approx(mask_ungrouped)
|
|
||||||
assert pha.get_mask() == pytest.approx(mask_ungrouped)
|
|
||||||
@@ -685,7 +685,7 @@ def test_416_c():
|
|
||||||
pha.notice(4.5, 6.5)
|
|
||||||
|
|
||||||
# this should be ~pha.mask
|
|
||||||
- tabstops = [True] * 3 + [False] * 3 + [True] * 4
|
|
||||||
+ tabstops = np.asarray([True] * 3 + [False] * 3 + [True] * 4)
|
|
||||||
assert ~pha.mask == pytest.approx(tabstops)
|
|
||||||
|
|
||||||
assert pha.grouping is None
|
|
||||||
@@ -1688,10 +1688,13 @@ def test_pha_quality_all_bad_basic_checks():
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
+ all4 = np.ones(4, dtype=bool)
|
|
||||||
+ none4 = np.zeros(4, dtype=bool)
|
|
||||||
+
|
|
||||||
pha = DataPHA("q", [1, 2, 3, 4], [9, 0, 1, 64])
|
|
||||||
fvals = [12, 2, 7, 8]
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 4)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(all4)
|
|
||||||
assert pha.get_filter() == "1:4"
|
|
||||||
assert pha.get_x() == pytest.approx([1, 2, 3, 4])
|
|
||||||
assert pha.apply_filter(fvals) == pytest.approx(fvals)
|
|
||||||
@@ -1699,15 +1702,15 @@ def test_pha_quality_all_bad_basic_checks():
|
|
||||||
|
|
||||||
pha.quality = [2, 2, 2, 5]
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 4)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(all4)
|
|
||||||
assert pha.get_filter() == "1:4"
|
|
||||||
assert pha.get_x() == pytest.approx([1, 2, 3, 4])
|
|
||||||
assert pha.apply_filter(fvals) == pytest.approx(fvals)
|
|
||||||
assert pha.apply_grouping(fvals) == pytest.approx(fvals)
|
|
||||||
|
|
||||||
pha.ignore_bad()
|
|
||||||
- assert pha.mask == pytest.approx([False] * 4)
|
|
||||||
- assert pha.get_mask() == pytest.approx([False] * 4)
|
|
||||||
+ assert pha.mask == pytest.approx(none4)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(none4)
|
|
||||||
assert pha.get_filter() == ""
|
|
||||||
assert pha.get_x() == pytest.approx([1, 2, 3, 4])
|
|
||||||
assert pha.apply_filter(fvals) == pytest.approx([])
|
|
||||||
@@ -1742,7 +1745,7 @@ def test_pha_quality_change_mask(make_quality_pha):
|
|
||||||
pha.ignore_bad()
|
|
||||||
assert pha.mask is True
|
|
||||||
pha.mask = [1, 1, 0]
|
|
||||||
- assert pha.mask == pytest.approx([True, True, False])
|
|
||||||
+ assert pha.mask == pytest.approx(np.asarray([True, True, False]))
|
|
||||||
|
|
||||||
|
|
||||||
def test_pha_quality_change_mask_ungrouped(make_quality_pha):
|
|
||||||
@@ -1753,7 +1756,8 @@ def test_pha_quality_change_mask_ungrouped(make_quality_pha):
|
|
||||||
pha.ungroup()
|
|
||||||
assert pha.mask is True
|
|
||||||
pha.mask = [1, 1, 0, 1, 1, 0, 0, 1, 1]
|
|
||||||
- assert pha.mask == pytest.approx([True, True, False, True, True, False, False, True, True])
|
|
||||||
+ mask = np.asarray([True, True, False, True, True, False, False, True, True])
|
|
||||||
+ assert pha.mask == pytest.approx(mask)
|
|
||||||
|
|
||||||
|
|
||||||
def test_pha_quality_change_mask_fullsize(make_quality_pha):
|
|
||||||
@@ -1972,23 +1976,26 @@ def test_pha_quality_ignore_bad_clear_filter(make_quality_pha):
|
|
||||||
|
|
||||||
pha = make_quality_pha
|
|
||||||
|
|
||||||
+ mask0 = np.ones(9, dtype=bool)
|
|
||||||
assert pha.get_filter() == "1:9"
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 9)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask0)
|
|
||||||
assert pha.quality_filter is None
|
|
||||||
|
|
||||||
# channels 2,3 and 7-9 are "bad"
|
|
||||||
pha.ignore(hi=3)
|
|
||||||
|
|
||||||
+ mask = np.asarray([False] + [True] * 3)
|
|
||||||
+ mask_full = np.asarray([False] * 4 + [True] * 5)
|
|
||||||
assert pha.get_filter() == "5:9"
|
|
||||||
- assert pha.mask == pytest.approx([False] + [True] * 3)
|
|
||||||
- assert pha.get_mask() == pytest.approx([False] * 4 + [True] * 5)
|
|
||||||
+ assert pha.mask == pytest.approx(mask)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask_full)
|
|
||||||
assert pha.quality_filter is None
|
|
||||||
|
|
||||||
# This resets the previous filters
|
|
||||||
pha.ignore_bad()
|
|
||||||
|
|
||||||
- qflags = [True] * 1 + [False] * 2 + [True] * 3 + [False] * 3
|
|
||||||
+ qflags = np.asarray([True] * 1 + [False] * 2 + [True] * 3 + [False] * 3)
|
|
||||||
assert pha.get_filter() == "1:9"
|
|
||||||
assert pha.mask is True
|
|
||||||
assert pha.get_mask() == pytest.approx(qflags)
|
|
||||||
@@ -1996,16 +2003,19 @@ def test_pha_quality_ignore_bad_clear_filter(make_quality_pha):
|
|
||||||
|
|
||||||
pha.ignore(hi=3)
|
|
||||||
|
|
||||||
+ mask2 = np.asarray([False] + [True] * 2)
|
|
||||||
+ mask2_full = np.asarray([False] * 2 + [True] * 2)
|
|
||||||
+
|
|
||||||
assert pha.get_filter() == "5:6"
|
|
||||||
- assert pha.mask == pytest.approx([False] + [True] * 2)
|
|
||||||
- assert pha.get_mask() == pytest.approx([False] * 2 + [True] * 2)
|
|
||||||
+ assert pha.mask == pytest.approx(mask2)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask2_full)
|
|
||||||
assert pha.quality_filter == pytest.approx(qflags)
|
|
||||||
|
|
||||||
pha.ignore(lo=2, hi=4)
|
|
||||||
|
|
||||||
assert pha.get_filter() == "5:6"
|
|
||||||
- assert pha.mask == pytest.approx([False] + [True] * 2)
|
|
||||||
- assert pha.get_mask() == pytest.approx([False] * 2 + [True] * 2)
|
|
||||||
+ assert pha.mask == pytest.approx(mask2)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask2_full)
|
|
||||||
assert pha.quality_filter == pytest.approx(qflags)
|
|
||||||
|
|
||||||
# This removes the quality filter!
|
|
||||||
@@ -2013,7 +2023,7 @@ def test_pha_quality_ignore_bad_clear_filter(make_quality_pha):
|
|
||||||
|
|
||||||
assert pha.get_filter() == "1:9"
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 9)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask0)
|
|
||||||
assert pha.quality_filter is None
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2443,7 +2453,8 @@ def test_pha_change_quality_values(caplog):
|
|
||||||
pha.ignore_bad()
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- assert pha.quality_filter == pytest.approx([True] * 5 + [False] * 2)
|
|
||||||
+ qfilt = np.asarray([True] * 5 + [False] * 2)
|
|
||||||
+ assert pha.quality_filter == pytest.approx(qfilt)
|
|
||||||
assert pha.get_dep(filter=True) == pytest.approx([6])
|
|
||||||
assert pha.get_filter() == '1:7'
|
|
||||||
|
|
||||||
@@ -2456,7 +2467,7 @@ def test_pha_change_quality_values(caplog):
|
|
||||||
assert pha.quality == pytest.approx([0, 0, 0, 2, 2, 0, 0])
|
|
||||||
|
|
||||||
# Should quality filter be reset?
|
|
||||||
- assert pha.quality_filter == pytest.approx([True] * 5 + [False] * 2)
|
|
||||||
+ assert pha.quality_filter == pytest.approx(qfilt)
|
|
||||||
assert pha.get_dep(filter=True) == pytest.approx([4, 2])
|
|
||||||
assert pha.get_filter() == '1:7'
|
|
||||||
|
|
||||||
@@ -2499,14 +2510,14 @@ def test_pha_group_ignore_bad_then_filter(caplog):
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 7)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(np.ones(7, dtype=bool))
|
|
||||||
assert pha.get_filter() == '1:7'
|
|
||||||
assert pha.quality_filter is None
|
|
||||||
|
|
||||||
pha.ignore_bad()
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- qual_mask = [True] * 2 + [False] + [True] * 3 + [False]
|
|
||||||
+ qual_mask = np.asarray([True] * 2 + [False] + [True] * 3 + [False])
|
|
||||||
assert pha.mask is True
|
|
||||||
assert pha.get_mask() == pytest.approx(qual_mask)
|
|
||||||
assert pha.get_filter() == '1:7'
|
|
||||||
@@ -2518,8 +2529,10 @@ def test_pha_group_ignore_bad_then_filter(caplog):
|
|
||||||
pha.ignore(4, 5)
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- assert pha.mask == pytest.approx([True, False, True])
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 2 + [False] * 2 + [True])
|
|
||||||
+ mask = np.asarray([True, False, True])
|
|
||||||
+ mask_full = np.asarray([True] * 2 + [False] * 2 + [True])
|
|
||||||
+ assert pha.mask == pytest.approx(mask)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask_full)
|
|
||||||
assert pha.get_filter() == '1:2,6'
|
|
||||||
assert pha.quality_filter == pytest.approx(qual_mask)
|
|
||||||
assert pha.quality == pytest.approx([0, 0, 2, 0, 0, 0, 2])
|
|
||||||
@@ -2536,7 +2549,7 @@ def test_pha_group_ignore_bad_then_group(caplog):
|
|
||||||
pha.ignore_bad()
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- qual_mask = [True] * 2 + [False] + [True] * 3 + [False]
|
|
||||||
+ qual_mask = np.asarray([True] * 2 + [False] + [True] * 3 + [False])
|
|
||||||
assert pha.mask is True
|
|
||||||
assert pha.get_mask() == pytest.approx(qual_mask)
|
|
||||||
assert pha.quality_filter == pytest.approx(qual_mask)
|
|
||||||
@@ -2562,7 +2575,7 @@ def test_pha_group_ignore_bad_then_group(caplog):
|
|
||||||
pha.ignore_bad()
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- qual_mask = [True] + [False] + [True] * 5
|
|
||||||
+ qual_mask = np.asarray([True] + [False] + [True] * 5)
|
|
||||||
assert pha.mask is True
|
|
||||||
assert pha.get_mask() == pytest.approx(qual_mask)
|
|
||||||
assert pha.get_filter() == '1:7'
|
|
||||||
@@ -2584,7 +2597,7 @@ def test_pha_filter_ignore_bad_filter(caplog):
|
|
||||||
pha.ignore(lo=4, hi=4)
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- data_mask = [True] * 3 + [False] + [True] * 3
|
|
||||||
+ data_mask = np.asarray([True] * 3 + [False] + [True] * 3)
|
|
||||||
assert pha.mask == pytest.approx(data_mask)
|
|
||||||
assert pha.get_mask() == pytest.approx(data_mask)
|
|
||||||
assert pha.get_filter() == '1:3,5:7'
|
|
||||||
@@ -2596,7 +2609,8 @@ def test_pha_filter_ignore_bad_filter(caplog):
|
|
||||||
pha.group_counts(5)
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
|
|
||||||
- assert pha.mask == pytest.approx([True] * 2 + [False] + [True] * 3)
|
|
||||||
+ data_mask2 = np.asarray([True] * 2 + [False] + [True] * 3)
|
|
||||||
+ assert pha.mask == pytest.approx(data_mask2)
|
|
||||||
assert pha.get_mask() == pytest.approx(data_mask)
|
|
||||||
assert pha.get_filter() == '1:3,5:7'
|
|
||||||
assert pha.quality_filter is None
|
|
||||||
@@ -2612,7 +2626,7 @@ def test_pha_filter_ignore_bad_filter(caplog):
|
|
||||||
assert r.levelname == "WARNING"
|
|
||||||
assert r.getMessage() == "filtering grouped data with quality flags, previous filters deleted"
|
|
||||||
|
|
||||||
- new_mask = [True] * 2 + [False] + [True] * 4
|
|
||||||
+ new_mask = np.asarray([True] * 2 + [False] + [True] * 4)
|
|
||||||
assert pha.mask is True
|
|
||||||
assert pha.get_mask() == pytest.approx(new_mask)
|
|
||||||
assert pha.get_filter() == '1:7'
|
|
||||||
@@ -2624,8 +2638,10 @@ def test_pha_filter_ignore_bad_filter(caplog):
|
|
||||||
pha.ignore(lo=2, hi=2)
|
|
||||||
assert len(caplog.records) == 1
|
|
||||||
|
|
||||||
- assert pha.mask == pytest.approx([False] + [True] * 4)
|
|
||||||
- assert pha.get_mask() == pytest.approx([False] * 2 + [True] * 4)
|
|
||||||
+ mask3 = np.asarray([False] + [True] * 4)
|
|
||||||
+ mask3_full = np.asarray([False] * 2 + [True] * 4)
|
|
||||||
+ assert pha.mask == pytest.approx(mask3)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(mask3_full)
|
|
||||||
assert pha.get_filter() == '4:7'
|
|
||||||
assert pha.quality_filter == pytest.approx(new_mask)
|
|
||||||
assert pha.quality == pytest.approx([0, 0, 2, 0, 0, 0, 0])
|
|
||||||
@@ -2732,7 +2748,7 @@ def test_pha_ignore_bad_group_quality(caplog):
|
|
||||||
assert pha.get_filter(format="%.1f") == "3.0:7.0"
|
|
||||||
assert pha.get_noticed_channels() == pytest.approx(np.arange(3, 7))
|
|
||||||
|
|
||||||
- omask = [False] * 2 + [True] * 4 + [False] * 4
|
|
||||||
+ omask = np.asarray([False] * 2 + [True] * 4 + [False] * 4)
|
|
||||||
assert pha.mask == pytest.approx(omask)
|
|
||||||
assert pha.get_mask() == pytest.approx(omask)
|
|
||||||
|
|
||||||
@@ -2749,7 +2765,8 @@ def test_pha_ignore_bad_group_quality(caplog):
|
|
||||||
assert pha.get_dep(filter=False) == pytest.approx(y)
|
|
||||||
assert pha.get_dep(filter=True) == pytest.approx([3, 1])
|
|
||||||
|
|
||||||
- assert pha.mask == pytest.approx([False] * 2 + [True] * 2 + [False] * 4)
|
|
||||||
+ mask = np.asarray([False] * 2 + [True] * 2 + [False] * 4)
|
|
||||||
+ assert pha.mask == pytest.approx(mask)
|
|
||||||
assert pha.get_mask() == pytest.approx(omask)
|
|
||||||
|
|
||||||
grouping = [0, 0, 1, -1, -1, 1, 0, 0, 0, 0]
|
|
||||||
@@ -2788,7 +2805,7 @@ def test_pha_ignore_bad_group_quality(caplog):
|
|
||||||
# However, get_mask reflects the quality filter, so is all True
|
|
||||||
# except for the 6th element.
|
|
||||||
#
|
|
||||||
- single_bad = [True] * 5 + [False] + [True] * 4
|
|
||||||
+ single_bad = np.asarray([True] * 5 + [False] + [True] * 4)
|
|
||||||
assert pha.get_mask() == pytest.approx(single_bad)
|
|
||||||
|
|
||||||
# What about the quality fields?
|
|
||||||
@@ -2862,7 +2879,7 @@ def test_pha_ignore_bad_quality(groupit, caplog):
|
|
||||||
assert pha.get_dep(filter=False) == pytest.approx(y)
|
|
||||||
assert pha.get_dep(filter=True) == pytest.approx(y[2:6])
|
|
||||||
|
|
||||||
- mask = [False] * 2 + [True] * 4 + [False] * 4
|
|
||||||
+ mask = np.asarray([False] * 2 + [True] * 4 + [False] * 4)
|
|
||||||
assert pha.mask == pytest.approx(mask)
|
|
||||||
assert pha.get_mask() == pytest.approx(mask)
|
|
||||||
|
|
||||||
@@ -2900,7 +2917,7 @@ def test_pha_ignore_bad_quality(groupit, caplog):
|
|
||||||
|
|
||||||
# The mask changed (the channel=6 value is now filtered out).
|
|
||||||
#
|
|
||||||
- mask2 = [False] * 2 + [True] * 3 + [False] * 5
|
|
||||||
+ mask2 = np.asarray([False] * 2 + [True] * 3 + [False] * 5)
|
|
||||||
assert pha.mask == pytest.approx(mask2)
|
|
||||||
assert pha.get_mask() == pytest.approx(mask2)
|
|
||||||
|
|
||||||
@@ -3098,7 +3115,7 @@ def test_grouped_pha_mask(make_grouped_pha):
|
|
||||||
def test_grouped_pha_get_mask(make_grouped_pha):
|
|
||||||
"""What is the default get_mask value?"""
|
|
||||||
pha = make_grouped_pha
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 4 + [False])
|
|
||||||
+ assert pha.get_mask() == pytest.approx(np.asarray([True] * 4 + [False]))
|
|
||||||
|
|
||||||
|
|
||||||
def test_quality_pha_mask(make_quality_pha):
|
|
||||||
@@ -3115,11 +3132,13 @@ def test_quality_pha_mask(make_quality_pha):
|
|
||||||
def test_quality_pha_get_mask(make_quality_pha):
|
|
||||||
"""What is the default get_mask value?"""
|
|
||||||
pha = make_quality_pha
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 9)
|
|
||||||
+ m1 = np.ones(9, dtype=bool)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(m1)
|
|
||||||
|
|
||||||
pha.ignore_bad()
|
|
||||||
# This is a regression test
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] + [False] * 2 + [True] * 3 + [False] * 3)
|
|
||||||
+ m2 = np.asarray([True] + [False] * 2 + [True] * 3 + [False] * 3)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(m2)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("field,expected",
|
|
||||||
@@ -3576,8 +3595,10 @@ def test_pha_quality_filtered_apply_filter_invalid_size(vals, make_grouped_pha):
|
|
||||||
pha.ignore(hi=1)
|
|
||||||
|
|
||||||
# safety check to make sure we've excluded points
|
|
||||||
- assert pha.mask == pytest.approx([False, True])
|
|
||||||
- assert pha.get_mask() == pytest.approx([False, False, False, True])
|
|
||||||
+ m1 = np.asarray([False, True])
|
|
||||||
+ m2 = np.asarray([False, False, False, True])
|
|
||||||
+ assert pha.mask == pytest.approx(m1)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(m2)
|
|
||||||
|
|
||||||
with pytest.raises(DataErr,
|
|
||||||
match="^size mismatch between filtered data and array: 1 vs [28]$"):
|
|
||||||
@@ -4193,7 +4214,7 @@ def test_rmf_simple_filter_check(startchan, na, nb, nc):
|
|
||||||
assert rmf.apply_rmf(mvals) == pytest.approx(mvals)
|
|
||||||
|
|
||||||
selected = rmf.notice([startchan, startchan + 1, startchan + 2])
|
|
||||||
- expected = [False] * na + [True] * nb + [False] * nc
|
|
||||||
+ expected = np.asarray([False] * na + [True] * nb + [False] * nc)
|
|
||||||
assert selected == pytest.approx(expected)
|
|
||||||
|
|
||||||
# Drop everything but the selected values.
|
|
||||||
@@ -4295,7 +4316,7 @@ def test_rmf_offset_check_square(offset, caplog):
|
|
||||||
nchans = [offset + 2]
|
|
||||||
|
|
||||||
selected = rmf.notice(nchans)
|
|
||||||
- assert selected == pytest.approx([False, True, True, True])
|
|
||||||
+ assert selected == pytest.approx(np.asarray([False, True, True, True]))
|
|
||||||
|
|
||||||
expected2 = [0.0 * 0.2 + 0.6 * 0.4,
|
|
||||||
0.4 * 0.4 + 0.5 * 0.2,
|
|
||||||
@@ -4387,11 +4408,13 @@ def test_rmf_offset_check_rectangular(offset):
|
|
||||||
# - drop the last channel
|
|
||||||
nchans2 = offset + np.arange(0, 9)
|
|
||||||
|
|
||||||
+ mask = np.asarray([True] * 19 + [False])
|
|
||||||
+
|
|
||||||
selected2 = rmf.notice(nchans2)
|
|
||||||
- assert selected2 == pytest.approx([True] * 19 + [False])
|
|
||||||
+ assert selected2 == pytest.approx(mask)
|
|
||||||
|
|
||||||
selected2 = rmf.notice(offset + np.arange(0, 9))
|
|
||||||
- assert selected2 == pytest.approx([True] * 19 + [False])
|
|
||||||
+ assert selected2 == pytest.approx(mask)
|
|
||||||
|
|
||||||
expected2 = mvals[selected2] @ full_matrix[selected2, :]
|
|
||||||
got2 = rmf.apply_rmf(mvals[selected2])
|
|
||||||
@@ -4414,8 +4437,11 @@ def test_rmf_offset_check_rectangular(offset):
|
|
||||||
#
|
|
||||||
nchans3 = offset + np.asarray([4, 5, 6])
|
|
||||||
|
|
||||||
+ mask3 = np.asarray([True, False] * 2 + [True] * 10 +
|
|
||||||
+ [False] * 4 + [True, False])
|
|
||||||
+
|
|
||||||
selected3 = rmf.notice(nchans3)
|
|
||||||
- assert selected3 == pytest.approx([True, False] * 2 + [True] * 10 + [False] * 4 + [True, False])
|
|
||||||
+ assert selected3 == pytest.approx(mask3)
|
|
||||||
|
|
||||||
# It is not clear what the RMF application does here.
|
|
||||||
#
|
|
||||||
@@ -5970,7 +5996,7 @@ def test_group_xxx_tabtops_not_ndarray(asarray):
|
|
||||||
|
|
||||||
assert pha.get_y() == pytest.approx([2, 3, 4.5, 6])
|
|
||||||
assert pha.mask is True
|
|
||||||
- assert pha.get_mask() == pytest.approx([True] * 5)
|
|
||||||
+ assert pha.get_mask() == pytest.approx(np.ones(5, dtype=bool))
|
|
||||||
|
|
||||||
|
|
||||||
@requires_group
|
|
||||||
@@ -6002,7 +6028,8 @@ def test_group_xxx_tabstops_already_grouped():
|
|
||||||
assert pha.get_y(filter=True) == pytest.approx([12, 5.5, 4])
|
|
||||||
|
|
||||||
tstops = ~pha.mask
|
|
||||||
- assert tstops == pytest.approx([False, True, False, False, True])
|
|
||||||
+ mask = np.asarray([False, True, False, False, True])
|
|
||||||
+ assert tstops == pytest.approx(mask)
|
|
||||||
|
|
||||||
# Apply the mask as the tabStops (after inversion) where
|
|
||||||
# len(tstops) < nchannel but does match the number of groups.
|
|
||||||
diff --git a/sherpa/astro/tests/test_astro_instrument.py b/sherpa/astro/tests/test_astro_instrument.py
|
|
||||||
index b466e3fe5a..584fe371c6 100644
|
|
||||||
--- a/sherpa/astro/tests/test_astro_instrument.py
|
|
||||||
+++ b/sherpa/astro/tests/test_astro_instrument.py
|
|
||||||
@@ -712,7 +712,8 @@ def test_rmfmodelpha_delta_no_ebounds(analysis, caplog):
|
|
||||||
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
if analysis == "energy":
|
|
||||||
- assert pha.mask == pytest.approx([False, True, True, True, False])
|
|
||||||
+ expected = np.asarray([False, True, True, True, False])
|
|
||||||
+ assert pha.mask == pytest.approx(expected)
|
|
||||||
else:
|
|
||||||
assert not pha.mask.any()
|
|
||||||
|
|
||||||
diff --git a/sherpa/astro/tests/test_astro_plot.py b/sherpa/astro/tests/test_astro_plot.py
|
|
||||||
index 3f978728dc..a7df4cb1ee 100644
|
|
||||||
--- a/sherpa/astro/tests/test_astro_plot.py
|
|
||||||
+++ b/sherpa/astro/tests/test_astro_plot.py
|
|
||||||
@@ -227,8 +227,8 @@ def test_sourceplot_filtered(caplog, make_basic_datapha):
|
|
||||||
# The filtering should probably be this, but let's test the
|
|
||||||
# current behavior:
|
|
||||||
#
|
|
||||||
- # expected = [False] * 2 + [True] * 6 + [False] * 2
|
|
||||||
- expected = [False] * 3 + [True] * 5 + [False] * 2
|
|
||||||
+ # expected = np.asarray([False] * 2 + [True] * 6 + [False] * 2)
|
|
||||||
+ expected = np.asarray([False] * 3 + [True] * 5 + [False] * 2)
|
|
||||||
assert sp.mask == pytest.approx(expected)
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
check_sourceplot_energy(sp)
|
|
||||||
@@ -365,7 +365,7 @@ def test_sourceplot_wavelength_filtered(caplog, make_basic_datapha):
|
|
||||||
# Given the filtering for energy didn't quite match, DJB is
|
|
||||||
# slightly surprised this works.
|
|
||||||
#
|
|
||||||
- expected = [False] * 2 + [True] * 6 + [False] * 2
|
|
||||||
+ expected = np.asarray([False] * 2 + [True] * 6 + [False] * 2)
|
|
||||||
assert sp.mask == pytest.approx(expected)
|
|
||||||
assert len(caplog.records) == 0
|
|
||||||
check_sourceplot_wavelength(sp)
|
|
||||||
diff --git a/sherpa/astro/ui/tests/test_astro_ui.py b/sherpa/astro/ui/tests/test_astro_ui.py
|
|
||||||
index 26acfb96b0..f6872a3497 100644
|
|
||||||
--- a/sherpa/astro/ui/tests/test_astro_ui.py
|
|
||||||
+++ b/sherpa/astro/ui/tests/test_astro_ui.py
|
|
||||||
@@ -1962,7 +1962,8 @@ def check_pha_offset(specresp, matrix, energ_lo, energ_hi,
|
|
||||||
ui.notice(0.5, 0.8)
|
|
||||||
|
|
||||||
data = ui.get_data()
|
|
||||||
- assert data.mask == pytest.approx([False] * 3 + [True] * 3 + [False] * 3)
|
|
||||||
+ expected = np.asarray([False] * 3 + [True] * 3 + [False] * 3)
|
|
||||||
+ assert data.mask == pytest.approx(expected)
|
|
||||||
|
|
||||||
assert ui.get_filter(format="%.2f", delim="-") == "0.45-0.85"
|
|
||||||
|
|
||||||
diff --git a/sherpa/astro/ui/tests/test_astro_ui_unit.py b/sherpa/astro/ui/tests/test_astro_ui_unit.py
|
|
||||||
index 5a321fa733..a5c23dca45 100644
|
|
||||||
--- a/sherpa/astro/ui/tests/test_astro_ui_unit.py
|
|
||||||
+++ b/sherpa/astro/ui/tests/test_astro_ui_unit.py
|
|
||||||
@@ -2957,7 +2957,7 @@ def test_pha_set_filter_unmasked(simple_pha):
|
|
||||||
expected = [True, True, False, True, False]
|
|
||||||
ui.set_filter(expected)
|
|
||||||
|
|
||||||
- assert data.mask == pytest.approx(expected)
|
|
||||||
+ assert data.mask == pytest.approx(np.asarray(expected))
|
|
||||||
|
|
||||||
|
|
||||||
def test_pha_set_filter_unmasked_wrong(simple_pha):
|
|
||||||
@@ -2973,11 +2973,14 @@ def test_pha_set_filter_masked(simple_pha):
|
|
||||||
|
|
||||||
data = ui.get_data()
|
|
||||||
|
|
||||||
+ mask = np.asarray([True, False, False, False, True])
|
|
||||||
+ mask2 = np.asarray([True, False, True, False, True])
|
|
||||||
+
|
|
||||||
ui.ignore(4, 8)
|
|
||||||
- assert data.mask == pytest.approx([True, False, False, False, True])
|
|
||||||
+ assert data.mask == pytest.approx(mask)
|
|
||||||
|
|
||||||
ui.set_filter(np.asarray([True, False, True, False, False]))
|
|
||||||
- assert data.mask == pytest.approx([True, False, True, False, True])
|
|
||||||
+ assert data.mask == pytest.approx(mask2)
|
|
||||||
|
|
||||||
|
|
||||||
def test_pha_set_filter_masked_wrong(simple_pha):
|
|
||||||
diff --git a/sherpa/astro/ui/tests/test_filtering.py b/sherpa/astro/ui/tests/test_filtering.py
|
|
||||||
index 6e7c331456..eeb41cad3f 100644
|
|
||||||
--- a/sherpa/astro/ui/tests/test_filtering.py
|
|
||||||
+++ b/sherpa/astro/ui/tests/test_filtering.py
|
|
||||||
@@ -709,7 +709,7 @@ def test_ignore_bad_simple_comparison(caplog):
|
|
||||||
|
|
||||||
d = s.get_data(idval)
|
|
||||||
assert d.mask is True
|
|
||||||
- assert d.get_mask() == pytest.approx([True] * 5)
|
|
||||||
+ assert d.get_mask() == pytest.approx(np.ones(5, dtype=bool))
|
|
||||||
|
|
||||||
assert len(caplog.records) == 2
|
|
||||||
s.ignore_bad(1)
|
|
||||||
@@ -733,7 +733,7 @@ def test_ignore_bad_simple_comparison(caplog):
|
|
||||||
assert s.get_filter(1) == "1,3:5"
|
|
||||||
assert s.get_filter(2) == "1:5"
|
|
||||||
|
|
||||||
- mask = [True] + [False] + [True] * 3
|
|
||||||
+ mask = np.asarray([True] + [False] + [True] * 3)
|
|
||||||
d1 = s.get_data(1)
|
|
||||||
assert d1.mask == pytest.approx(mask)
|
|
||||||
assert d1.get_mask() == pytest.approx(mask)
|
|
||||||
@@ -762,12 +762,12 @@ def test_ignore_bad_simple_comparison(caplog):
|
|
||||||
assert s.get_filter(1) == "1,3"
|
|
||||||
assert s.get_filter(2) == "1:3"
|
|
||||||
|
|
||||||
- mask = [True] + [False] + [True] + [False] * 2
|
|
||||||
+ mask = np.asarray([True] + [False] + [True] + [False] * 2)
|
|
||||||
d1 = s.get_data(1)
|
|
||||||
assert d1.mask == pytest.approx(mask)
|
|
||||||
assert d1.get_mask() == pytest.approx(mask)
|
|
||||||
|
|
||||||
- mask = [True] * 2 + [False] * 2
|
|
||||||
+ mask = np.asarray([True] * 2 + [False] * 2)
|
|
||||||
d2 = s.get_data(2)
|
|
||||||
assert d2.mask == pytest.approx(mask)
|
|
||||||
assert d2.get_mask() == pytest.approx(mask)
|
|
||||||
diff --git a/sherpa/astro/utils/tests/test_astro_utils_unit.py b/sherpa/astro/utils/tests/test_astro_utils_unit.py
|
|
||||||
index 27551d5d22..de8b5e4bf5 100644
|
|
||||||
--- a/sherpa/astro/utils/tests/test_astro_utils_unit.py
|
|
||||||
+++ b/sherpa/astro/utils/tests/test_astro_utils_unit.py
|
|
||||||
@@ -194,7 +194,7 @@ def test_filter_resp_basics(offset, selected, ng, fch, nch, mat, msk):
|
|
||||||
assert f_chan2 == pytest.approx(np.asarray(fch) + delta)
|
|
||||||
assert n_chan2 == pytest.approx(nch)
|
|
||||||
assert matrix2 == pytest.approx(mat)
|
|
||||||
- assert mask2 == pytest.approx(msk)
|
|
||||||
+ assert mask2 == pytest.approx(np.asarray(msk))
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("lo, hi, expected",
|
|
||||||
@@ -414,7 +414,8 @@ def test_qual_setting():
|
|
||||||
"""Regression test."""
|
|
||||||
|
|
||||||
pha = make_data("qual")
|
|
||||||
- assert pha.quality_filter == pytest.approx([True, True, False, True])
|
|
||||||
+ expected = np.asarray([True, True, False, True])
|
|
||||||
+ assert pha.quality_filter == pytest.approx(expected)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("data_class", ["1d", "1dint", "pha", "grp", "qual"])
|
|
||||||
@@ -869,4 +870,5 @@ def test_expand_grouped_mask_ingalid_group():
|
|
||||||
def test_expand_grouped_mask(mask, group, expected):
|
|
||||||
"""Check how test_expand_grouped_mask works."""
|
|
||||||
|
|
||||||
- assert expand_grouped_mask(mask, group) == pytest.approx(expected)
|
|
||||||
+ evals = np.asarray(expected)
|
|
||||||
+ assert expand_grouped_mask(mask, group) == pytest.approx(evals)
|
|
||||||
diff --git a/sherpa/tests/test_data.py b/sherpa/tests/test_data.py
|
|
||||||
index f7a41ebf79..e6744aeb8d 100644
|
|
||||||
--- a/sherpa/tests/test_data.py
|
|
||||||
+++ b/sherpa/tests/test_data.py
|
|
||||||
@@ -1321,7 +1321,7 @@ def test_data_filter_invalid_size_scalar():
|
|
||||||
x = numpy.asarray([1, 2, 5])
|
|
||||||
d = Data1D('x', x, x)
|
|
||||||
d.ignore(None, 2)
|
|
||||||
- assert d.mask == pytest.approx([False, False, True])
|
|
||||||
+ assert d.mask == pytest.approx(numpy.asarray([False, False, True]))
|
|
||||||
|
|
||||||
with pytest.raises(DataErr,
|
|
||||||
match="Array must be a sequence or None"):
|
|
||||||
@@ -1567,7 +1567,7 @@ def test_data1dint_check_limit(ignore, lo, hi, evals):
|
|
||||||
|
|
||||||
c1, c2, c3 = evals
|
|
||||||
expected = [vout] * c1 + [vin] * c2 + [vout] * c3
|
|
||||||
- assert d.mask == pytest.approx(expected)
|
|
||||||
+ assert d.mask == pytest.approx(numpy.asarray(expected))
|
|
||||||
|
|
||||||
|
|
||||||
def test_filter_apply_none():
|
|
||||||
@@ -1993,7 +1993,7 @@ def test_mask_sent_array_non_bool():
|
|
||||||
expected = [True, False, True, False, True, True, False, True, False, True]
|
|
||||||
|
|
||||||
data.mask = mask
|
|
||||||
- assert data.mask == pytest.approx(expected)
|
|
||||||
+ assert data.mask == pytest.approx(numpy.asarray(expected))
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("data", ALL_DATA_CLASSES, indirect=True)
|
|
||||||
diff --git a/sherpa/ui/tests/test_session.py b/sherpa/ui/tests/test_session.py
|
|
||||||
index 4b352c203b..5723f4a655 100644
|
|
||||||
--- a/sherpa/ui/tests/test_session.py
|
|
||||||
+++ b/sherpa/ui/tests/test_session.py
|
|
||||||
@@ -1408,7 +1408,8 @@ def test_load_filter_simple(idval, tmp_path):
|
|
||||||
else:
|
|
||||||
s.load_filter(idval, str(infile), ncols=1, ignore=True)
|
|
||||||
|
|
||||||
- assert s.get_data().mask == pytest.approx([True, True, False])
|
|
||||||
+ expected = np.asarray([True, True, False])
|
|
||||||
+ assert s.get_data().mask == pytest.approx(expected)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("idval", [None, 1])
|
|
||||||
diff --git a/sherpa/ui/tests/test_ui_unit.py b/sherpa/ui/tests/test_ui_unit.py
|
|
||||||
index 99cc4e21b5..14f15a78e0 100644
|
|
||||||
--- a/sherpa/ui/tests/test_ui_unit.py
|
|
||||||
+++ b/sherpa/ui/tests/test_ui_unit.py
|
|
||||||
@@ -1209,7 +1209,7 @@ def test_set_filter_unmasked(ignore, clean_ui):
|
|
||||||
ui.load_arrays(1, x, y)
|
|
||||||
|
|
||||||
data = ui.get_data()
|
|
||||||
- assert data.mask
|
|
||||||
+ assert data.mask is True
|
|
||||||
|
|
||||||
if ignore:
|
|
||||||
expected = [False, True, False]
|
|
||||||
@@ -1217,7 +1217,7 @@ def test_set_filter_unmasked(ignore, clean_ui):
|
|
||||||
expected = [True, False, True]
|
|
||||||
|
|
||||||
ui.set_filter(np.asarray([True, False, True]), ignore=ignore)
|
|
||||||
- assert data.mask == pytest.approx(expected)
|
|
||||||
+ assert data.mask == pytest.approx(np.asarray(expected))
|
|
||||||
|
|
||||||
|
|
||||||
def test_set_filter_unmasked_wrong(clean_ui):
|
|
||||||
@@ -1245,7 +1245,9 @@ def test_set_filter_masked(ignore, clean_ui):
|
|
||||||
ui.ignore(lo=15, hi=45)
|
|
||||||
|
|
||||||
data = ui.get_data()
|
|
||||||
- assert data.mask == pytest.approx([True, False, False, False, True])
|
|
||||||
+
|
|
||||||
+ orig = np.asarray([True, False, False, False, True])
|
|
||||||
+ assert data.mask == pytest.approx(orig)
|
|
||||||
|
|
||||||
# Unlike test_set_filter_masked the two expected values are not
|
|
||||||
# logical inverses, since we need to consider the existing mask.
|
|
||||||
@@ -1256,7 +1258,7 @@ def test_set_filter_masked(ignore, clean_ui):
|
|
||||||
expected = [True, False, True, False, True]
|
|
||||||
|
|
||||||
ui.set_filter(np.asarray([True, False, True, False, False]), ignore=ignore)
|
|
||||||
- assert data.mask == pytest.approx(expected)
|
|
||||||
+ assert data.mask == pytest.approx(np.asarray(expected))
|
|
||||||
|
|
||||||
|
|
||||||
def test_set_filter_masked_wrong(clean_ui):
|
|
||||||
diff --git a/sherpa/utils/tests/test_utils.py b/sherpa/utils/tests/test_utils.py
|
|
||||||
index a11338d8b8..60e56f82ba 100644
|
|
||||||
--- a/sherpa/utils/tests/test_utils.py
|
|
||||||
+++ b/sherpa/utils/tests/test_utils.py
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
#
|
|
||||||
-# Copyright (C) 2010, 2016, 2018, 2019, 2020, 2021, 2022, 2023
|
|
||||||
+# Copyright (C) 2010, 2016, 2018 - 2024
|
|
||||||
# Smithsonian Astrophysical Observatory
|
|
||||||
#
|
|
||||||
#
|
|
||||||
@@ -374,9 +374,11 @@ def test_filter_bins_one(lo, hi, res):
|
|
||||||
lo>hi.
|
|
||||||
"""
|
|
||||||
|
|
||||||
+ expected = numpy.asarray(res)
|
|
||||||
+
|
|
||||||
dvals = numpy.asarray([1, 2, 3, 4, 5])
|
|
||||||
flags = utils.filter_bins([lo], [hi], [dvals])
|
|
||||||
- assert flags == pytest.approx(res)
|
|
||||||
+ assert flags == pytest.approx(expected)
|
|
||||||
|
|
||||||
# We can also check an identity: that
|
|
||||||
# a <= x <= b
|
|
||||||
@@ -385,7 +387,7 @@ def test_filter_bins_one(lo, hi, res):
|
|
||||||
# x <= b
|
|
||||||
#
|
|
||||||
flags = utils.filter_bins([lo, None], [None, hi], [dvals, dvals])
|
|
||||||
- assert flags == pytest.approx(res)
|
|
||||||
+ assert flags == pytest.approx(expected)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -418,7 +420,7 @@ def test_filter_bins_one_int(lo, hi, res):
|
|
||||||
hivals = lovals + 1
|
|
||||||
flags = utils.filter_bins([None, lo], [hi, None], [lovals, hivals],
|
|
||||||
integrated=True)
|
|
||||||
- assert flags == pytest.approx(res)
|
|
||||||
+ assert flags == pytest.approx(numpy.asarray(res))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
From af47af723c4fb054f037555e9c5fd219871c9695 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Douglas Burke <dburke.gw@gmail.com>
|
|
||||||
Date: Fri, 6 Dec 2024 12:58:17 -0500
|
|
||||||
Subject: [PATCH 2/2] CI: use macos-13 for the macOS Intel run
|
|
||||||
|
|
||||||
This also
|
|
||||||
|
|
||||||
- bumps up the python version from 3.10 to 3.11
|
|
||||||
- adds bokeh to the mac test (as it's supposed to be a
|
|
||||||
"gull build")
|
|
||||||
- adds "Intel" to the name of the test, in preparation for
|
|
||||||
adding an ARM build, such as
|
|
||||||
https://github.com/sherpa/sherpa/pull/2198/
|
|
||||||
---
|
|
||||||
.github/workflows/ci-conda-workflow.yml | 7 ++++---
|
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/.github/workflows/ci-conda-workflow.yml b/.github/workflows/ci-conda-workflow.yml
|
|
||||||
index 6bab3c77ae..507c06efb2 100644
|
|
||||||
--- a/.github/workflows/ci-conda-workflow.yml
|
|
||||||
+++ b/.github/workflows/ci-conda-workflow.yml
|
|
||||||
@@ -30,13 +30,14 @@ jobs:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- - name: MacOS Full Build
|
|
||||||
- os: macos-12
|
|
||||||
- python-version: "3.10"
|
|
||||||
+ - name: MacOS Intel Full Build
|
|
||||||
+ os: macos-13
|
|
||||||
+ python-version: "3.11"
|
|
||||||
install-type: develop
|
|
||||||
fits: astropy
|
|
||||||
test-data: submodule
|
|
||||||
matplotlib-version: 3
|
|
||||||
+ bokeh-version: 3
|
|
||||||
xspec-version: 12.14.0i
|
|
||||||
|
|
||||||
- name: Linux Minimum Setup (Python 3.10)
|
|
Reference in New Issue
Block a user