wave_range

synphot.binning.wave_range(bins, cenwave, npix, mode='round')[source]

Calculate the wavelength range covered by the given number of pixels centered on the given central wavelength of the given bins.

Parameters
binsarray-like

Wavelengths at bin centers, each centered on a pixel. Must be 1D array.

cenwavefloat

Desired central wavelength, in the same unit as bins.

npixint

Desired number of pixels, centered on cenwave.

mode{‘round’, ‘min’, ‘max’, ‘none’}

Determines how the pixels at the edges of the wavelength range are handled. All the options, except ‘none’, will return wavelength range edges that correspond to pixel edges:

  • ‘round’ - Wavelength range edges are the pixel edges and the range spans exactly npix pixels. An edge that falls in the center of a bin is rounded to the nearest pixel edge. This is the default.

  • ‘min’ - Wavelength range is shrunk such that it includes an integer number of pixels and its edges fall on pixel edges. It may not span exactly npix pixels.

  • ‘max’ - Wavelength range is expanded such that it includes an integer number of pixels and its edges fall on pixel edges. It may not span exactly npix pixels.

  • ‘none’ - Exact wavelength range is returned. The edges may not correspond to pixel edges, but it covers exactly npix pixels.

Returns
wave1, wave2float

Lower and upper limits of the wavelength range.

Raises
synphot.exceptions.OverlapError

Given central wavelength is not within the given bins or the wavelength range would exceed the bin limits.

synphot.exceptions.SynphotError

Invalid inputs or calculation failed.