jax_sn.energy_set.energy_set_overlap module¶
- compute_overlap_matrix(old_boundaries, new_boundaries)[source]¶
Computes the matrix of weighted averages between two sets of boundaries. The overlap is defined as the fraction of the old group that overlaps with the new group.
Works for both a higher resolution new group structure and a lower resolution new group structure. E.g. if the old group structure is [8,6,2,1] and the new group structure is [8,7,6,5,4,3,2,1], then the overlap matrix will be: [[0.5 , 0. , 0. ],
[0.5 , 0. , 0. ], [0. , 0.25, 0. ], [0. , 0.25, 0. ], [0. , 0.25, 0. ], [0. , 0.25, 0. ], [0. , 0. , 1. ]]
and thus the first new energy group is half of the first old energy group, the second new energy group is half of the first old energy group, the third new energy group is a quarter of the second old energy group, and so on.
This overlap matrix can be used to compute values defined on the old group structure on a new group structure:
new_group_values = overlap_matrix @ old_group_values
- Parameters:
old_boundaries (1D array-like) – The boundaries of the old groups.
new_boundaries (1D array-like) – The boundaries of the new groups.
- Returns:
overlap – The overlap matrix, where overlap[i, j] is the fraction of the old group i that overlaps with the new group j.
- Return type:
2D array