From 77ed1f79cd180c47bdc551e9a5946934b1061e9c Mon Sep 17 00:00:00 2001 From: Lynne Jones Date: Thu, 20 Feb 2025 22:16:37 -0800 Subject: [PATCH] Fix bug in BandToFilterDetailer --- rubin_scheduler/scheduler/detailers/detailer.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/rubin_scheduler/scheduler/detailers/detailer.py b/rubin_scheduler/scheduler/detailers/detailer.py index 0b664f6..55648c4 100644 --- a/rubin_scheduler/scheduler/detailers/detailer.py +++ b/rubin_scheduler/scheduler/detailers/detailer.py @@ -155,14 +155,10 @@ def __init__(self, band_to_filter_dict=None): def __call__(self, observation_array, conditions): u_bands = np.unique(observation_array["band"]) for band in u_bands: - indx = np.where(observation_array["band"] == band)[0] - if band not in self.band_to_filter_dict.keys(): - # If the BandToFilterDetailer was set up with an - # empty dictionary (not None), then just copy the configured - # (possibly physical filtername) into band. - observation_array[indx]["filter"] = band - else: - observation_array[indx]["filter"] = self.band_to_filter_dict[band] + indx = np.where(observation_array["band"] == band) + # Fetch the dictionary value or just continue to use band + filtername = self.band_to_filter_dict.get(band, band) + observation_array["filter"][indx] = filtername return observation_array