binspec¶
- sofia_redux.spectroscopy.binspec.binspec(x, y, delta, xout=None, lmin=None, lmax=None, average=False)[source]¶
Bin a spectrum between lmin and lmax with bins delta wide
Output wavelength bins are calculated from input lmin/lmax/dl. Flux values at edges of bins are interpolated, and values between the edges are summed. If desired, the summed flux is divided by the bin size. If either lmin or lmax is None, and xout is provided, the bins are assumed to be uneven and may have gaps.
- Parameters:
- xarray_like of (int or float)
Independent variable
- yarray_like of (int or float)
Dependent variable
- deltaint or float or (array_like of (int or float))
Bin width. May be a scalar value or 1-D array (N_out,) matching the output data array size of the second dimension.
- xoutint or float or array_like of (int or float), optional
Output locations
- lminint or float, optional
Minimum value of independent variable
- lmaxint or float, optional
Maximum value of independent variable
- averagebool, optional
If True, average the y over the bin (to conserve flux)
- Returns:
- numpy.ndarray
(2, N) where [0, :] = x out, and [1, :] = y out