tools.blackbody#

This module contains black-body related functions.

skysurvey.tools.blackbody.get_blackbody_transient_source(phase, temperature, amplitude, lbda='1_000:10_000:1000j', zero_before=True, name='bb_transient')[source]#

Get an evolving blackbody sncosmo.TimeSeriesSource.

Parameters:
  • phase (array-like) – Phase.

  • temperature (float or array-like) – Temperature of the blackbody as a function of phase, in Kelvin.

  • amplitude (float or array-like) – Amplitude of the blackbody peak amplitude (Wein’s lbda_max), in flux units. If array-like, must have the same length as phase.

  • lbda (str or array-like) – Wavelength in Angstrom. If str, it is assumed to by a np.r_ format. Default is “1_000:10_000:1000j”.

  • zero_before (bool) – If True, flux is zero before the first phase; otherwise the first flux value is used. Default is True.

  • name (str) – Source name.

Return type:

sncosmo.TimeSeriesSource

skysurvey.tools.blackbody.get_blackbody_transient_flux(lbda, temperature, amplitude, normed=True)[source]#

Provide a 2D flux grid assuming blackbody temperature and amplitude evolution.

Parameters:
  • lbda (number, array-like, or astropy.units.Quantity) – Wavelength. If not a Quantity, it is assumed to be in Angstrom.

  • temperature (number, array-like, or astropy.units.Quantity) – Blackbody temperature. If not a Quantity, it is assumed to be in Kelvin.

  • amplitude (number, array-like, or astropy.units.Quantity) – Amplitude of the blackbody. If array-like, must have the same length as temperature.

  • normed (bool, default is True) – If True, each blackbody flux is normalized to its peak value (given by Wein’s lambda_max), and the returned array is dimensionless. If False, returns the flux with units. Default is True.

Returns:

Blackbody monochromatic flux normed, and scaled by its amplitude. If normed is True, returns a dimensionless array normalized to peak flux. If normed is False, returns a astropy.units.Quantity in \(erg \; cm^{-2} s^{-1} \AA^{-1} sr^{-1}\).

Return type:

2d-array

skysurvey.tools.blackbody.blackbody_nu(freq, temperature)[source]#

Calculate blackbody flux per steradian, \(B_{\nu}(T)\).

Note

Use numpy.errstate to suppress Numpy warnings, if desired.

Warning

Output values might contain nan and inf.

Parameters:
  • freq (number, array-like, or astropy.units.Quantity) – Frequency, wavelength, or wave number. If not a Quantity, it is assumed to be in Hertz.

  • temperature (number or astropy.units.Quantity) – Blackbody temperature. If not a Quantity, it is assumed to be in Kelvin.

Returns:

flux – Blackbody monochromatic flux in \(erg \; cm^{-2} s^{-1} Hz^{-1} sr^{-1}\).

Return type:

astropy.units.Quantity

Raises:
skysurvey.tools.blackbody.blackbody_lambda(lbda, temperature, normed=True)[source]#

Like blackbody_nu() but for \(B_{\lambda}(T)\).

Parameters:
  • lbda (number, array-like, or astropy.units.Quantity) – Wavelength. If not a Quantity, it is assumed to be in Angstrom.

  • temperature (number or astropy.units.Quantity) – Blackbody temperature. If not a Quantity, it is assumed to be in Kelvin.

  • normed (bool) – If True, the blackbody flux is normalized to its peak value (given by Wein’s lambda_max), and the returned array is dimensionless. If False, returns the flux with units. Default is True.

Returns:

flux – Blackbody monochromatic flux. If normed is True, returns a dimensionless array normalized to peak flux. If normed is False, returns a astropy.units.Quantity in \(erg \; cm^{-2} s^{-1} \AA^{-1} sr^{-1}\).

Return type:

ndarray or astropy.units.Quantity

skysurvey.tools.blackbody.get_wein_lbdamax(temperature)[source]#

Return the wavelength of maximum emission for a blackbody at a given temperature using Wien’s law.

\[\lambda_{\mathrm{max}} = \frac{h c}{4.96511423174 \, k_B T}\]
Parameters:

temperature (number or astropy.units.Quantity) – Blackbody temperature. If not a Quantity, it is assumed to be in Kelvin.

Returns:

lbda – Wavelength of maximum emission, in Angstrom.

Return type:

astropy.units.Quantity