lentil.radiometry.Blackbody.bin#

Blackbody.bin(wave, interp_method='simps', ends='symmetric', preserve_power=True, sample_method='linear', fill_value=0, waveunit='nm')#

Compute a binned representation of the Spectrum data at a given array of central wavelengths.

The general algorithm computes bin edges, sampling the Spectrum values at these edges, and numerically integrating within the edges of each bin. For n bins (centered at the wavelength values in the wave array), there will be n+1 edges. The edges at each bin centered at λk are given by

eleft=λkλkλk12eright=λk+λk+1λk2

Special treatment is required for the first and last edges (λk= wave[0] and λk= wave[-1]) since λk1 and λk+1 are undefined, respectively.

Two different first/last bin edge methods are available:

../../_images/spectrum_bin.png

ends

Left edge for wave[0]

Right edge for wave[-1]

symmetric

λ1λ2λ12

λend+λendλend12

inside

λ1

λend

Parameters:
  • wave (array_like) – Central wavelength set for binning. At least two wavelengths must be provided.

  • interp_method ({'simps', 'trapz'}, optional) – Numerical integration method. ‘simps’ (default) is better for smooth data while ‘trapz’ is better for linear data.

  • ends ({'symmetric', 'inside'}, optional) – Method for handling the first and last bin edge value. Default is ‘symmetric’. See the notes below for details on the available methods.

  • preserve_power (bool, optional)

  • sample_method ({'linear', 'quadratic', 'cubic'}, optional) –

    • ‘linear’ uses linear interpolation (default)

    • ’quadratic’ uses second order spline interpolation

    • ’cubic’ uses third order spline interpolation

  • fill_value (float or array_like, optional) –

    • If a float, this value will be used to fill in requested points outside of the data range.

    • If a two-element array, the first element is used to fill value_new < value[0] and the second element is used for value_new > value[-1].

    • If not provided, the default is 0.

Returns:

value – The binned values, same shape as wave.

Return type:

ndarray