From 85210ec0875fa6a4cf4018783b31eb7a2e6637b6 Mon Sep 17 00:00:00 2001 From: Anton Akhmerov <anton.akhmerov@gmail.com> Date: Mon, 31 Dec 2018 13:07:33 +0100 Subject: [PATCH] correctly ignore missing data in limit calculations --- kwant/plotter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kwant/plotter.py b/kwant/plotter.py index fc814704..d7fe0a22 100644 --- a/kwant/plotter.py +++ b/kwant/plotter.py @@ -1302,6 +1302,7 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None, # Calculate the min/max bounds for the colormap. # User-provided values take precedence. unmasked_data = img[~img.mask].data.flatten() + unmasked_data = unmasked_data[~np.isnan(unmasked_data)] new_vmin, new_vmax = percentile_bound(unmasked_data, vmin, vmax) overflow_pct = 100 * np.sum(unmasked_data > new_vmax) / len(unmasked_data) underflow_pct = 100 * np.sum(unmasked_data < new_vmin) / len(unmasked_data) -- GitLab