ranking_HM.check_and_fix_bg_fg_lists#
Back to Module page
Summary#
Our injection codes populate bg_fg_max, but not bg_fg_by_subbank. We also want to save indices into bg_fg_by_subbank in bg_fg_max to avoid duplication in memory, but old codes might not have saved it in this format. This function fixes both issues. Run this before scoring, and re-score after.
Signature#
def check_and_fix_bg_fg_lists(bg_fg_max, bg_fg_by_subbank, extra_array_names, fobj = None, raise_error = False)
Name |
Type |
Default |
Description |
|---|---|---|---|
|
List of four lists with entries like bg_fg_max |
||
|
List of four dicts with entries like bg_fg_by_subbank |
||
|
List of names of the extra arrays in bg_fg_max |
||
|
None |
If bg_by_subbank is read from a hdf5 file, the File object (must be writeable) |
|
|
False |
Flag to raise an error if the number of triggers don’t match, just use as a check |
Output variables#
Return annotation |
Docstring type |
Description |
|---|---|---|
|
Fixes bg_fg_max and bg_fg_by_subbank in place, and also fixes the data inside fobj |
Docstring#
Our injection codes populate bg_fg_max, but not bg_fg_by_subbank.
We also want to save indices into bg_fg_by_subbank in bg_fg_max to avoid
duplication in memory, but old codes might not have saved it in this
format. This function fixes both issues. Run this before scoring, and
re-score after.
:param bg_fg_max: List of four lists with entries like bg_fg_max
:param bg_fg_by_subbank:
List of four dicts with entries like bg_fg_by_subbank
:param extra_array_names: List of names of the extra arrays in bg_fg_max
:param fobj:
If bg_by_subbank is read from a hdf5 file, the File object
(must be writeable)
:param raise_error:
Flag to raise an error if the number of triggers don't match, just use
as a check
:return:
Fixes bg_fg_max and bg_fg_by_subbank in place, and also fixes the data
inside fobj