From 4af7cf7a670eda24904a466201843eb4108b0e03 Mon Sep 17 00:00:00 2001 From: Abelardo Moralejo Date: Mon, 22 Jan 2024 16:41:32 +0100 Subject: [PATCH] Deal with missing modules in modifier.py Just unse nanmedian, nanstd to skip non-existent pixels --- lstchain/image/modifier.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lstchain/image/modifier.py b/lstchain/image/modifier.py index 29a28e8348..59b0622933 100644 --- a/lstchain/image/modifier.py +++ b/lstchain/image/modifier.py @@ -230,8 +230,8 @@ def calculate_noise_parameters(simtel_filename, data_dl1_filename, # Identify noisy pixels, likely containing stars - we want to adjust MC to # the average diffuse NSB across the camera - data_median_std_ped_pe = np.median(data_HG_ped_std_pe) - data_std_std_ped_pe = np.std(data_HG_ped_std_pe) + data_median_std_ped_pe = np.nanmedian(data_HG_ped_std_pe) + data_std_std_ped_pe = np.nanstd(data_HG_ped_std_pe) log.info(f'Real data: median across camera of good pixels\' pedestal std ' f'{data_median_std_ped_pe:.3f} p.e.') brightness_limit = data_median_std_ped_pe + 3 * data_std_std_ped_pe @@ -247,7 +247,7 @@ def calculate_noise_parameters(simtel_filename, data_dl1_filename, # Exclude too bright pixels, besides those with unusable calibration: good_pixels &= ~too_bright_pixels # recalculate the median of the pixels' std dev, with good_pixels: - data_median_std_ped_pe = np.median(data_HG_ped_std_pe[good_pixels]) + data_median_std_ped_pe = np.nanmedian(data_HG_ped_std_pe[good_pixels]) log.info(f'Good and not too bright pixels: {good_pixels.sum()}')