oimParam
The oimParam.py module contains the definition of main model parameter class
oimParam, as well as parameter linkers,
normalizers and interpolators.
Classes:
|
Class of model parameters. |
|
Class to directly link two oimParam. |
|
Class to directly link some oimParam using a user function |
|
Class to normalize a list of oimParam |
|
Macro to directly create an oimParamInterpolator |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calculates a temperature and wavelength dependent blackbody distribution via Planck's law. |
|
Calculates the stellar flux for different wavelengths. |
|
- class oimodeler.oimParam.oimParam(name: str | None = None, value: int | float | Quantity | None = None, mini: int | float | None = None, maxi: int | float | None = None, description: str | None = None, unit: Quantity | None = None, free: bool | None = None, error: int | float | None = None, base: str = '')
Class of model parameters.
- Parameters:
name (string, optional) – Name of the Parameter. The default is None.
value (int or float, optional) – Value of the parameter. The default is None.
mini (int or float, optional) – Mininum value allowed for the parameter. The default is -1*np.inf.
maxi (int or float, optional) – maximum value allowed for the parameter. The default is np.inf.
description (string, optional) – Description of the parameter. The default is “”.
unit (astropy.unit.Quantity, optional) – Unit of the parameter. The default is astropy.units.one
free (bool, optional) – Determines if the parameter is to be fitted. The default is None
error (int or float, optional) – The error of the parameter. The default is 0.
default (str, optional) – Default parameter from which all of the settings are adopted. Will be overwritten by user input. Default is None.
- __init__(name: str | None = None, value: int | float | Quantity | None = None, mini: int | float | None = None, maxi: int | float | None = None, description: str | None = None, unit: Quantity | None = None, free: bool | None = None, error: int | float | None = None, base: str = '')
Initialize a new instance of the oimParam class.
- qty(wl=None, t=None)
- quantity(wl=None, t=None)
- set(**kwargs)
- serialize() Dict[str, Any]
Serializes the oimParam/oimParamInterpolator.
- static deserialize(ser: Dict[str, Any]) oimParam | oimParamInterpolator | oimParamNorm
Deserializes into an oimParam/oimParamInterpolator/oimParamNorm.
- pickle(f: str | Path | BufferedWriter, **kwargs) None
Save the pickled representation of the object into an already open file or opens a file from a string or pathlib.Path.
- classmethod unpickle(f: Path | TextIOWrapper, **kwargs) object
Read the pickled representation from an open file or reads a string or pathlib.Path into a file to return the reconstituted object.
- class oimodeler.oimParam.oimParamLinker(param: oimParam, operator: str = 'add', fact: int | float | oimParam | List[int | float | oimParam] = 0)
Class to directly link two oimParam.
- __init__(param: oimParam, operator: str = 'add', fact: int | float | oimParam | List[int | float | oimParam] = 0) None
- Parameters:
param (.oimParam) – the oimParam to link with.
operator (str, optional) – the operator to use. All python operators are available (case-insensitive) either spelt out like “add” or with the symbol like “+”. The default is “add”.
fact (list of int, float, or .oimParam or int, float, or .oimParam, optional) – The value used for the operation. Can be a list or a single value of float or an oimParam. The default is 0.
- property unit
Returns the unit of the oimParamLinker.
- serialize() Dict[str, Any]
Serializes the oimParamLinker.
- static deserialize(ser: Dict[str, Any]) oimParamLinker
Deserializes into an oimParamLinker.
- class oimodeler.oimParam.oimParamLinkerFunction(params, func)
Class to directly link some oimParam using a user function
- __init__(params, func)
- serialize() Dict[str, Any]
Serializes the oimParamLinkerFunction.
- static deserialize(ser: Dict[str, Any]) oimParamLinkerFunction
Deserializes into an oimParamLinkerFunction.
- class oimodeler.oimParam.oimParamNorm(params: List[oimParam] = [], norm: int | float = 1)
Class to normalize a list of oimParam
Example : p2 = oimParamNorm([p0, p1)]
The value of p2 will always be 1-p2-p1
- property unit
Returns the unit of the oimParamNorm.
- serialize() Dict[str, Any]
Serializes the oimParamNorm.
- static deserialize(ser: Dict[str, Any]) oimParamNorm
Deserializes into an oimParamNorm.
- pickle(f: str | Path | BufferedWriter, **kwargs) None
Save the pickled representation of the object into an already open file or opens a file from a string or pathlib.Path.
- classmethod unpickle(f: Path | TextIOWrapper, **kwargs) object
Read the pickled representation from an open file or reads a string or pathlib.Path into a file to return the reconstituted object.
- class oimodeler.oimParam.oimInterp(name, **kwargs)
Macro to directly create an oimParamInterpolator
Example :
g = oim.oimGauss(fwhm=oim.oimInterp("wl", wl=[3e-6, 4e-6], values=[2, 8]))
This will create a gaussiand component and remplace the parameter fwhm by an instance of the oimParamInterpolatorWl class (i.e., the wavelength linear interpolator. The custom interpolator the reference to the interpolator need to be added to the
_interpolatorsdictionnary.- Parameters:
name (str) – Keyname for the interpolators registered in the _interpolators dictionary.
**kwargs (dict) – Parameters from the create oimParamInterpolator-derived class.
- Variables:
kwargs (dict) – Parameters from the create oimParamInterpolator-derived class.
type (oimParamInterpolator) – A param interpolator contained in the _interpolators dictionary. For the local definition in the oimParam module, strings can be used. To redefine the dictionary elements from outside, use the class variables, otherwise the local definition will be used.
- __init__(name, **kwargs)
- class oimodeler.oimParam.oimParamInterpolator(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Generic interpolator (to be subclassed)'
- interpparams = []
- __init__(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
Initialize a new instance of the oimParam class.
- _init(param, **kwargs)
- _interpFunction(wl, t)
- _getParams()
- property params
- serialize() Dict[str, Any]
Serializes the oimParam/oimParamInterpolator.
- static deserialize(ser: Dict[str, Any]) oimParamInterpolator
Deserializes into an oimParamInterpolator.
- set(**kwargs)
- class oimodeler.oimParam.oimParamInterpolatorKeyframes(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Interpolation between keyframes in wl or mjd'
- interparams = ['keyframes', 'keyvalues', 'kind', 'dependence', 'fixedRef', 'extrapolate']
- _init(param: oimParam = oimParam at 0x7941ce74be50 : =0 ± 0 range=[-inf, inf] free=True, dependence: str = 'wl', keyframes: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], keyvalues: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], kind: str = 'linear', fixedRef: bool = True, extrapolate: bool = False, **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamInterpolatorWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Interpolation between keyframes in wl'
- interparams = ['wl', 'values', 'kind', 'fixedRef', 'extrapolate']
- _init(param: oimParam = oimParam at 0x7941cdd4ced0 : =0 ± 0 range=[-inf, inf] free=True, wl: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], **kwargs)
- class oimodeler.oimParam.oimParamInterpolatorTime(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Interpolation between keyframes in mjd'
- interparams = ['mjd', 'values', 'kind', 'fixedRef', 'extrapolate']
- _init(param: oimParam = oimParam at 0x7941cdd4cf10 : =0 ± 0 range=[-inf, inf] free=True, mjd: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], **kwargs)
- class oimodeler.oimParam.oimParamCosineTime(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Assymetrical cosine time interpolator'
- interparams = ['T0', 'P', 'values', 'x0']
- _init(param: ~oimodeler.oimParam.oimParam = oimParam at 0x7941cdd4cf50 : =0 ± 0 range=[-inf,inf] free=True , T0: int | float = 0, P: int | float = 1, values: ~typing.List[int] = [0, 1], x0=None, **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamGaussian(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Generic gaussian interpolator in wl or mjd'
- interparams = ['dependence', 'val0', 'value', 'x0', 'fwhm']
- _init(param: oimParam = oimParam at 0x7941cdd4d050 : =0 ± 0 range=[-inf, inf] free=True, dependence: str = 'wl', val0: int | float = 0, value: int | float = 0, x0: int | float = 0, fwhm: int | float = 0, **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamGaussianWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = ' Gaussian interpolator in wl'
- interparams = ['val0', 'value', 'x0', 'fwhm']
- class oimodeler.oimParam.oimParamGaussianTime(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Gaussian interpolator in mjd'
- interparams = ['val0', 'value', 'x0', 'fwhm']
- class oimodeler.oimParam.oimParamMultipleGaussian(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Generic multiple gaussian interpolator in wl or mjd'
- interparams = ['dependence', 'val0', 'values', 'x0', 'fwhm']
- _init(param: oimParam = oimParam at 0x7941cdd4d2d0 : =0 ± 0 range=[-inf, inf] free=True, dependence: str = 'wl', val0: int | float = 0, values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], x0: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], fwhm: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamMultipleGaussianWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Multiple Gaussian interpolator in wl'
- interparams = ['val0', 'values', 'x0', 'fwhm']
- _init(param: oimParam = oimParam at 0x7941cdd4d450 : =0 ± 0 range=[-inf, inf] free=True, val0: int | float = 0, values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], x0: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], fwhm: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], **kwargs)
- class oimodeler.oimParam.oimParamMultipleGaussianTime(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Multiple Gaussian interpolator in mjd'
- interparams = ['val0', 'values', 'x0', 'fwhm']
- _init(param: oimParam = oimParam at 0x7941cdd4d610 : =0 ± 0 range=[-inf, inf] free=True, val0: int | float = 0, values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], x0: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], fwhm: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], **kwargs)
- class oimodeler.oimParam.oimParamPolynomial(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Generic polynomial interpolation in wl or mjd'
- interparams = ['dependence', 'order', 'coeffs', 'x0']
- _init(param, dependence: str = 'wl', order: int = 2, coeffs: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, x0: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamPolynomialWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Polynomial interpolation in wl'
- interparams = ['order', 'coeffs', 'x0']
- _init(param: oimParam = oimParam at 0x7941cdd4d810 : =0 ± 0 range=[-inf, inf] free=True, order: int = 2, coeffs: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, x0: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, **kwargs)
- class oimodeler.oimParam.oimParamPolynomialTime(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Polynomial interpolation in mjd'
- interparams = ['order', 'coeffs', 'x0']
- _init(param: oimParam = oimParam at 0x7941cdd4d910 : =0 ± 0 range=[-inf, inf] free=True, order: int = 2, coeffs: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, x0: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None)
- class oimodeler.oimParam.oimParamPowerLaw(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Powerlaw interpolation in wl or mjd'
Power-law interpolation, i.e. A*(x/x0)**p.
- interparams = ['dependence', 'x0', 'A', 'p']
- _init(param: oimParam = oimParam at 0x7941cdd4d9d0 : =0 ± 0 range=[-inf, inf] free=True, dependence: str = 'wl', x0: int | float = 0, A: int | float = 0, p: int | float = 1, **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamPowerLawTime(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Powerlaw interpolation in mjd'
Power-law interpolation, i.e. A*(x/x0)**p.
- interparams = ['x0', 'A', 'p']
- class oimodeler.oimParam.oimParamPowerLawWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Powerlaw interpolation in wl'
Power-law interpolation, i.e. A*(x/x0)**p.
- interparams = ['x0', 'A', 'p']
- class oimodeler.oimParam.oimParamLinearRangeWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Linear range interpolation in wl'
- interparams = ['wlmin', 'wlmax', 'values']
- _init(param: oimParam = oimParam at 0x7941cdd4dc50 : =0 ± 0 range=[-inf, inf] free=True, wlmin: float = 2e-06, wlmax: float = 3e-06, values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], kind: str = 'linear', **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamLinearTemplateWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Interpolation in wl using external regular grid template'
- interparams = ['wl0', 'dwl', 'f_contrib', 'values', 'kind']
- _init(param: oimParam = oimParam at 0x7941cdd4dd50 : =0 ± 0 range=[-inf, inf] free=True, wl0: float = 2e-06, dwl: float = 1e-09, f_contrib: float = 1.0, values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = [], kind: str = 'linear', **kwargs)
- _interpFunction(wl, t)
- _getParams()
- class oimodeler.oimParam.oimParamLinearTemperatureWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
Calculates a temperature and wavelength dependent blackbody distribution via Planck’s law.
- Parameters:
param (.oimParam) – The parameter that is to be calculated (interpolated).
T (int or float) – The blackbody temperature (K).
solid_angle (int, float, or .oimParam) – The solid angle of the object or an oimParam containing the solid angle (mas).
- Variables:
T (.oimParam)
solid_angle (int, float or .oimParam)
- interpdescription = 'Blackbody in wl for given temperature'
- interparams = ['T', 'solid_angle']
- _init(param: oimParam = oimParam at 0x7941cdd4de50 : =0 ± 0 range=[-inf, inf] free=True, T: int | float = 0, solid_angle: int | float | oimParam = 0, **kwargs) None
The subclass’s constructor.
- _getParams()
Gets the parameters of the interpolator.
- _interpFunction(wl: ndarray, t: ndarray)
Calculates a temperature and wavelength dependent blackbody distribution via Planck’s law.
- Parameters:
wl (numpy.ndarray) – Wavelengths (m).
t (numpy.ndarray) – Times (mjd).
- Returns:
blackbody_distribution – The star’s flux (Jy).
- Return type:
numpy.ndarray
- class oimodeler.oimParam.oimParamLinearStarWl(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
Calculates the stellar flux for different wavelengths.
Calculates the stellar radius none is provided from the luminosity.
- Parameters:
param (oimParam) – The parameter that is to be calculated (interpolated).
T (array_like) – The star’s effective temperature (K).
R (int or float, optional) – The star’s radius (Rsun).
L (int or float, optional) – The star’s luminosity (Lsun).
dist (int or float) – The distance to the star (pc).
- Variables:
T (.oimParam) – The star’s effective temperature (K).
R (.oimParam) – The star’s radius (Rsun).
L (.oimParam) – The star’s luminosity (Lsun).
dist (.oimParam) – The distance to the star (pc).
- interpdescription = 'Blackbody (per wavelength) for given temperature, radius or luminosity, and distance'
- interparams = ['T', 'L', 'R', 'dist']
- _init(param: oimParam = oimParam at 0x7941cdd4df10 : =0 ± 0 range=[-inf, inf] free=True, T: int | float = 0, R: int | float | None = None, L: int | float | None = None, dist: int | float = 0, **kwargs: Dict) None
- _getParams()
Gets the parameters of the interpolator.
- _interpFunction(wl: ndarray, t: ndarray) ndarray
Calculates the stellar flux from its distance and radius at the specified wavelengths.
- Parameters:
wl (numpy.ndarray) – Wavelengths (m).
t (numpy.ndarray) – Times (mjd).
- Returns:
F – The star’s flux (Jy).
- Return type:
numpy.ndarray
- class oimodeler.oimParam.oimParamUserFunc(param: oimParam = oimParam at 0x7941cdd4ce90 : =0 ± 0 range=[-inf, inf] free=True, **kwargs)
- interpdescription = 'Interpolate from user-supplied function'
- _init(param: oimParam = oimParam at 0x7941cdd4df90 : =0 ± 0 range=[-inf, inf] free=True, userfunc: Callable = <function oimParamUserFunc.<lambda>>, dependence: str = 'wl', **kwargs)
- _interpFunction(wl, t)
- _getParams()