Package ComboCode :: Package cc :: Package modeling :: Package profilers :: Module Radiance :: Class Radiance
[hide private]
[frames] | no frames]

Class Radiance

source code


An interface for a spectral radiance and its derivative.

Instance Methods [hide private]
 
__init__(self, func, f=None, l=None, dfunc=None, order=3, *args, **kwargs)
Create an instance of the Radiance() class.
source code
 
setSurface(self, rstar)
Define the surface area of the star.
source code
array/float
eval(self, f=None, l=None, ftype='Rnu', warn=1)
Evaluate the radiance function at a coordinate point.
source code
array/float
diff(self, f=None, l=None, warn=1)
Evaluate the derivative of the radiance function at a coordinate point.
source code
array
getLuminosity(self, surface=None, f=None, l=None, ftype='Lnu', warn=1)
Return the spectral luminosity, i.e.
source code
array
getFluxDensity(self, f=None, l=None, ftype='Fnu', warn=1)
Return the spectral flux density, i.e.
source code
array
getIntensity(self, surface=None, f=None, l=None, ftype='Inu', warn=1)
Return the spectral intensity, i.e.
source code

Inherited from cc.modeling.profilers.Profiler.Profiler: __call__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, func, f=None, l=None, dfunc=None, order=3, *args, **kwargs)
(Constructor)

source code 

Create an instance of the Radiance() class. Requires a frequency grid and a spectral radiance function.

The function can also be given as an interpolation object.

The optional args and kwargs give the additional arguments for the temperature function, which are ignored in case func is an interp1d object.

Parameters:
  • func (function) - The function that describes the intensity profile. Can be given as an interp1d object.
  • f (array) - The frequency points (Hz). This or wavelength array must be given!

    (default: None)

  • l (array) - The wavelength points (cm). This or frequency array must be given!

    (default: None)

  • dfunc (function/interpolation object) - The function that describes the derivative of the profile with respect to r. Can be given as an interp object. If None, a generic central difference is taken and interpolated.

    (default: None)

  • order (int) - Order of the spline interpolation. Default is cubic.

    (default: 3)

  • args (tuple) - Additional parameters passed to the functions when eval or diff are called.

    (default: [])

  • kwargs (dict) - Additional keywords passed to the functions when eval or diff are called.

    (default: {})

Overrides: object.__init__

setSurface(self, rstar)

source code 

Define the surface area of the star.

Parameters:
  • rstar (float) - The stellar radius (cm)

eval(self, f=None, l=None, ftype='Rnu', warn=1)

source code 

Evaluate the radiance function at a coordinate point.

l/f can be any value or array. If func is an interpolation object, it is in principle limited by the l/f-range of the interpolator. However, extrapolation is enabled, but it is advised not to extend much beyond the given l/f-range.

Can be evaluated both in frequency and wavelength (l or f), and with respect to both frequency and wavelength (ftype).

Parameters:
  • f (array/float) - The frequency grid (Hz). Passed to self.eval(). Can be None in which case the default grid is used. Can also be given as wavelength

    (default: None)

  • l (array/float) - The wavelength grid (cm). Converted to frequency before evaluation.

    (default: None)

  • ftype (str) - Return the spectral radiance with respect to wavelength or frequency. Given as '*nu' or '*lambda', where * is R, I, F, ... Default is always '*nu', also when ftype is not recognized. Rlambda is calculated from Rlambda = Rnu*nu/lambda.

    (default: 'Rnu')

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

Returns: array/float
The profile evaluated at l/f (erg/s/cm2/Hz/sr or erg/s/cm3/sr)
Overrides: cc.modeling.profilers.Profiler.Profiler.eval

diff(self, f=None, l=None, warn=1)

source code 

Evaluate the derivative of the radiance function at a coordinate point.

For now only possible with respect to frequency.

x can be any value or array. If func is an interpolation object, it is in principle limited by the x-range of the interpolator. However, linear extrapolation is enabled, but it is advised not to extend much beyond the given x-range.

Parameters:
  • f (array/float) - The frequency grid (Hz). Passed to self.eval(). Can be None in which case the default grid is used. Can also be given as wavelength

    (default: None)

  • l (array/float) - The wavelength grid (cm). Converted to frequency before evaluation.

    (default: None)

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

Returns: array/float
The derivative evaluated at l or f
Overrides: cc.modeling.profilers.Profiler.Profiler.diff

getLuminosity(self, surface=None, f=None, l=None, ftype='Lnu', warn=1)

source code 

Return the spectral luminosity, i.e. integrated over the surface and solid angle, as a function of frequency or wavelength.

Integrated over frequency, this leads to the (total) luminosity, or also the "flux". Do not integrate over wavelength! Units not right for that.

Note that the integration over solid angle leads to the factor of pi. Fnu = Int(cos(theta) dOmega) = Int Int (cos(theta)sin(theta)dtheta dpsi) which has primitive function sin^2(t)/, psi in [0,2pi], theta in [0,pi/2]. Note that this is the outgoing flux, along the direction of the ray (opposite the direction would be [pi/2,pi], since theta is wrt the normal of the surface).

Can be evaluated both in frequency and wavelength (l or f), and with respect to both frequency and wavelength (ftype).

Parameters:
  • surface (float) - The surface over which the energy is being emitted (cm^2). If None, self.setSurface must have been called before. self.surface gives the stellar surface area.

    (default: None)

  • f (array/float) - The frequency grid (Hz). Passed to self.eval(). Can be None in which case the default grid is used. Can also be given as wavelength

    (default: None)

  • l (array/float) - The wavelength grid (cm). Converted to frequency before evaluation.

    (default: None)

  • ftype (str) - Return spectral luminosity with respect to wavelength or frequency. Given as 'Lnu' or 'Llambda'. Default is always 'Lnu', also when ftype is not recognized. Llambda is calculated from Llambda = Lnu*nu/lambda.

    (default: 'Lnu')

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

Returns: array
The spectral luminosity (erg/s/Hz or erg/s/cm)

getFluxDensity(self, f=None, l=None, ftype='Fnu', warn=1)

source code 

Return the spectral flux density, i.e. integrated over solid angle, as a function of wavelength.

Integrated over wavelength, this leads to the (total) flux density. For integration over wavelength, convert to Flambda = Fnu*nu/lambda first.

Note that the integration over solid angle leads to the factor of pi. Fnu = Int(cos(theta) dOmega) = Int Int (cos(theta)sin(theta)dtheta dpsi) which has primitive function sin^2(t)/2, psi in [0,2pi], theta in [0,pi/2]. Note that this is the outgoing flux, along the direction of the ray (opposite the direction would be [pi/2,pi], since theta is wrt the normal of the surface).

Can be evaluated both in frequency and wavelength (l or f), and with respect to both frequency and wavelength (ftype).

Parameters:
  • f (array/float) - The frequency grid (Hz). Passed to self.eval(). Can be None in which case the default grid is used. Can also be given as wavelength

    (default: None)

  • l (array/float) - The wavelength grid (cm). Converted to frequency before evaluation.

    (default: None)

  • ftype (str) - Return the spectral flux dens with respect to wavelength or frequency. Given as 'Fnu' or 'Flambda'. Default is always 'Fnu', also when ftype is not recognized. Flambda is calculated from Flambda = Fnu*nu/lambda.

    (default: 'Fnu')

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

Returns: array
The spectral flux density (erg/s/cm2/Hz or erg/s/cm3)

getIntensity(self, surface=None, f=None, l=None, ftype='Inu', warn=1)

source code 

Return the spectral intensity, i.e. integrated over the surface, as a function of wavelength or frequency.

Integrated over frequency, this leads to the (total) intensity. Do not integrate over wavelength! Units not right for that.

Not to be confused with the specific intensity, which is the radiance or brightness of the source!

Can be evaluated both in frequency and wavelength (l or f), and with respect to both frequency and wavelength (ftype).

Parameters:
  • surface (float) - The surface over which the energy is being emitted (cm^2). If None, self.setSurface must have been called before. self.surface gives the stellar surface area.

    (default: None)

  • f (array/float) - The frequency grid (Hz). Passed to self.eval(). Can be None in which case the default grid is used. Can also be given as wavelength

    (default: None)

  • l (array/float) - The wavelength grid (cm). Converted to frequency before evaluation.

    (default: None)

  • ftype (str) - Return the spectral intensity with respect to wavelength or frequency. Given as 'Inu' or 'Ilambda'. Default is always 'Inu', also when ftype is not recognized. Ilambda is calculated from Ilambda = Inu*nu/lambda.

    (default: 'Inu')

  • warn (bool) - Warn when extrapolation occurs.

    (default: 1)

Returns: array
The spectral intensity (erg/s/Hz/sr or erg/s/cm/sr)