calculate_bin_edges

synphot.binning.calculate_bin_edges(centers)[source]

Calculate the edges of wavelength bins given the centers.

The algorithm calculates bin edges as the midpoints between bin centers and treats the first and last bins as symmetric about their centers.

Parameters:
centers : array-like or Quantity

Sequence of bin centers. Must be 1D and have at least two values. If not a Quantity, assumed to be in Angstrom.

Returns:
edges : Quantity

Array of bin edges. Will be 1D, have one more value than centers, and also the same unit.

Raises:
synphot.exceptions.SynphotError

Invalid input.