__init__(self,
l,
func,
dfunc=None,
order=3,
*args,
**kwargs)
(Constructor)
| source code
|
Create an instance of the Opacity() class. Requires a wavelength
grid.
The function can also be given as an interpolation object.
The optional args and kwargs give the additional arguments for the
opacity function, which are ignored in case func is an interpolation
object.
Eval and diff work with the mass extinction coefficient in cm2/g.
In case func refers to an interpolation object in KappaReader, the
args/kwargs should always contain an index indicating whether extinction
(default), absorption or scattering is requested:
-
0: extinction,
-
1: absorption,
-
2: scattering
Note that if func is an interpolator object, the original input x and
y grids can be passed as additional keywords xin/lin and yin, which would
then be arrays. Otherwise, the x and the interpolator(x) are set as
xin/lin and yin. xin/lin and yin are ignored if func is a function, even
if it returns an interpolator (in which case the original grids are
known)
Extrapolation is done outside of the "original" (depending
on if xin/yin are given) wavelength ranges according to a power law
~l^-alpha, with alpha given upon eval() calls.
- Parameters:
l (array) - The wavelength points (cm)
func (function) - The function that describes the opacity profile. Can be given as
an interpolation object, in which case lin and yin keywords can
be passed as arrays for the original grids.
dfunc (function/interpolation object) - Function that describes the derivative of the profile with
respect to x. Can be given as an interpolation object. If None, a
generic central difference is taken & interpolated with a
spline of which the order can be chosen.
(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__
|