From 3603a6d6422007900093f0838b96c3dbfc320a7b Mon Sep 17 00:00:00 2001 From: "houhan@gmail.com" Date: Wed, 25 Oct 2023 04:12:28 +0000 Subject: [PATCH] bug fix ccf nan size --- code/pages/1_CCF_view.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/pages/1_CCF_view.py b/code/pages/1_CCF_view.py index e7dfabe..cabe6ac 100644 --- a/code/pages/1_CCF_view.py +++ b/code/pages/1_CCF_view.py @@ -26,10 +26,12 @@ def _get_min_max(): return np.percentile(x_gamma_all, 5), np.percentile(x_gamma_all, 95) def _size_mapping(x): - x = x / np.quantile(x, 0.95) + x = x / np.quantile(x[~np.isnan(x)], 0.95) x_gamma = x**size_gamma min_x, max_x = _get_min_max() - return size_range[0] + x_gamma / (max_x - min_x) * (size_range[1] - size_range[0]) + sizes = size_range[0] + x_gamma / (max_x - min_x) * (size_range[1] - size_range[0]) + sizes[np.isnan(sizes)] = 0 + return sizes def _smooth_heatmap(data, sigma): '''https://stackoverflow.com/questions/18697532/gaussian-filtering-a-image-with-nan-in-python/36307291#36307291'''