From 3603c12f3d94249b3a1acf1aeeb962830a540143 Mon Sep 17 00:00:00 2001 From: Yusuke Aso <98569855+yusukeaso-astron@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:46:52 +0900 Subject: [PATCH] shape check --- plotastrodata/plot_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plotastrodata/plot_utils.py b/plotastrodata/plot_utils.py index c415d72..b923ee6 100644 --- a/plotastrodata/plot_utils.py +++ b/plotastrodata/plot_utils.py @@ -1315,6 +1315,18 @@ def plot3d(levels: list[float] = [3, 6, 12], def plot_on_wall(sign: int, axis: int, **kwargs): if kwargs == {}: return + + match axis: + case 2: + shape = np.shape(d.data[:, :, 0]) + case 1: + shape = np.shape(d.data[:, 0, :]) + case 0: + shape = np.shape(d.data[0, :, :]) + if np.shape(kwargs['data']) != shape: + print('The shape of the 2D data is inconsistent with the shape of the 3D data.') + return + _kw = {'levels': [3, 6, 12, 24, 48, 96, 192, 384], 'sigma': 'hist', 'cmap': 'Jet', 'alpha': 0.3} _kw.update(kwargs)