forked from pool/python-sherpa
Compare commits
55 Commits
Author | SHA256 | Date | |
---|---|---|---|
cbfafa462b | |||
755cbffa2f | |||
78f7e6e3ac | |||
c3d2b4e05c | |||
417686b0dd | |||
45278798b7 | |||
45f8ea50e6 | |||
de47efe118 | |||
5258946ee6 | |||
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 +1,75 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 30 01:10:51 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Update to 4.17.1:
|
||||
* enhancements:
|
||||
+ improved handling for OGIP products that do not follow the standards
|
||||
+ Models can now be combined using arbitrary ufuncs
|
||||
+ various updates to XSpec interface and support for XSpec 12.15.0
|
||||
including the additional of 17 new models
|
||||
+ added interface to support ArviZ for analysis of Bayesian models
|
||||
* infrastructure and testing:
|
||||
+ updated tests to work with python 3.13
|
||||
* bug fixes:
|
||||
+ fixed a bug in the caching code that limited the cache size to 1
|
||||
+ update to use fake_pha for missions which don't use 1 as the first
|
||||
channel
|
||||
- Dropped patches:
|
||||
* sherpa-pr2188-np2docstrings.patch
|
||||
* sherpa-pr2207-mpl.patch
|
||||
* support-pytest-8.3.4.patch
|
||||
- Refresed sherpa-suse-libdir.patch
|
||||
- Add patch support-gcc-15.patch:
|
||||
* Specify function declarations correctly.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 12 14:51:20 UTC 2025 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Add sherpa-pr2207-mpl.patch for matplotlib 3.10 test
|
||||
compatibility gh#sherpa/sherpa#2207
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 29 05:28:30 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-pytest-8.3.4.patch:
|
||||
* Support pytest 8.3.4 changes.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 6 12:40:33 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update to 4.17.0
|
||||
* This release of Sherpa includes various enhancements,
|
||||
documentation updates, bug fixes, and infrastructure changes.
|
||||
## enhancements:
|
||||
* add calc_model and calc_source functions to return an evaluated
|
||||
model/source array
|
||||
* added wstat to plot_pvalue for the likelihood ratio test
|
||||
* changed XSpec interface to use FunctionUtility C++ API instead
|
||||
of XSFortran API
|
||||
* improved support for PHA data starting at channel 0 and
|
||||
handling of STAT_ERR and SYS_ERR PHA columns which are set to 0
|
||||
* improved guess for complex models
|
||||
* improved filtering handling
|
||||
* several updates to enhance plotting capabilities and layout
|
||||
## documentation changes:
|
||||
* added paper citations to front page of Sherpa Read the Docs
|
||||
documentation
|
||||
* cleaned up various typos and URL references
|
||||
* added examples such as use of set_x/y_label
|
||||
## infrastructure and testing:
|
||||
* improved test coverage
|
||||
* many updates to CI
|
||||
* drop support for Python 3.9 and numpy <1.24
|
||||
* initial/experimental support for Python 3.12
|
||||
## bug fixes:
|
||||
* fixed an issue with plotting 1D data with asymmetric errs after
|
||||
filter
|
||||
* include the default identifier in save_all output if it has
|
||||
been changed
|
||||
- Drop numpy2.patch
|
||||
- Add sherpa-pr2188-np2docstrings.patch gh#sherpa/sherpa#2188
|
||||
- Add sherpa-suse-libdir.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 12 06:18:49 UTC 2024 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-sherpa
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -16,22 +16,23 @@
|
||||
#
|
||||
|
||||
|
||||
# requires distutils and setuptools < 60, which does not backport distutils. Unsuitable for python312
|
||||
# Track upstream progress in https://github.com/sherpa/sherpa/pull/1949
|
||||
%define skip_python312 1
|
||||
Name: python-sherpa
|
||||
Version: 4.16.1
|
||||
Version: 4.17.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}
|
||||
# PATCH-FIX-OPENSUSE sherpa-suse-libdir.patch -- UPSTREAM struggles with library paths, see e.g. gh#sherpa/sherpa#2159 code@bnavigator.de
|
||||
Patch0: sherpa-suse-libdir.patch
|
||||
# PATCH-FIX-OPENSUSE Fix extern libraries to compile with gcc 15.
|
||||
Patch1: support-gcc-15.patch
|
||||
BuildRequires: %{python_module devel >= 3.10}
|
||||
BuildRequires: %{python_module numpy-devel}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools >= 64}
|
||||
BuildRequires: %{python_module tomli if %python-base < 3.11}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
@@ -39,14 +40,15 @@ BuildRequires: fftw3-devel
|
||||
BuildRequires: flex
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-numpy >= 1.19
|
||||
BuildRequires: wcslib-devel
|
||||
Requires: python-numpy
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
ExcludeArch: %{ix86} %{arm}
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module pytest >= 5}
|
||||
BuildRequires: %{python_module pytest >= 8}
|
||||
# doctestplus tests don’t look ready gh#sherpa/sherpa#1719
|
||||
# BuildRequires: %{python_module pytest-doctestplus}
|
||||
# BuildRequires: %%{python_module pytest-doctestplus}
|
||||
BuildRequires: %{python_module pytest-xdist}
|
||||
BuildRequires: %{python_module pytest-xvfb}
|
||||
# Highly recommended by upstream when building from source
|
||||
@@ -62,23 +64,19 @@ data, using a variety of statistics and optimization methods.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n sherpa-%{version} -a1
|
||||
# uncomment system libs https://sherpa.readthedocs.io/en/latest/install.html#fftw
|
||||
sed -i "s|#fftw=local|fftw=local|" setup.cfg
|
||||
sed -i "s|#fftw-include[-_]dirs.*$|fftw-include-dirs=%{_includedir}|" setup.cfg
|
||||
sed -i "s|#fftw-lib-dirs.*$|fftw-lib-dirs=%{_libdir}|" setup.cfg
|
||||
sed -i "s|#fftw-libraries|fftw-libraries|" setup.cfg
|
||||
sed -i -e 's|@_LIB@|%{_lib}|' setup.cfg helpers/sherpa_config.py
|
||||
rm -r extern/fftw-*
|
||||
# adjust the "install path" for stk.so and group.so for the build phase
|
||||
sed -i "/pydir =/ s/libdir,/self.install_dir, '%{_lib}',/" helpers/sherpa_config.py
|
||||
# Remove shebangs
|
||||
sed -i "1{/\\/usr\\/bin\\/env python/d}" \
|
||||
sherpa/optmethods/ncoresde.py \
|
||||
sherpa/optmethods/ncoresnm.py \
|
||||
sherpa/optmethods/opt.py \
|
||||
sherpa/utils/akima.py
|
||||
|
||||
%build
|
||||
cp -r extern extern0
|
||||
%{python_expand #
|
||||
# use the python3X bundled setuptools instead of setuptools 60+ from the distribution
|
||||
# https://sherpa.readthedocs.io/en/latest/install.html#building-from-source
|
||||
mkdir -p build
|
||||
$python -m venv build/buildenv --system-site-packages
|
||||
build/buildenv/bin/pip wheel --no-deps --disable-pip-version-check --use-pep517 --no-build-isolation --progress-bar off --verbose . -w build/
|
||||
%{python_expand # rebuild and install extern/ into build/ for every wheel
|
||||
%$python_pyproject_wheel
|
||||
rm -r extern
|
||||
cp -r extern0 extern
|
||||
}
|
||||
@@ -90,27 +88,25 @@ cp -r extern0 extern
|
||||
%python_clone -a %{buildroot}%{_bindir}/sherpa_smoke
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||
|
||||
%{python_expand # REMOVE HASHBANGS FROM NON-EXEC FILES
|
||||
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresde.py
|
||||
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/ncoresnm.py
|
||||
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/optmethods/opt.py
|
||||
sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/utils/akima.py
|
||||
}
|
||||
|
||||
%check
|
||||
# avoid conftest import mismatch
|
||||
mv sherpa sherpa_temp
|
||||
export PYTHONPATH=$PWD/sherpa-test-data-%{version}
|
||||
# unclosed resource warnings by pytest although the tests use Path.to_text which should have closed it.
|
||||
donttest="test_save"
|
||||
donttest="test_Griewank"
|
||||
# precision issues
|
||||
%ifnarch x86_64
|
||||
donttest+=" or (test_regproj and sherpa.plot.dummy_backend)"
|
||||
donttest+=" or (test_fit_single and Chi2XspecVar)"
|
||||
%endif
|
||||
donttest+=" or test_Griewank"
|
||||
# Tests must not be run in parallel https://github.com/sherpa/sherpa/issues/2031
|
||||
%pytest_arch -n1 --pyargs sherpa -k "not ($donttest)"
|
||||
# gh#sherpa/sherpa#1923
|
||||
donttest+=" or test_integrate1d_basic_epsabs"
|
||||
# flaky
|
||||
donttest+=" or test_scaling_staterr"
|
||||
donttest+=" or (test_Shekel7 and montecarlo)"
|
||||
donttest+=" or (test_Shekel5 and montecarlo)"
|
||||
# docstring mismatches
|
||||
python313_donttest=" or test_show_fit or test_modify_doctring or test_modelwrapper_str_with_doc"
|
||||
%pytest_arch --pyargs sherpa -n auto --dist=loadgroup -r fE -k "not ($donttest ${$python_donttest})"
|
||||
|
||||
%post
|
||||
%python_install_alternative sherpa_smoke
|
||||
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ed4dfba237c4a6b60b4141e5619b53b25cb9e23be26cbcd7dbf00f8822d4669c
|
||||
size 13738921
|
3
sherpa-4.17.1.tar.gz
Normal file
3
sherpa-4.17.1.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:331f912248e2ce49b03ce2cf24fc1cc113a488a71a26bc002ba8758f79eec373
|
||||
size 13687160
|
60
sherpa-suse-libdir.patch
Normal file
60
sherpa-suse-libdir.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
Index: sherpa-4.17.1/helpers/sherpa_config.py
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/helpers/sherpa_config.py
|
||||
+++ sherpa-4.17.1/helpers/sherpa_config.py
|
||||
@@ -79,7 +79,7 @@ class sherpa_config(Command):
|
||||
def finalize_options(self):
|
||||
incdir = os.path.join(self.install_dir, 'include')
|
||||
libdir = os.path.join(self.install_dir, 'lib')
|
||||
- pydir = os.path.join(libdir, f'python{version}', 'site-packages')
|
||||
+ pydir = os.path.join(self.install_dir, '@_LIB@', f'python{version}', 'site-packages')
|
||||
|
||||
if self.fftw_include_dirs is None:
|
||||
self.fftw_include_dirs = incdir
|
||||
@@ -144,7 +144,7 @@ class sherpa_config(Command):
|
||||
# normal installs: editable installs do not seem to care about
|
||||
# the data_files setting.
|
||||
#
|
||||
- libdir = os.path.join('lib',
|
||||
+ libdir = os.path.join('@_LIB@',
|
||||
f'python{version}',
|
||||
'site-packages')
|
||||
dfiles = []
|
||||
Index: sherpa-4.17.1/setup.cfg
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/setup.cfg
|
||||
+++ sherpa-4.17.1/setup.cfg
|
||||
@@ -20,15 +20,15 @@
|
||||
|
||||
# FFTW Library
|
||||
# Uncomment to use a local installation
|
||||
-#fftw=local
|
||||
+fftw=local
|
||||
|
||||
# If fftw=local uncomment the following lines and
|
||||
# change the default location of libraries and the name
|
||||
# of the library to be linked (usually fftw3)
|
||||
# (include multiple values by separating them with spaces)
|
||||
-#fftw_include_dirs=build/include
|
||||
-#fftw_lib_dirs=build/lib
|
||||
-#fftw_libraries=fftw3
|
||||
+fftw_include_dirs=include
|
||||
+fftw_lib_dirs=@_LIB@
|
||||
+fftw_libraries=fftw3
|
||||
|
||||
# Region Library
|
||||
# Uncomment to use a local installation
|
||||
@@ -54,9 +54,10 @@
|
||||
#wcs=local
|
||||
|
||||
# Uncomment and change default location if needed
|
||||
-#wcs_include_dirs=build/include
|
||||
-#wcs_lib_dirs=build/lib
|
||||
-#wcs_libraries=wcs
|
||||
+# sherpa is not compatible with wcs.h from system. Make it build and find vendored wcssubs in extern/
|
||||
+wcs_include_dirs=build/include
|
||||
+wcs_lib_dirs=build/lib
|
||||
+wcs_libraries=wcs
|
||||
|
||||
|
||||
[build_sphinx]
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c61443bf3530e42322cec52887cc2f170c2d5d9aaba2822e107da2626c269a1c
|
||||
size 137775313
|
3
sherpa-test-data-4.17.1.tar.gz
Normal file
3
sherpa-test-data-4.17.1.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3f838a44edb7980e92435f388f6c16b7071ce99eebfbc393ea68f99b951989c2
|
||||
size 137775329
|
535
support-gcc-15.patch
Normal file
535
support-gcc-15.patch
Normal file
@@ -0,0 +1,535 @@
|
||||
Index: sherpa-4.17.1/extern/region-4.14/src/region_eval.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/region-4.14/src/region_eval.c
|
||||
+++ sherpa-4.17.1/extern/region-4.14/src/region_eval.c
|
||||
@@ -80,30 +80,28 @@ int regCompareRegion( regRegion* Region1
|
||||
{
|
||||
regShape* Shape1;
|
||||
regShape* Shape2;
|
||||
- int true = 1;
|
||||
- int false = 0;
|
||||
Shape1 = Region1->shape;
|
||||
Shape2 = Region2->shape;
|
||||
|
||||
while (Shape1 != NULL )
|
||||
{
|
||||
if ( !Shape2 )
|
||||
- return false;
|
||||
+ return 0;
|
||||
|
||||
if ( Shape1->component != Shape2->component )
|
||||
- return false;
|
||||
+ return 0;
|
||||
|
||||
if( !Shape1->isEqual(Shape1, Shape2) )
|
||||
- return false;
|
||||
+ return 0;
|
||||
|
||||
Shape1 = Shape1->next;
|
||||
Shape2 = Shape2->next;
|
||||
}
|
||||
|
||||
if ( Shape2 )
|
||||
- return false;
|
||||
+ return 0;
|
||||
|
||||
- return true;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/imhfile.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/imhfile.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/imhfile.c
|
||||
@@ -148,27 +148,27 @@
|
||||
#define LEN_FITSHDR 11520
|
||||
|
||||
int check_immagic();
|
||||
-int irafgeti4();
|
||||
-float irafgetr4();
|
||||
-char *irafgetc2();
|
||||
-char *irafgetc();
|
||||
-char *iraf2str();
|
||||
-static char *same_path();
|
||||
-static void irafputr4();
|
||||
-static void irafputi4();
|
||||
-static void irafputc2();
|
||||
-static void irafputc();
|
||||
-static void str2iraf();
|
||||
+int irafgeti4(char *irafheader, int offset);
|
||||
+float irafgetr4(char *irafheader, int offset);
|
||||
+char *irafgetc2(char *irafheader, int offset, int nc);
|
||||
+char *irafgetc(char *irafheader, int offset, int nc);
|
||||
+char *iraf2str(char *irafstring, int nchar);
|
||||
+static char *same_path(char *pixname, char *hdrname);
|
||||
+static void irafputr4(char *irafheader, int offset, float rnum);
|
||||
+static void irafputi4(char *irafheader, int offset, int inum);
|
||||
+static void irafputc2(char *string, char *irafheader, int offset, int nc);
|
||||
+static void irafputc(char *string, char *irafheader, int offset, int nc);
|
||||
+static void str2iraf(char *string, char *irafstring, int nchar);
|
||||
static int headswap=-1; /* =1 to swap data bytes of foreign IRAF file */
|
||||
-static void irafswap();
|
||||
-static void irafswap2();
|
||||
-static void irafswap4();
|
||||
-static void irafswap8();
|
||||
-int head_version ();
|
||||
-int pix_version ();
|
||||
-int irafncmp ();
|
||||
+static void irafswap(int bitpix, char *string, int nbytes);
|
||||
+static void irafswap2(char *string, int nbytes);
|
||||
+static void irafswap4(char *string, int nbytes);
|
||||
+static void irafswap8(char *string, int nbytes);
|
||||
+int head_version(char *irafheader);
|
||||
+int pix_version(char *irafheader);
|
||||
+int irafncmp(char *irafheader, char *teststring, int nc);
|
||||
static int machswap();
|
||||
-static int irafsize();
|
||||
+static int irafsize(FILE *diskfile);
|
||||
|
||||
#define SECONDS_1970_TO_1980 315532800L
|
||||
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/hget.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/hget.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/hget.c
|
||||
@@ -74,7 +74,7 @@
|
||||
static int use_saolib=0;
|
||||
#endif
|
||||
|
||||
-char *hgetc ();
|
||||
+char *hgetc(const char *hstring, const char *keyword0);
|
||||
|
||||
static char val[VLENGTH+1];
|
||||
static int multiline = 0;
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/hput.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/hput.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/hput.c
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
static int verbose=0; /* Set to 1 to print error messages and other info */
|
||||
|
||||
-static void fixnegzero();
|
||||
+static void fixnegzero(char *string);
|
||||
|
||||
|
||||
/* HPUTI4 - Set int keyword = ival in FITS header string */
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/iget.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/iget.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/iget.c
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
#define MAX_LVAL 2000
|
||||
|
||||
-static char *isearch();
|
||||
+static char *isearch(const char *hstring, const char *keyword);
|
||||
static char val[30];
|
||||
|
||||
/* Extract long value for variable from IRAF multiline keyword value */
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/wcscon.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/wcscon.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/wcscon.c
|
||||
@@ -73,10 +73,30 @@
|
||||
#include <string.h>
|
||||
#include "wcs.h"
|
||||
|
||||
-void fk524(), fk524e(), fk524m(), fk524pv();
|
||||
-void fk425(), fk425e(), fk425m(), fk425pv();
|
||||
-void fk42gal(), fk52gal(), gal2fk4(), gal2fk5();
|
||||
-void fk42ecl(), fk52ecl(), ecl2fk4(), ecl2fk5();
|
||||
+void fk524(double *ra, double *dec);
|
||||
+void fk524e(double *ra, double *dec, double epoch);
|
||||
+void fk524m(double *ra, double *dec, double *rapm, double *decpm);
|
||||
+void fk524pv(double *ra, double *dec, double *rapm, double *decpm, double *parallax, double *rv);
|
||||
+void fk425(double *ra, double *dec);
|
||||
+void fk425e(double *ra, double *dec, double epoch);
|
||||
+void fk425m(double *ra, double *dec, double *rapm, double *decpm);
|
||||
+void fk425pv(double *ra, double *dec, double *rapm, double *decpm, double *parallax, double *rv);
|
||||
+void fk42gal(double *dtheta, double *dphi);
|
||||
+void fk52gal(double *dtheta, double *dphi);
|
||||
+void gal2fk4(double *dtheta, double *dphi);
|
||||
+void gal2fk5(double *dtheta, double *dphi);
|
||||
+void fk42ecl(double *dtheta, double *dphi, double epoch);
|
||||
+void fk52ecl(double *dtheta, double *dphi, double epoch);
|
||||
+void ecl2fk4(double *dtheta, double *dphi, double epoch);
|
||||
+void ecl2fk5(double *dtheta, double *dphi, double epoch);
|
||||
+void v2s3(double pos[3], double *rra, double *rdec, double *r);
|
||||
+void s2v3(double rra, double rdec, double r, double pos[3]);
|
||||
+void fk4prec(double ep0, double ep1, double *ra, double *dec);
|
||||
+void fk5prec(double ep0, double ep1, double *ra, double *dec);
|
||||
+void rotmat(int axes, double rot1, double rot2, double rot3, double *matrix);
|
||||
+void mprecfk4(double bep0, double bep1, double rmatp[9]);
|
||||
+void mprecfk5(double ep0, double ep1, double rmatp[9]);
|
||||
+char *eqstrn(double dra, double ddec);
|
||||
|
||||
/* Convert from coordinate system sys1 to coordinate system sys2, converting
|
||||
proper motions, too, and adding them if an epoch is specified */
|
||||
@@ -100,7 +120,6 @@ double *pphi; /* Latitude or declination
|
||||
Input in sys1, returned in sys2 */
|
||||
|
||||
{
|
||||
- void fk5prec(), fk4prec();
|
||||
|
||||
/* Set equinoxes if 0.0 */
|
||||
if (eq1 == 0.0) {
|
||||
@@ -306,7 +325,6 @@ double *px; /* Parallax in arcseconds */
|
||||
double *rv; /* Radial velocity in km/sec */
|
||||
|
||||
{
|
||||
- void fk5prec(), fk4prec();
|
||||
|
||||
/* Set equinoxes if 0.0 */
|
||||
if (eq1 == 0.0) {
|
||||
@@ -510,7 +528,6 @@ double *dphi; /* Latitude or declination
|
||||
double epoch; /* Besselian epoch in years */
|
||||
|
||||
{
|
||||
- void fk5prec(), fk4prec();
|
||||
|
||||
/* Set equinoxes if 0.0 */
|
||||
if (eq1 == 0.0) {
|
||||
@@ -1441,9 +1458,8 @@ double *dphi; /* B1950.0 FK4 declination
|
||||
Reference: Blaauw et al, MNRAS,121,123 (1960) */
|
||||
{
|
||||
double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
|
||||
- void v2s3(),s2v3();
|
||||
int i;
|
||||
- char *eqcoor, *eqstrn();
|
||||
+ char *eqcoor;
|
||||
|
||||
dra = *dtheta;
|
||||
ddec = *dphi;
|
||||
@@ -1499,8 +1515,7 @@ double *dphi; /* Galactic latitude (b2)
|
||||
|
||||
{
|
||||
double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
|
||||
- void v2s3(),s2v3();
|
||||
- char *eqcoor, *eqstrn();
|
||||
+ char *eqcoor;
|
||||
int i;
|
||||
|
||||
/* spherical to cartesian */
|
||||
@@ -1574,8 +1589,7 @@ double *dphi; /* J2000 declination in de
|
||||
Reference: Blaauw et al, MNRAS,121,123 (1960) */
|
||||
{
|
||||
double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
|
||||
- void v2s3(),s2v3();
|
||||
- char *eqcoor, *eqstrn();
|
||||
+ char *eqcoor;
|
||||
int i;
|
||||
|
||||
/* Spherical to cartesian */
|
||||
@@ -1627,9 +1641,8 @@ double *dphi; /* Galactic latitude (b2)
|
||||
|
||||
{
|
||||
double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
|
||||
- void v2s3(),s2v3();
|
||||
int i;
|
||||
- char *eqcoor, *eqstrn();
|
||||
+ char *eqcoor;
|
||||
|
||||
/* Spherical to Cartesian */
|
||||
dl = *dtheta;
|
||||
@@ -1727,8 +1740,6 @@ double *dphi; /* B1950 declination in de
|
||||
double epoch; /* Besselian epoch in years */
|
||||
|
||||
{
|
||||
- void fk425e(), fk52ecl();
|
||||
-
|
||||
/* Convert from B1950 to J2000 coordinates */
|
||||
fk425e (dtheta, dphi, epoch);
|
||||
|
||||
@@ -1755,8 +1766,6 @@ double epoch; /* Besselian epoch in year
|
||||
double v1[3], v2[3], r;
|
||||
double rmat[9], *rmati; /* Rotation matrix */
|
||||
|
||||
- void rotmat(), v2s3(), s2v3(), fk5prec();
|
||||
-
|
||||
/* Precess coordinates from J2000 to epoch */
|
||||
if (epoch != 2000.0)
|
||||
fk5prec (2000.0, epoch, dtheta, dphi);
|
||||
@@ -1810,8 +1819,6 @@ double *dphi; /* Galactic latitude (b2)
|
||||
double epoch; /* Besselian epoch in years */
|
||||
|
||||
{
|
||||
- void ecl2fk5(), fk524e();
|
||||
-
|
||||
/* Convert from ecliptic to J2000 coordinates */
|
||||
ecl2fk5 (dtheta, dphi, epoch);
|
||||
|
||||
@@ -1839,7 +1846,6 @@ double epoch; /* Besselian epoch in year
|
||||
double rtheta, rphi, v1[3], v2[3];
|
||||
double t, eps0, r;
|
||||
double rmat[9]; /* Rotation matrix */
|
||||
- void v2s3(),s2v3(), fk5prec(), rotmat();
|
||||
|
||||
rtheta = degrad (*dtheta);
|
||||
rphi = degrad (*dphi);
|
||||
@@ -1902,7 +1908,6 @@ double *dec; /* Dec in degrees mean equa
|
||||
{
|
||||
int i, j;
|
||||
double pm[9], *pmi, v1[3], v2[3], rra, rdec, r;
|
||||
- void v2s3(),s2v3(), mprecfk4();
|
||||
|
||||
rra = degrad (*ra);
|
||||
rdec = degrad (*dec);
|
||||
@@ -1950,7 +1955,6 @@ double *dec; /* Dec in degrees mean equa
|
||||
{
|
||||
int i, j;
|
||||
double pm[9], *pmi, v1[3], v2[3], rra, rdec, r;
|
||||
- void v2s3(),s2v3(), mprecfk5();
|
||||
|
||||
rra = degrad (*ra);
|
||||
rdec = degrad (*dec);
|
||||
@@ -2003,7 +2007,6 @@ double rmatp[9]; /* 3x3 Precession matri
|
||||
*/
|
||||
{
|
||||
double bigt, t, tas2r, w, zeta, z, theta;
|
||||
- void rotmat();
|
||||
|
||||
/* Interval between basic epoch B1850.0 and beginning epoch in TC */
|
||||
bigt = ( bep0 - 1850.0 ) / 100.0;
|
||||
@@ -2047,7 +2050,6 @@ double rmatp[9]; /* 3x3 Precession matri
|
||||
*/
|
||||
{
|
||||
double t0, t, tas2r, w, zeta, z, theta;
|
||||
- void rotmat();
|
||||
|
||||
/* Interval between basic epoch J2000.0 and beginning epoch (JC) */
|
||||
t0 = ( ep0 - 2000.0 ) / 100.0;
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/tnxpos.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/tnxpos.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/tnxpos.c
|
||||
@@ -47,10 +47,17 @@
|
||||
|
||||
#define max_niter 500
|
||||
#define SZ_ATSTRING 2000
|
||||
-static void wf_gsclose();
|
||||
-static void wf_gsb1pol();
|
||||
-static void wf_gsb1leg();
|
||||
-static void wf_gsb1cheb();
|
||||
+static void wf_gsclose(struct IRAFsurface *sf);
|
||||
+static void wf_gsb1pol(double x, int order, double *basis);
|
||||
+static void wf_gsb1leg(double x, int order, double k1, double k2, double *basis);
|
||||
+static void wf_gsb1cheb(double x, int order, double k1, double k2, double *basis);
|
||||
+struct IRAFsurface *wf_gsopen(char *astr);
|
||||
+struct IRAFsurface *wf_gsrestore(double *fit);
|
||||
+struct IRAFsurface *wf_gspset(int xorder, int yorder, int xterms, double *coeff);
|
||||
+double wf_gseval(struct IRAFsurface *sf, double x, double y);
|
||||
+double wf_gsder(struct IRAFsurface *sf, double x, double y, int nxd, int nyd);
|
||||
+
|
||||
+extern void wcsrotset(struct WorldCoor *wcs);
|
||||
|
||||
/* tnxinit -- initialize the gnomonic forward or inverse transform.
|
||||
* initialization for this transformation consists of, determining which
|
||||
@@ -75,9 +82,7 @@ tnxinit (header, wcs)
|
||||
const char *header; /* FITS header */
|
||||
struct WorldCoor *wcs; /* pointer to WCS structure */
|
||||
{
|
||||
- struct IRAFsurface *wf_gsopen();
|
||||
char *str1, *str2, *lngstr, *latstr;
|
||||
- extern void wcsrotset();
|
||||
|
||||
/* allocate space for the attribute strings */
|
||||
str1 = malloc (SZ_ATSTRING);
|
||||
@@ -166,7 +171,6 @@ double *xpos, *ypos; /*o world coordinat
|
||||
double x, y, r, phi, theta, costhe, sinthe, dphi, cosphi, sinphi, dlng, z;
|
||||
double colatp, coslatp, sinlatp, longp;
|
||||
double xs, ys, ra, dec, xp, yp;
|
||||
- double wf_gseval();
|
||||
|
||||
/* Convert from pixels to image coordinates */
|
||||
xpix = xpix - wcs->crpix[0];
|
||||
@@ -317,7 +321,6 @@ double *xpix, *ypix; /*o physical coordi
|
||||
double s, r, dphi, z, dpi, dhalfpi, twopi, tx;
|
||||
double xm, ym, f, fx, fy, g, gx, gy, denom, dx, dy;
|
||||
double colatp, coslatp, sinlatp, longp, sphtol;
|
||||
- double wf_gseval(), wf_gsder();
|
||||
|
||||
/* get the axis numbers */
|
||||
if (wcs->coorflip) {
|
||||
@@ -562,7 +565,6 @@ char *astr; /* the input mwcs attrib
|
||||
int npar, szcoeff;
|
||||
double *coeff;
|
||||
struct IRAFsurface *gs;
|
||||
- struct IRAFsurface *wf_gsrestore();
|
||||
|
||||
if (astr[1] == 0)
|
||||
return (NULL);
|
||||
@@ -737,7 +739,6 @@ int nxd, nyd; /* order of the derivative
|
||||
struct IRAFsurface *sf2 = 0;
|
||||
double *ptr1, *ptr2;
|
||||
double zfit, norm;
|
||||
- double wf_gseval();
|
||||
|
||||
if (sf1 == NULL)
|
||||
return (0.0);
|
||||
@@ -1121,7 +1122,6 @@ double *coeff; /* Plate fit coefficient
|
||||
|
||||
{
|
||||
double *ycoeff;
|
||||
- struct IRAFsurface *wf_gspset ();
|
||||
|
||||
wcs->prjcode = WCS_TNX;
|
||||
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/zpxpos.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/zpxpos.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/zpxpos.c
|
||||
@@ -50,7 +50,13 @@
|
||||
|
||||
#define max_niter 500
|
||||
#define SZ_ATSTRING 2000
|
||||
-static void wf_gsclose();
|
||||
+
|
||||
+static void wf_gsclose(struct IRAFsurface *sf);
|
||||
+
|
||||
+extern struct IRAFsurface *wf_gsopen(char *astr);
|
||||
+extern double wf_gseval(struct IRAFsurface *sf, double x, double y);
|
||||
+extern double wf_gsder(struct IRAFsurface *sf, double x, double y, int nxd, int nyd);
|
||||
+extern void wcsrotset(struct WorldCoor *wcs);
|
||||
|
||||
/* zpxinit -- initialize the zenithal/azimuthal polynomial forward or
|
||||
* inverse transform. initialization for this transformation consists of,
|
||||
@@ -81,10 +87,8 @@ const char *header; /* FITS header */
|
||||
struct WorldCoor *wcs; /* pointer to WCS structure */
|
||||
{
|
||||
int i, j;
|
||||
- struct IRAFsurface *wf_gsopen();
|
||||
char key[8], *str1, *str2, *lngstr, *latstr, *header1;
|
||||
double zd1, d1, zd2,d2, zd, d, r;
|
||||
- extern void wcsrotset();
|
||||
|
||||
/* allocate space for the attribute strings */
|
||||
str1 = malloc (SZ_ATSTRING);
|
||||
@@ -252,7 +256,6 @@ double *xpos, *ypos; /*o world coordinat
|
||||
double colatp, coslatp, sinlatp, longp;
|
||||
double xs, ys, ra, dec, xp, yp;
|
||||
double a, b, c, d, zd, zd1, zd2, r1, r2, rt, lambda;
|
||||
- double wf_gseval();
|
||||
|
||||
/* Convert from pixels to image coordinates */
|
||||
xpix = xpix - wcs->crpix[0];
|
||||
@@ -520,7 +523,6 @@ double *xpix, *ypix; /*o physical coordi
|
||||
double s, r, dphi, z, dpi, dhalfpi, twopi, tx;
|
||||
double xm, ym, f, fx, fy, g, gx, gy, denom, dx, dy;
|
||||
double colatp, coslatp, sinlatp, longp, sphtol;
|
||||
- double wf_gseval(), wf_gsder();
|
||||
|
||||
/* get the axis numbers */
|
||||
if (wcs->coorflip) {
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/wcsinit.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/wcsinit.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/wcsinit.c
|
||||
@@ -47,11 +47,13 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
-static void wcseq();
|
||||
-static void wcseqm();
|
||||
-static void wcsioset();
|
||||
-void wcsrotset();
|
||||
-char wcschar();
|
||||
+void invert_wcs(struct WorldCoor *wcs);
|
||||
+static void wcseq(char *hstring, struct WorldCoor *wcs);
|
||||
+static void wcseqm(char *hstring, struct WorldCoor *wcs, char *mchar);
|
||||
+static void wcsioset(struct WorldCoor *wcs);
|
||||
+char wcschar(const char *hstring, const char *name);
|
||||
+
|
||||
+extern void wcsrotset(struct WorldCoor *wcs);
|
||||
|
||||
/* set up a WCS structure from a FITS image header lhstring bytes long
|
||||
* for a specified WCS name */
|
||||
@@ -242,11 +244,6 @@ char *wchar; /* Suffix character for on
|
||||
double ut;
|
||||
int nax;
|
||||
int twod;
|
||||
- extern int tnxinit();
|
||||
- extern int zpxinit();
|
||||
- extern int platepos();
|
||||
- extern int dsspos();
|
||||
- void invert_wcs();
|
||||
|
||||
wcs = (struct WorldCoor *) calloc (1, sizeof(struct WorldCoor));
|
||||
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/wcs.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/wcs.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/wcs.c
|
||||
@@ -89,12 +89,16 @@
|
||||
|
||||
static char wcserrmsg[80];
|
||||
static char wcsfile[256]={""};
|
||||
-static void wcslibrot();
|
||||
-void wcsrotset();
|
||||
static int wcsproj0 = 0;
|
||||
static int izpix = 0;
|
||||
static double zpix = 0.0;
|
||||
|
||||
+static void wcslibrot(struct WorldCoor *wcs);
|
||||
+int wcspos(double xpix, double ypix, struct WorldCoor *wcs, double *xpos, double *ypos);
|
||||
+int wcspix(double xpos, double ypos, struct WorldCoor *wcs, double *xpix, double *ypix);
|
||||
+
|
||||
+extern void wcsrotset(struct WorldCoor *wcs);
|
||||
+
|
||||
void
|
||||
wcsfree (wcs)
|
||||
struct WorldCoor *wcs; /* WCS structure */
|
||||
@@ -2123,7 +2127,6 @@ double *xpos,*ypos; /* RA and Dec in deg
|
||||
{
|
||||
double xpi, ypi, xp, yp;
|
||||
double eqin, eqout;
|
||||
- int wcspos();
|
||||
|
||||
if (nowcs (wcs))
|
||||
return;
|
||||
@@ -2246,7 +2249,6 @@ int *offscl; /* 0 if within bounds, else
|
||||
double xp, yp, xpi, ypi;
|
||||
double eqin, eqout;
|
||||
int sysin;
|
||||
- int wcspix();
|
||||
|
||||
if (nowcs (wcs))
|
||||
return;
|
||||
@@ -2351,7 +2353,6 @@ double *ypos; /* y (dec) coor
|
||||
{
|
||||
int offscl;
|
||||
int i;
|
||||
- int wcsrev();
|
||||
double wcscrd[4], imgcrd[4], pixcrd[4];
|
||||
double phi, theta;
|
||||
|
||||
@@ -2392,7 +2393,6 @@ double *ypix; /* y pixel numbe
|
||||
|
||||
{
|
||||
int offscl;
|
||||
- int wcsfwd();
|
||||
double wcscrd[4], imgcrd[4], pixcrd[4];
|
||||
double phi, theta;
|
||||
|
||||
Index: sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/dateutil.c
|
||||
===================================================================
|
||||
--- sherpa-4.17.1.orig/extern/wcssubs/wcssubs-3.9.5/dateutil.c
|
||||
+++ sherpa-4.17.1/extern/wcssubs/wcssubs-3.9.5/dateutil.c
|
||||
@@ -313,11 +313,11 @@
|
||||
#include "wcs.h"
|
||||
#include "fitsfile.h"
|
||||
|
||||
-static double suntl();
|
||||
-static void fixdate();
|
||||
-static int caldays();
|
||||
-static double dint();
|
||||
-static double dmod();
|
||||
+static double suntl(double dj, double ra, double dec, int sys);
|
||||
+static void fixdate(int *iyr, int *imon, int *iday, int *ihr, int *imn, double *sec, int ndsec);
|
||||
+static int caldays(int year, int month);
|
||||
+static double dint(double dnum);
|
||||
+static double dmod(double dnum, double dm);
|
||||
|
||||
static double longitude = 0.0; /* longitude of observatory in degrees (+=west) */
|
||||
void
|
Reference in New Issue
Block a user