Skip to content

Commit

Permalink
refactor(grid mapping): Exlucde option to rweturn additional output
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelkp authored and mostaphaRoudsari committed Mar 23, 2022
1 parent 9a1c971 commit 12bd8ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion honeybee_radiance_folder/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ def grid_mapping(self):
three_phase_dict = dict()

for grid in grid_info:
light_paths = grid['light_path']
light_paths = grid.get('light_path', [])
for light_path in light_paths:
light_path = light_path[0]
if light_path in non_mtx_groups:
Expand Down
16 changes: 5 additions & 11 deletions honeybee_radiance_folder/gridutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def redistribute_sensors(
input_folder, output_folder, grid_count, min_sensor_count=2000,
extension='pts', grid_info=None, return_out_grid_info=False, verbose=False
extension='pts', grid_info=None, verbose=False
):
"""Create new sensor grids folder with evenly distributed sensors.
Expand Down Expand Up @@ -54,21 +54,17 @@ def redistribute_sensors(
sensor files. Another common extension is ``csv`` for generic data sets.
grid_info: Optional list of dictionaries with grid information. Use this instead
of the expected _info.json file in the input_folder.
return_out_grid_info: Boolean switch to return output grid information.
Default: False
verbose: Set to True to get verbose reporting. Default: False.
Returns:
A tuple with two elements
A tuple with three elements
- grid_count: Number of output sensor grids. Keep in mind that this number can
be adjusted based on the min_sensor_count.
- sensor_per_grid: Number of sensors in each newly created sensor grid.
If return_out_grid_info is True the function returns an additional element
- out_grid_info: Grid information of the redistributed grid(s).
- out_grid_info: Grid information as written to _info.json.
"""
if grid_info is None:
info_file = os.path.join(input_folder, '_info.json')
Expand Down Expand Up @@ -201,10 +197,8 @@ def get_target_file(index):
total_count, grid_count, sensor_per_grid
)
)
if return_out_grid_info:
return grid_count, sensor_per_grid, out_grid_info
else:
return grid_count, sensor_per_grid

return grid_count, sensor_per_grid, out_grid_info


def restore_original_distribution(
Expand Down

0 comments on commit 12bd8ce

Please sign in to comment.