15
0
forked from pool/python-hankel

- Switch to pyproject macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-hankel?expand=0&rev=28
This commit is contained in:
2025-07-07 02:10:13 +00:00
committed by Git OBS Bridge
commit a17326c9ac
6 changed files with 284 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

81
fix-get_h-test.patch Normal file
View File

@@ -0,0 +1,81 @@
From 3307d7527325dc80ac441d845982f93fd84d5311 Mon Sep 17 00:00:00 2001
From: Steven Murray <steven.g.murray@asu.edu>
Date: Mon, 23 Sep 2024 12:48:01 +0200
Subject: [PATCH] test: better test ids for get_h
---
hankel/tools.py | 11 ++++-------
tests/test_get_h.py | 11 ++++++++++-
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/hankel/tools.py b/hankel/tools.py
index 5e7b7de..5096509 100755
--- a/hankel/tools.py
+++ b/hankel/tools.py
@@ -234,7 +234,7 @@ def get_h(
i += 1
if i == maxiter:
- raise Exception("Maxiter reached while checking for non-zero values")
+ raise RuntimeError("Maxiter reached while checking for non-zero values")
if K is None: # Do a normal integral of f(x)J_nu(x)
K = 1
@@ -263,7 +263,7 @@ def getres(h):
res = getres(hstart)
if i == maxiter:
- raise Exception("Maxiter reached while checking convergence")
+ raise RuntimeError("Maxiter reached while checking convergence")
# Can do some more trimming of N potentially, by seeing where f(x)~0.
def consecutive(data, stepsize=1):
@@ -272,17 +272,14 @@ def consecutive(data, stepsize=1):
hstart *= hdecrement
- x = cls(nu, h=hstart, N=int(np.pi / hstart)).x
+ x = np.atleast_1d(cls(nu, h=hstart, N=int(np.pi / hstart)).x)
lastk = np.where(f(x / np.max(K)) == 0)[0]
if len(lastk) > 1:
# if there are any that are zero,
# and if there are more than 1 in a row
# (otherwise might just be oscillatory)
lastk = consecutive(lastk) # split into arrays of consecutive zeros
- if len(lastk[-1]) == 1:
- lastk = int(np.pi / hstart)
- else:
- lastk = lastk[-1][0]
+ lastk = int(np.pi / hstart) if len(lastk[-1]) == 1 else lastk[-1][0]
else: # otherwise set back to N
lastk = int(np.pi / hstart)
diff --git a/tests/test_get_h.py b/tests/test_get_h.py
index bc32ee3..f856c4b 100644
--- a/tests/test_get_h.py
+++ b/tests/test_get_h.py
@@ -26,7 +26,7 @@ def gammaincc_(a, x):
@pytest.mark.parametrize(
"f, anl",
[
- (lambda x: 1, 1), # Ogata 05
+ (lambda x: np.ones_like(x), 1), # Ogata 05
(lambda x: x / (x**2 + 1), k0(1)), # Ogata 05
(lambda x: x**2, -1), # wikipedia
(lambda x: x**4, 9), # wikipedia
@@ -40,6 +40,15 @@ def gammaincc_(a, x):
1.0 / 2**2 * np.exp(-0.5 / 2**2),
),
],
+ ids=[
+ "ones",
+ "x / (x^2 + 1)",
+ "x^2",
+ "x^4",
+ "1 / sqrt(x)",
+ "x / sqrt(x^2 + 1)",
+ "exp(1/2 * x^2)",
+ ]
)
def test_nu0(f, anl):
ans = get_h(f=f, nu=0, hstart=0.5, atol=0, rtol=1e-3, maxiter=20)[1]

3
hankel-1.2.2.tar.gz Normal file
View File

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

103
python-hankel.changes Normal file
View File

@@ -0,0 +1,103 @@
-------------------------------------------------------------------
Mon Jul 7 02:10:01 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to pyproject macros.
-------------------------------------------------------------------
Thu Nov 14 13:59:17 UTC 2024 - Nico Krapp <nico.krapp@suse.com>
- Add fix-get_h-test.patch to fix numpy ValueError in tests
* from: https://github.com/steven-murray/hankel/commit/3307d7527325dc80ac441d845982f93fd84d5311
-------------------------------------------------------------------
Thu Sep 14 14:11:02 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Update to 1.2.2
* Fixed installation (eg. #101)
- Drop fix-requirements.patch, no longer needed
-------------------------------------------------------------------
Wed Feb 8 00:50:32 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch fix-requirements.patch:
* Stop specifying an invalid Sphinx version.
-------------------------------------------------------------------
Sun May 1 18:52:47 UTC 2022 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 1.2.1:
* The ``.G()`` has been removed as planned.
- Changes from version 1.2.0:
* Switched to using ``setup.cfg`` instead of ``setup.py`` and
various other tooling updates.
-------------------------------------------------------------------
Sat Feb 13 00:02:02 UTC 2021 - Benjamin Greiner <code@bnavigator.de>
- NEP29: TW does not have python36-scipy anymore
skip python36 build
-------------------------------------------------------------------
Mon Sep 14 09:01:07 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- Switch to using PyPI source tarball to prevent version
determination errors from setuptools.
- Make file list more specific, particularly to the versioning of
the egg-info dir.
-------------------------------------------------------------------
Wed Jun 10 02:35:57 UTC 2020 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 1.1.0:
* Adds ability to transform complex-valued functions.
- Use %{name}-%{version} naming scheme for source tarball.
- Update package versions in Requires and BuildRequires in keeping
with upstream.
- Don't run tests for i586 arch where they take too long leading to
the obs worker shutting down assuming a stuck job.
-------------------------------------------------------------------
Thu Apr 23 11:02:49 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Drop py2 deps as package is py3 only
-------------------------------------------------------------------
Wed Apr 8 14:46:49 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 1.0.2
* Limit calculation for k=0 provided (resulted in nan before)
* Alternative hankel kernel now selectable: sqrt(x) * J(nu, x)
* Caching of series factors for faster calculations
* Various infrastructure upgrades (setuptools_scm, pre-commit, black)
* Saver calculation of xrange_approx
* Methods ``G`` and ``deltaG`` now named ``final_term_amplitude`` and ``slope_of_last_term``.
* Upstream apparently dropped Python 2.
-------------------------------------------------------------------
Thu Sep 12 10:01:25 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.3.9:
* Fixed SymmetricFourierTransform default N to be dynamic, like HankelTransform.
-------------------------------------------------------------------
Mon Mar 4 13:40:35 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.3.8:
* Swapped to pytest from nose for all testing
* Removed warnings of overflow for cosh and sinh functions
* Improved documentation in many areas.
* Swapped out default 3.2/h for pi/h, which sounds way cooler :-)
* Fixed an error in tests such that the wrong analytic function was being tested.
* Removed a check for deltaG in get_h, which sometimes fails spectacularly.
* Fixed issue in Py3 in which dim=2 would not run the fast function (thanks @MuellerSeb)
* Added support for transforms with nu=-0.5 (thanks @MuellerSeb)
-------------------------------------------------------------------
Tue Dec 4 12:48:48 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Sat Mar 24 16:24:51 UTC 2018 - badshah400@gmail.com
- Initial package.

73
python-hankel.spec Normal file
View File

@@ -0,0 +1,73 @@
#
# spec file for package python-hankel
#
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define modname hankel
Name: python-hankel
Version: 1.2.2
Release: 0
Summary: Hankel Transformations using method of Ogata 2005
License: MIT
URL: https://github.com/steven-murray/hankel
Source: https://files.pythonhosted.org/packages/source/h/%{modname}/%{modname}-%{version}.tar.gz
# https://github.com/steven-murray/hankel/commit/3307d7527325dc80ac441d845982f93fd84d5311
Patch0: fix-get_h-test.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-mpmath >= 1.0.0
Requires: python-numpy >= 1.9.3
Requires: python-scipy >= 0.16.1
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module mpmath >= 1.0.0}
BuildRequires: %{python_module numpy >= 1.9.3}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scipy >= 0.16.1}
# /SECTION
%python_subpackages
%description
Hankel is a Python library to perform simple and accurate Hankel
transformations using the method of Ogata 2005.
%prep
%autosetup -p1 -n hankel-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
# TESTS TAKE TOO LONG ON i586 LEADING TO OBS WORKER TIMING OUT
%if "%{_lib}" != "lib"
%check
%pytest
%endif
%files %{python_files}
%doc README.rst CHANGELOG.rst
%license LICENSE.rst
%{python_sitelib}/%{modname}/
%{python_sitelib}/%{modname}-%{version}.dist-info/
%changelog