imap_processing.hi.hi_l1c.pset_backgrounds#

imap_processing.hi.hi_l1c.pset_backgrounds(pset_coords: dict[str, DataArray], background_config_df: DataFrame, l1b_de_dataset: Dataset, goodtimes_ds: Dataset, exposure_times: DataArray) dict[str, DataArray]#

Calculate pointing set backgrounds from direct events.

Computes background counts internally by filtering and binning events according to the background configuration, then calculates background rates and uncertainties. Scaling factors and uncertainties are applied per ESA energy step.

Parameters:
  • pset_coords (dict[str, xarray.DataArray]) – The PSET coordinates from the xarray.Dataset.

  • background_config_df (pandas.DataFrame) – Background configuration DataFrame with MultiIndex (calibration_prod, background_index, esa_energy_step).

  • l1b_de_dataset (xarray.Dataset) – The L1B dataset for the pointing being processed.

  • goodtimes_ds (xarray.Dataset) – Goodtimes dataset with cull_flags.

  • exposure_times (xarray.DataArray) – Exposure times with dims (epoch, esa_energy_step, spin_angle_bin).

Returns:

Dictionary containing background_rates and background_rates_uncertainty DataArrays to be added to the PSET dataset.

Return type:

dict[str, xarray.DataArray]