Planck and thermal radiation

Overview

This module provides functions for Planck law exitance calculations, as well as temperature derivative calculations. The functions provide spectral exitance in [W/(m^2.*)] or [q/(s.m^2.*)], given the temperature and a vector of one of wavelength, wavenumbers or frequency (six combinations each for exitance and temperature derivative). The total exitance can also be calculated by using the Stefan-Boltzmann equation, in [W/m^2] or [q/(s.m^2)]. ‘Exitance’ is the CIE/ISO term for the older term ‘emittance’.

The Planck and temperature-derivative Planck functions take the spectral variable (wavelength, wavenumber or frequency) and/or temperature as either a scalar, a single element list, a multi-element list or a numpy array.

Spectral values must be strictly scalar or shape (N,) or (N,1). Shape (1,N) will not work.

Temperature values must be strictly scalar, list[M], shape (M,), (M,1), or (1,M). Shape (Q,M) will not work.

If the spectral variable and temperature are both single numbers (scalars or lists with one element), the return value is a scalar. If either the temperature or the spectral variable are single-valued, the return value is a rank-1 vector. If both the temperature and spectral variable are multi-valued, the return value is a rank-2 array, with the spectral variable along axis=0.

This module uses the CODATA physical constants. For more details see http://physics.nist.gov/cuu/pdf/RevModPhysCODATA2010.pdf

See the __main__ function for testing and examples of use.

This package was partly developed to provide additional material in support of students and readers of the book Electro-Optical System Analysis and Design: A Radiometry Perspective, Cornelius J. Willers, ISBN 9780819495693, SPIE Monograph Volume PM236, SPIE Press, 2013. http://spie.org/x648.html?product_id=2021423&origin_id=x646

Module classes

class PlanckConstants[source]

Bases: object

Precalculate the Planck function constants using the values in scipy.constants. Presumably these constants are up to date and will be kept up to date.

This module uses the CODATA physical constants. For more details see http://physics.nist.gov/cuu/pdf/RevModPhysCODATA2010.pdf

Reference: https://docs.scipy.org/doc/scipy/reference/constants.html

an(x, n)[source]

Root equation for Wien’s displacement law: n(1 - exp(-x)) - x = 0.

Parameters:
  • x (|) – dimensionless spectral coordinate.

  • n (|) – power in the Planck spectral factor (2, 3, 4, or 5).

Returns:

value of n(1 - exp(-x)) - x; zero at the Wien displacement root.

Return type:

float

Raises:

| No exception is raised.

printConstants()[source]

Print Planck function constants.

Parameters:

None (|)

Returns:

Print to stdout

Raises:

| No exception is raised.

Module functions

planck(spectral, temperature, type='el')[source]

Planck law spectral exitance.

Calculates the Planck law spectral exitance from a surface at the stated temperature. Temperature can be a scalar, a list or an array. Exitance can be given in radiant or photon rate units, depending on user input in type.

Parameters:
  • spectral (|) – spectral vector.

  • temperature (|) – Temperature in [K]

  • type (|)

  • [W/m^2]. (| 'e' signifies Radiant values in)

  • [quanta/ (| 'q' signifies photon rate values)

  • [micrometer]. (| 'l' signifies wavelength spectral vector)

  • [cm-1]. (| 'n' signifies wavenumber spectral vector)

  • [Hz]. (| 'f' signifies frequency spectral vector)

Returns:

spectral radiant exitance (not radiance) in units selected. | For type = ‘el’ units will be [W/(m^2.um)]. | For type = ‘qf’ units will be [q/(s.m^2.Hz)]. | Other return types are similarly defined as above. | Returns None on error.

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplanck(spectral, temperature, type='el')[source]

Temperature derivative of Planck law exitance.

Calculates the temperature derivative for Planck law spectral exitance from a surface at the stated temperature. dM/dT can be given in radiant or photon rate units, depending on user input in type. Temperature can be a scalar, a list or an array.

Parameters:
  • spectral (|) – spectral vector in [micrometer], [cm-1] or [Hz].

  • temperature (|) – Temperature in [K]

  • type (|)

  • [W/ (| 'e' signifies Radiant values in)

  • [quanta/ (| 'q' signifies photon rate values)

  • [micrometer]. (| 'l' signifies wavelength spectral vector)

  • [cm-1]. (| 'n' signifies wavenumber spectral vector)

  • [Hz]. (| 'f' signifies frequency spectral vector)

Returns:

spectral radiant exitance (not radiance) in units selected. | For type = ‘el’ units will be [W/(m2.um.K)] | For type = ‘qf’ units will be [q/(s.m2.Hz.K)] | Other return types are similarly defined as above. | Returns None on error.

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

planck_integral(wavenum, temperature, radiant, niter=512)[source]

Integrated Planck law spectral exitance by summation from wavenum to infty.

http://www.spectralcalc.com/blackbody/inband_radiance.html http://www.spectralcalc.com/blackbody/appendixA.html Integral of spectral radiance from wavenum (cm-1) to infinity. Follows Widger and Woodall, Bulletin of Am Met Soc, Vol. 57, No. 10, pp. 1217.

Parameters:
  • wavenum (|) – spectral lower limit in [cm-1].

  • temperature (|) – Temperature in [K]

  • radiant (|) – output units required, W/m2 or q/(s.m2)

Returns:

exitance (not radiance) in units selected. | For radiant units will be [W/(m^2)]. | For not radiant units will be [q/(s.m^2)].

Return type:

(scalar)

Raises:

| No exception is raised, returns None on error.

planckInt(spectralLo, spectralHi, temperature, type='el')[source]

Integrated Planck law spectral exitance.

Calculates the integral of the Planck law spectral exitance from a surface at the stated temperature over the specified spectral range. Temperature can be a scalar, a list or an array. Exitance can be returned in radiant or photon rate units, depending on user input in type.

http://www.spectralcalc.com/blackbody/inband_radiance.html http://www.spectralcalc.com/blackbody/appendixA.html

Parameters:
  • spectralLo (|) – spectral lower limit.

  • spectralHi (|) – spectral upper limit.

  • temperature (|) – Temperature in [K]

  • type (|)

  • [W/m^2]. (| 'e' signifies Radiant values in)

  • [quanta/ (| 'q' signifies photon rate values)

  • [micrometer]. (| 'l' signifies wavelength spectral vector)

  • [cm-1]. (| 'n' signifies wavenumber spectral vector)

  • [Hz]. (| 'f' signifies frequency spectral vector)

Returns:

spectral radiant exitance (not radiance) in units selected. | For type = ‘e*’ units will be [W/(m^2)]. | For type = ‘q*’ units will be [q/(s.m^2)]. | Returns None on error.

Return type:

(scalar)

Raises:

| No exception is raised, returns None on error.

stefanboltzman(temperature, type='e')[source]

Stefan-Boltzman wideband integrated exitance.

Calculates the total Planck law exitance, integrated over all wavelengths, from a surface at the stated temperature. Exitance can be given in radiant or photon rate units, depending on user input in type.

Parameters:
  • temperature (|) – Temperature in [K]

  • type (|) – ‘e’ for radiant or ‘q’ for photon rate exitance.

Returns:

integrated radiant exitance in [W/m^2] or [q/(s.m^2)]. | Returns a -1 if the type is not ‘e’ or ‘q’

Return type:

(float)

Raises:

| No exception is raised.

planckel(spectral, temperature)[source]

Planck function in wavelength for radiant exitance.

Parameters:
  • spectral (|) – wavelength vector in [um]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in W/(m^2.um)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

plancken(spectral, temperature)[source]

Planck function in wavenumber for radiant exitance.

Parameters:
  • spectral (|) – wavenumber vector in [cm^-1]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in W/(m^2.cm^-1)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

planckef(spectral, temperature)[source]

Planck function in frequency for radiant exitance.

Parameters:
  • spectral (|) – frequency vector in [Hz]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in W/(m^2.Hz)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

planckql(spectral, temperature)[source]

Planck function in wavelength domain for photon rate exitance.

Parameters:
  • spectral (|) – wavelength vector in [um]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in q/(s.m^2.um)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

planckqn(spectral, temperature)[source]

Planck function in wavenumber domain for photon rate exitance.

Parameters:
  • spectral (|) – wavenumber vector in [cm^-1]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in q/(s.m^2.cm^-1)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

planckqf(spectral, temperature)[source]

Planck function in frequency domain for photon rate exitance.

Parameters:
  • spectral (|) – frequency vector in [Hz]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in q/(s.m^2.Hz)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplnckel(spectral, temperature)[source]

Temperature derivative of Planck function in wavelength domain for radiant exitance.

Parameters:
  • spectral (|) – wavelength vector in [um]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in W/(K.m^2.um)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplncken(spectral, temperature)[source]

Temperature derivative of Planck function in wavenumber domain for radiant exitance.

Parameters:
  • spectral (|) – wavenumber vector in [cm^-1]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in W/(K.m^2.cm^-1)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplnckef(spectral, temperature)[source]

Temperature derivative of Planck function in frequency domain for radiant exitance.

Parameters:
  • spectral (|) – frequency vector in [Hz]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance/K in W/(K.m^2.Hz)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplnckql(spectral, temperature)[source]

Temperature derivative of Planck function in wavelength domain for photon rate exitance.

Parameters:
  • spectral (|) – wavelength vector in [um]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in q/(K.s.m^2.um)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplnckqn(spectral, temperature)[source]

Temperature derivative of Planck function in wavenumber domain for photon rate.

Parameters:
  • spectral (|) – wavenumber vector in [cm^-1]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in q/(K.s.m^2.cm^-1)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

dplnckqf(spectral, temperature)[source]

Temperature derivative of Planck function in frequency domain for photon rate.

Parameters:
  • spectral (|) – frequency vector in [Hz]

  • temperature (|) – Temperature in [K]

Returns:

spectral radiant exitance in q/(K.s.m^2.Hz)

Return type:

(scalar, np.array[N,M])

Raises:

| No exception is raised, returns None on error.

fixDimensions(planckFun)[source]

Decorator that normalises spectral and temperature array dimensions before and after the core Planck calculation.

The decorated Planck functions operate element-wise on flat arrays. This decorator:

  1. Validates that spectral is shape (N,) or (N,1) (not a row vector).

  2. Validates that temperature is a vector (M,), (M,1) or (1,M).

  3. Builds a flattened meshgrid of all (spectral, temperature) pairs.

  4. Calls the wrapped function on the flat arrays.

  5. Reshapes the result to the correct output shape.

Output shape rules:

  • Both scalar → scalar (numpy 0-d).

  • Array spectral (N), scalar temperature → shape (N,).

  • Scalar spectral, array temperature (M) → shape (1, M).

  • Array spectral (N), array temperature (M) → shape (N, M).

Parameters:

planckFun (|) – Planck function that accepts flat (spec, temp) arrays.

Returns:

Wrapped function with automatic dimension handling.

Return type:

callable

Raises:

| No exception is raised; returns None on invalid input shape.