* 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. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-healpy?expand=0&rev=18
77 lines
3.0 KiB
Diff
77 lines
3.0 KiB
Diff
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)
|