From af9f68e2ad791984f7616a5d675d076921cfe043 Mon Sep 17 00:00:00 2001 From: Mikkel Pedersen Date: Wed, 4 Dec 2024 16:38:29 +0100 Subject: [PATCH] fix(results): Skip light path if already processed --- honeybee_radiance_postprocess/ies/lm.py | 9 ++++++++- honeybee_radiance_postprocess/results/results.py | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/honeybee_radiance_postprocess/ies/lm.py b/honeybee_radiance_postprocess/ies/lm.py index 3c1cad31..aa3819ad 100644 --- a/honeybee_radiance_postprocess/ies/lm.py +++ b/honeybee_radiance_postprocess/ies/lm.py @@ -109,6 +109,8 @@ def dynamic_schedule_direct_illuminance( shd_trans_dict = {} for grid_info in grids_info: + grid_states_schedule = defaultdict(list) + grid_count = grid_info['count'] light_paths = [] for lp in grid_info['light_path']: @@ -178,11 +180,16 @@ def dynamic_schedule_direct_illuminance( max_indices = array_combinations_filter.argmax(axis=0) # select the combination for each hour combinations = [combinations[idx] for idx in max_indices] + # merge the combinations of dicts for combination in combinations: for light_path, value in combination.items(): if light_path != '__static_apertures__': - states_schedule[light_path].append(value) + grid_states_schedule[light_path].append(value) + + for key, value in grid_states_schedule.items(): + if key not in states_schedule: + states_schedule[key] = value occupancy_hoys = schedule_to_hoys(schedule, results.sun_up_hours) diff --git a/honeybee_radiance_postprocess/results/results.py b/honeybee_radiance_postprocess/results/results.py index 8a680026..b76daaca 100644 --- a/honeybee_radiance_postprocess/results/results.py +++ b/honeybee_radiance_postprocess/results/results.py @@ -1357,7 +1357,13 @@ def _light_paths_from_grid_info(self, grid_info: Union[dict, str]) -> list: break else: raise Exception(f'Grid info with full_id "{grid_info}" not found.') - light_paths = [elem for lp in grid_info['light_path'] for elem in lp] + light_paths = [] + for lp in grid_info['light_path']: + for _lp in lp: + if _lp == '__static_apertures__' and len(lp) > 1: + pass + else: + light_paths.append(_lp) return light_paths