imap_processing.hi.utils.iter_background_events_by_config#

imap_processing.hi.utils.iter_background_events_by_config(de_ds: Dataset, background_config: DataFrame) Generator[tuple[Any, Dataset], None, None]#

Iterate over background config, yielding filtered event datasets.

For each (calibration_prod, background_index) combination in the config, yields the filtered dataset containing only events that match BOTH coincidence_type AND TOF window checks.

Unlike iter_qualified_events_by_config, this does NOT filter by ESA energy step, as background counts are accumulated across all ESA steps.

Parameters:
  • de_ds (xarray.Dataset) – Direct Event dataset with coincidence_type and TOF variables. TOF variables must have FILLVAL attribute for fill value handling.

  • background_config (pandas.DataFrame) – Config DataFrame with multi-index (calibration_prod, background_index). Must have coincidence_type_values column and TOF window columns.

Yields:
  • config_row (namedtuple) – The config row from itertuples() containing background settings.

  • filtered_ds (xarray.Dataset) – Filtered dataset containing only events matching the criteria.