r'''Returns the spectral radiance, in units of W/m^2/sr/µm.

    .. math::
        I_{\lambda,blackbody,e}(\lambda,T)=\frac{2hc_o^2}
        {\lambda^5[\exp(hc_o/\lambda k T)-1]}

    Parameters
    ----------
    T : float
        Temperature of the surface, [K]
    wavelength : float
        Length of the wave to be considered, [m]

    Returns
    -------
    I : float
        Spectral radiance [W/(m^2*sr*m)]

    Notes
    -----
    Can be used to derive the Stefan-Boltzman law, or determine the maximum
    radiant frequency for a given temperature.
    
    Examples
    --------
    Checked with Spectral-calc.com, at [2]_.

    >>> blackbody_spectral_radiance(800., 4E-6)
    1311692056.2430143
    
    Calculation of power from the sun (earth occupies 6.8E-5 steradian of the
    sun):
        
    >>> from scipy.integrate import quad
    >>> rad = lambda l: blackbody_spectral_radiance(5778., l)*6.8E-5
    >>> quad(rad, 1E-10, 1E-4)[0]
    1367.9808043781559

    References
    ----------
    .. [1] Bergman, Theodore L., Adrienne S. Lavine, Frank P. Incropera, and
       David P. DeWitt. Introduction to Heat Transfer. 6E. Hoboken, NJ:
       Wiley, 2011.
    .. [2] Spectral-calc.com. Blackbody Calculator, 2015.
       http://www.spectralcalc.com/blackbody_calculator/blackbody.php

def blackbody_spectral_radiance(T, wavelength):
    r'''Returns the spectral radiance, in units of W/m^2/sr/µm.

    .. math::
        I_{\lambda,blackbody,e}(\lambda,T)=\frac{2hc_o^2}
        {\lambda^5[\exp(hc_o/\lambda k T)-1]}

    Parameters
    ----------
    T : float
        Temperature of the surface, [K]
    wavelength : float
        Length of the wave to be considered, [m]

    Returns
    -------
    I : float
        Spectral radiance [W/(m^2*sr*m)]

    Notes
    -----
    Can be used to derive the Stefan-Boltzman law, or determine the maximum
    radiant frequency for a given temperature.
    
    Examples
    --------
    Checked with Spectral-calc.com, at [2]_.

    >>> blackbody_spectral_radiance(800., 4E-6)
    1311692056.2430143
    
    Calculation of power from the sun (earth occupies 6.8E-5 steradian of the
    sun):
        
    >>> from scipy.integrate import quad
    >>> rad = lambda l: blackbody_spectral_radiance(5778., l)*6.8E-5
    >>> quad(rad, 1E-10, 1E-4)[0]
    1367.9808043781559

    References
    ----------
    .. [1] Bergman, Theodore L., Adrienne S. Lavine, Frank P. Incropera, and
       David P. DeWitt. Introduction to Heat Transfer. 6E. Hoboken, NJ:
       Wiley, 2011.
    .. [2] Spectral-calc.com. Blackbody Calculator, 2015.
       http://www.spectralcalc.com/blackbody_calculator/blackbody.php
    '''
    try:
        return 2.*h*c**2/wavelength**5/(exp(h*c/(wavelength*T*k)) - 1.)
    except OverflowError:
        return 0.0