imap_processing.hi.utils.get_bin_range_with_wrap#

imap_processing.hi.utils.get_bin_range_with_wrap(first_bin: int, last_bin: int, n_bins: int, extend_by: int) ndarray#

Get bin range with wraparound and optional extension.

Computes a range of bin indices from first_bin to last_bin, optionally extending by a padding amount on each side, with proper wraparound handling for circular bin structures (e.g., spin bins).

Parameters:
  • first_bin (int) – First bin index in the range.

  • last_bin (int) – Last bin index in the range (may be less than first_bin if wrapping).

  • n_bins (int) – Total number of bins (bins are 0 to n_bins-1).

  • extend_by (int) – Number of bins to add on each side of the range.

Returns:

bins – Array of bin indices in the range, with wrapping handled.

Return type:

np.ndarray