Skip to content

Commit a5f725a

Browse files
peterhollenderebrahimebrahim
authored andcommitted
enable keep_attrs when aggregating sim results #342
1 parent 987b932 commit a5f725a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/openlifu/plan/protocol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ def calc_solution(
337337

338338
if simulate:
339339
# Finally the resulting pressure is max-aggregated and intensity is mean-aggregated, over all focus points .
340-
pnp_aggregated = solution.simulation_result['p_min'].max(dim="focal_point_index")
341-
ppp_aggregated = solution.simulation_result['p_max'].max(dim="focal_point_index")
340+
pnp_aggregated = solution.simulation_result['p_min'].max(dim="focal_point_index", keep_attrs=True)
341+
ppp_aggregated = solution.simulation_result['p_max'].max(dim="focal_point_index", keep_attrs=True)
342342
# TODO: Ensure this mean is weighted by the number of times each point is focused on, once openlifu supports hitting points different numbers of times
343-
intensity_aggregated = solution.simulation_result['intensity'].mean(dim="focal_point_index")
343+
intensity_aggregated = solution.simulation_result['intensity'].mean(dim="focal_point_index", keep_attrs=True)
344344
simulation_result_aggregated = deepcopy(solution.simulation_result)
345345
simulation_result_aggregated = simulation_result_aggregated.drop_dims("focal_point_index")
346346
simulation_result_aggregated['p_min'] = pnp_aggregated

0 commit comments

Comments
 (0)