Accepting request 1188826 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1188826 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-healpy?expand=0&rev=9
This commit is contained in:
commit
92549974e8
76
python-healpy-matplotlib-1_9-compat.patch
Normal file
76
python-healpy-matplotlib-1_9-compat.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From 7a68c6d83a78961027601025fc6553a67f6a44a6 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Mon, 29 Apr 2024 16:15:05 -0400
|
||||
Subject: [PATCH] Fix errors with Matplotlib 3.9
|
||||
|
||||
The `matplotlib.cm.get_cmap` API was deprecated in 3.7, and removed in
|
||||
3.9, but `matplotlib.pyplot.get_cmap` remains.
|
||||
---
|
||||
projaxes.py | 4 ++--
|
||||
src/_line_integral_convolution.pyx | 4 ++--
|
||||
test/test_visufunc.py | 4 ++--
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/healpy/projaxes.py b/healpy/projaxes.py
|
||||
index 8c301647..dc6fcef9 100644
|
||||
--- a/healpy/projaxes.py
|
||||
+++ b/healpy/projaxes.py
|
||||
@@ -948,14 +948,14 @@ def create_colormap(cmap, badcolor="gray", bgcolor="white"):
|
||||
cmap_path = os.path.join(datapath, f"{cmap}_cmap.dat")
|
||||
cmap0 = matplotlib.colors.ListedColormap(np.loadtxt(cmap_path) / 255.0, cmap)
|
||||
else:
|
||||
- cmap0 = matplotlib.cm.get_cmap(cmap)
|
||||
+ cmap0 = plt.get_cmap(cmap)
|
||||
elif type(cmap) in [
|
||||
matplotlib.colors.LinearSegmentedColormap,
|
||||
matplotlib.colors.ListedColormap,
|
||||
]:
|
||||
cmap0 = cmap
|
||||
else:
|
||||
- cmap0 = matplotlib.cm.get_cmap(matplotlib.rcParams["image.cmap"])
|
||||
+ cmap0 = plt.get_cmap(matplotlib.rcParams["image.cmap"])
|
||||
if hasattr(cmap0, "_segmentdata"):
|
||||
newcm = matplotlib.colors.LinearSegmentedColormap(
|
||||
"newcm", cmap0._segmentdata, cmap0.N
|
||||
diff --git a/healpy/src/_line_integral_convolution.pyx b/healpy/src/_line_integral_convolution.pyx
|
||||
index 1b3b6c8f..48af98dd 100644
|
||||
--- a/healpy/src/_line_integral_convolution.pyx
|
||||
+++ b/healpy/src/_line_integral_convolution.pyx
|
||||
@@ -78,12 +78,12 @@ def line_integral_convolution(
|
||||
-------
|
||||
>>> import healpy as hp
|
||||
>>> import numpy as np
|
||||
- >>> import matplotlib.cm
|
||||
>>> import matplotlib.colors
|
||||
+ >>> import matplotlib.pyplot as plt
|
||||
>>> I, Q, U = hp.read_map('iqu_map.fits', (0, 1, 2))
|
||||
>>> lic = hp.line_integral_convolution(Q, U)
|
||||
>>> hp.mollview(I)
|
||||
- >>> cmap_colors = matplotlib.cm.get_cmap('binary', 256)(np.linspace(0, 1, 256))
|
||||
+ >>> cmap_colors = plt.get_cmap('binary', 256)(np.linspace(0, 1, 256))
|
||||
>>> cmap_colors[..., 3] = 0.5 # Make colormap partially transparent
|
||||
>>> cmap = matplotlib.colors.ListedColormap(cmap_colors)
|
||||
>>> hp.mollview(lic, cmap=cmap, cbar=False, reuse_axes=True)
|
||||
diff --git a/healpy/test/test_visufunc.py b/healpy/test/test_visufunc.py
|
||||
index e4d85906..ae3bb0c4 100644
|
||||
--- a/healpy/test/test_visufunc.py
|
||||
+++ b/healpy/test/test_visufunc.py
|
||||
@@ -1,8 +1,8 @@
|
||||
import matplotlib
|
||||
-import matplotlib.cm
|
||||
|
||||
matplotlib.use("agg")
|
||||
import unittest
|
||||
+import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import copy
|
||||
|
||||
@@ -93,7 +93,7 @@ def test_azeqview_ma_nocrash(self):
|
||||
def test_cmap_colors(self):
|
||||
# Get a built-in colormap
|
||||
name = 'viridis'
|
||||
- cmap = copy.copy(matplotlib.cm.get_cmap(name))
|
||||
+ cmap = copy.copy(plt.get_cmap(name))
|
||||
|
||||
# Set outlier colors
|
||||
color = (0.25,0.75,0.95,1.0)
|
20
python-healpy-scipy-1_14-compat.patch
Normal file
20
python-healpy-scipy-1_14-compat.patch
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
healpy/sphtfunc.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: healpy-1.16.6/healpy/sphtfunc.py
|
||||
===================================================================
|
||||
--- healpy-1.16.6.orig/healpy/sphtfunc.py
|
||||
+++ healpy-1.16.6/healpy/sphtfunc.py
|
||||
@@ -24,7 +24,10 @@ import numpy as np
|
||||
|
||||
import astropy.io.fits as pf
|
||||
from .utils.deprecation import deprecated_renamed_argument
|
||||
-from scipy.integrate import trapz
|
||||
+try:
|
||||
+ from scipy.integrate import trapezoid as trapz
|
||||
+except ImportError:
|
||||
+ from scipy.integrate import trapz
|
||||
from astropy.utils import data
|
||||
|
||||
DATAURL = "https://healpy.github.io/healpy-data/"
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Jul 20 10:19:17 UTC 2024 - Atri Bhattacharya <badshah400@gmail.com>
|
||||
|
||||
- Add python-healpy-scipy-1_14-compat.patch: Account for the
|
||||
renaming of trapz to trapezoid in scipy 1.14.
|
||||
- Add python-healpy-matplotlib-1_9-compat.patch: Fix compatibility
|
||||
with matplotlib >= 3.9; upstream commit 0b1f498 rebased for
|
||||
current version.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 4 23:12:42 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-healpy
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -24,6 +24,10 @@ Summary: Python library to handle pixelated data on the sphere based on H
|
||||
License: GPL-2.0-only
|
||||
URL: https://github.com/healpy/healpy
|
||||
Source: https://files.pythonhosted.org/packages/source/h/healpy/healpy-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM python-healpy-scipy-1_14-compat.patch badshah400@gmail.com -- Account for renaming of integrate.trapz to integrate.trapezoidal in scipy 1.14
|
||||
Patch0: python-healpy-scipy-1_14-compat.patch
|
||||
# PATCH-FIX-UPSTREAM python-healpy-matplotlib-1_9-compat.patch badshah400@gmail.com -- Compatibility with matplotlib 3.9 via upstream commit 0b1f498 rebased for current version
|
||||
Patch1: python-healpy-matplotlib-1_9-compat.patch
|
||||
BuildRequires: %{python_module Cython}
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module numpy-devel >= 1.13}
|
||||
|
Loading…
x
Reference in New Issue
Block a user