astromodels.functions package
Subpackages
- astromodels.functions.dark_matter package
- astromodels.functions.functions_1D package
- Submodules
- astromodels.functions.functions_1D.absorption module
- astromodels.functions.functions_1D.apec module
- astromodels.functions.functions_1D.blackbody module
- astromodels.functions.functions_1D.extinction module
- astromodels.functions.functions_1D.functions module
- astromodels.functions.functions_1D.polynomials module
- astromodels.functions.functions_1D.powerlaws module
- Module contents
- Submodules
Submodules
Module contents
- class astromodels.functions.Asymm_Gaussian_on_sphere(**kwargs)[source]
Bases:
Function2D
description :
A bidimensional Gaussian function on a sphere (in spherical coordinates)
see https://en.wikipedia.org/wiki/Gaussian_function#Two-dimensional_Gaussian_function
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
a :
desc : Standard deviation of the Gaussian distribution (major axis) initial value : 10 min : 0 max : 20
e :
desc : Excentricity of Gaussian ellipse initial value : 0.9 min : 0 max : 1
theta :
desc : inclination of major axis to a line of constant latitude initial value : 10. min : -90.0 max : 90.0
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Band(**kwargs)[source]
Bases:
Function1D
description :
Band model from Band et al., 1993, parametrized with the peak energy
latex : $K begin{cases} left(frac{x}{piv}right)^{alpha} exp left(-frac{(2+alpha) x}{x_{p}}right) & x leq (alpha-beta) frac{x_{p}}{(alpha+2)} \ left(frac{x}{piv}right)^{beta} exp (beta-alpha)left[frac{(alpha-beta) x_{p}}{piv(2+alpha)}right]^{alpha-beta} &x>(alpha-beta) frac{x_{p}}{(alpha+2)} end{cases} $
parameters :
K :
desc : Differential flux at the pivot energy initial value : 1e-4 min : 1e-50 is_normalization : True transformation : log10
alpha :
desc : low-energy photon index initial value : -1.0 min : -1.5 max : 3
xp :
desc : peak in the x * x * N (nuFnu if x is a energy) initial value : 500 min : 10 transformation : log10
beta :
desc : high-energy photon index initial value : -2.0 min : -5.0 max : -1.6
piv :
desc : pivot energy initial value : 100.0 fix : yes
- static info()
- class astromodels.functions.Band_Calderone(**kwargs)[source]
Bases:
Function1D
description :
The Band model from Band et al. 1993, implemented however in a way which reduces the covariances between the parameters (Calderone et al., MNRAS, 448, 403C, 2015)
latex : $ text{(Calderone et al., MNRAS, 448, 403C, 2015)} $
parameters :
- alpha :
desc : The index for x smaller than the x peak initial value : -1 min : -10 max : 10
beta :
- descindex for x greater than the x peak (only if opt=1, i.e., for the
Band model)
initial value : -2.2 min : -7 max : -1
xp :
desc : position of the peak in the x*x*f(x) space (if x is energy, this is the nuFnu or SED space) initial value : 200.0 min : 1e-10 transformation : log10
F :
desc : integral in the band defined by a and b initial value : 1e-6 min: 1e-50 is_normalization : True transformation : log10
a:
desc : lower limit of the band in which the integral will be computed initial value : 1.0 min : 0 fix : yes
b:
desc : upper limit of the band in which the integral will be computed initial value : 10000.0 min : 0 fix : yes
opt :
desc : option to select the spectral model (0 corresponds to a cutoff power law, 1 to the Band model) initial value : 1 min : 0 max : 1 fix : yes
- static info()
- class astromodels.functions.Band_grbm(**kwargs)[source]
Bases:
Function1D
description :
Band model from Band et al., 1993, parametrized with the cutoff energy
latex : $ $
parameters :
K :
desc : Differential flux at the pivot energy initial value : 1e-4 min : 1e-50 is_normalization : True transformation : log10
alpha :
desc : low-energy photon index initial value : -1.0 min : -1.5 max : 3
xc :
desc : cutoff of exp initial value : 500 min : 10 transformation : log10
beta :
desc : high-energy photon index initial value : -2.0 min : -5.0 max : -1.6
piv :
desc : pivot energy initial value : 100.0 fix : yes
- static info()
- class astromodels.functions.Beta(**kwargs)[source]
Bases:
Function1D
description :
A beta distribution function
latex : $ f(x, a, b)=frac{Gamma(a+b) x^{a-1}(1-x)^{b-1}}{Gamma(a) Gamma(b)}$
parameters :
a :
desc : first shape parameter initial value : 0.5 min: 0.
b :
desc : second shape parameter initial value : 0.5 min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Blackbody(**kwargs)[source]
Bases:
Function1D
- description :
A blackbody function
latex : $f(x) = K frac{x^2}{exp(frac{x}{kT}) -1} $
- parameters :
- K :
desc : initial value : 1e-4 min : 0. is_normalization : True
- kT :
desc : temperature of the blackbody initial value : 30.0 min: 0.
- static info()
- class astromodels.functions.Broken_powerlaw(**kwargs)[source]
Bases:
Function1D
description :
A broken power law function
latex : $ f(x)= K~begin{cases}left( frac{x}{x_{b}} right)^{alpha} & x < x_{b} \ left( frac{x}{x_{b}} right)^{beta} & x ge x_{b} end{cases} $
parameters :
K :
desc : Normalization (differential flux at x_b) initial value : 1.0 min : 1e-50 is_normalization : True transformation : log10
xb :
desc : Break point initial value : 10 min : 1.0 transformation : log10
alpha :
desc : Index before the break xb initial value : -1.5 min : -10 max : 10
beta :
desc : Index after the break xb initial value : -2.5 min : -10 max : 10
piv :
desc : Pivot energy initial value : 1.0 fix : yes
- static info()
- class astromodels.functions.Cauchy(**kwargs)[source]
Bases:
Function1D
description :
The Cauchy distribution
latex : $ K frac{1}{ gamma pi} left[ frac{gamma^2}{(x-x_0)^2 + gamma^2} right] $
parameters :
K :
desc : Integral between -inf and +inf. Fix this to 1 to obtain a Cauchy distribution initial value : 1
x0 :
desc : Central value initial value : 0.0
gamma :
desc : standard deviation initial value : 1.0 min : 1e-12
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Constant(**kwargs)[source]
Bases:
Function1D
description :
Return k
latex : $ k $
parameters :
k :
desc : Constant value initial value : 0
- static info()
- class astromodels.functions.Continuous_injection_diffusion(**kwargs)[source]
Bases:
Function3D
description :
Positron and electrons diffusing away from the accelerator
latex : $left(frac{180^circ}{pi}right)^2 frac{1.2154}{sqrt{pi^3} r_{rm diff} ({rm angsep} ({rm x, y, lon_0, lat_0})+0.06 r_{rm diff} )} , {rm exp}left(-frac{{rm angsep}^2 ({rm x, y, lon_0, lat_0})}{r_{rm diff} ^2} right)$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
rdiff0 :
desc : Projected diffusion radius limited by the cooling time. The maximum allowed value is used to define the truncation radius. initial value : 1.0 min : 0 max : 20
rinj :
desc : Ratio of diffusion radius limited by the injection time over rdiff0. The maximum allowed value is used to define the truncation radius. initial value : 100.0 min : 0 max : 200 fix : yes
delta :
desc : index for the diffusion coefficient initial value : 0.5 min : 0.3 max : 0.6 fix : yes
b :
desc : b field strength in uG initial value : 3 min : 1 max : 10. fix : yes
piv :
desc : Pivot for the diffusion radius initial value : 2e10 min : 0 fix : yes
- piv2 :
desc : Pivot for converting gamma energy to electron energy (always be 1 TeV) initial value : 1e9 min : 0 fix : yes
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Continuous_injection_diffusion_ellipse(**kwargs)[source]
Bases:
Function3D
description :
Positron and electrons diffusing away from the accelerator
latex : $left(frac{180^circ}{pi}right)^2 frac{1.2154}{sqrt{pi^3} r_{rm diff} ({rm angsep} ({rm x, y, lon_0, lat_0})+0.06 r_{rm diff} )} , {rm exp}left(-frac{{rm angsep}^2 ({rm x, y, lon_0, lat_0})}{r_{rm diff} ^2} right)$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
rdiff0 :
desc : Projected diffusion radius. The maximum allowed value is used to define the truncation radius. initial value : 1.0 min : 0 max : 20
delta :
desc : index for the diffusion coefficient initial value : 0.5 min : 0.3 max : 0.6 fix : yes
b :
desc : b field strength in uG initial value : 3 min : 1 max : 10. fix : yes
piv :
desc : Pivot for the diffusion radius initial value : 2e10 min : 0 fix : yes
piv2 :
desc : Pivot for converting gamma energy to electron energy (always be 1 TeV) initial value : 1e9 min : 0 fix : yes
incl :
desc : inclination of semimajoraxis to a line of constant latitude initial value : 0.0 min : -90.0 max : 90.0 fix : yes
elongation :
desc : elongation of the ellipse (b/a) initial value : 1. min : 0.1 max : 10.
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Continuous_injection_diffusion_legacy(**kwargs)[source]
Bases:
Function3D
description :
Positron and electrons diffusing away from the accelerator
latex : $left(frac{180^circ}{pi}right)^2 frac{1.2154}{sqrt{pi^3} r_{rm diff} ({rm angsep} ({rm x, y, lon_0, lat_0})+0.06 r_{rm diff} )} , {rm exp}left(-frac{{rm angsep}^2 ({rm x, y, lon_0, lat_0})}{r_{rm diff} ^2} right)$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
rdiff0 :
desc : Projected diffusion radius. The maximum allowed value is used to define the truncation radius. initial value : 1.0 min : 0 max : 20
delta :
desc : index for the diffusion coefficient initial value : 0.5 min : 0.3 max : 0.6 fix : yes
uratio :
desc : ratio between u_cmb and u_B initial value : 0.5 min : 0.01 max : 100. fix : yes
piv :
desc : Pivot for the diffusion radius initial value : 2e10 min : 0 fix : yes
- piv2 :
desc : Pivot for converting gamma energy to electron energy (always be 1 TeV) initial value : 1e9 min : 0 fix : yes
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Cosine_Prior(**kwargs)[source]
Bases:
Function1D
description :
A function which is constant on the interval angular interval of cosine
latex : $cos(x)$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : -90 min : -np.inf max : np.inf
upper_bound :
desc : Upper bound for the interval initial value : 90 min : -np.inf max : np.inf
value :
desc : Value in the interval initial value : 1.0
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- has_fixed_units()[source]
Returns True if this function cannot change units, which is the case only for very specific functions (like models from foreign libraries like Xspec)
- Returns:
True or False
- static info()
- class astromodels.functions.Cubic(**kwargs)[source]
Bases:
Function1D
description :
A cubic function
latex : $ a + b cdot x + c cdot x^2 + d cdot x^3$
parameters :
a :
desc : coefficient initial value : 1
b :
desc : coefficient initial value : 1
c :
desc : coefficient initial value : 1
d :
desc : coefficient initial value : 1
- static info()
- class astromodels.functions.Cutoff_powerlaw(**kwargs)[source]
Bases:
Function1D
description :
A power law multiplied by an exponential cutoff
latex : $ K~frac{x}{piv}^{index}~exp{-x/xc} $
parameters :
K :
desc : Normalization (differential flux at the pivot value) initial value : 1.0 is_normalization : True transformation : log10 min : 1e-30 max : 1e3 delta : 0.1
piv :
desc : Pivot value initial value : 1 fix : yes
index :
desc : Photon index initial value : -2 min : -10 max : 10
xc :
desc : Cutoff energy initial value : 10.0 transformation : log10 min: 1.0
- static info()
- class astromodels.functions.Cutoff_powerlaw_Ep(**kwargs)[source]
Bases:
Function1D
description :
A power law multiplied by an exponential cutoff parametrized with Ep
latex : $ K~frac{x}{piv}^{index}~exp{-x(2+index)/xp} $
parameters :
K :
desc : Normalization (differential flux at the pivot value) initial value : 1.0 is_normalization : True transformation : log10 min : 1e-30 max : 1e3 delta : 0.1
piv :
desc : Pivot value initial value : 1 fix : yes
index :
desc : Photon index initial value : -2 min : -10 max : 10
xp :
desc : peak in the x * x * N (nuFnu if x is a energy) initial value : 500 min : 10 max : 1e4 transformation : log10
- static info()
- class astromodels.functions.DMFitFunction(**kwargs)[source]
Bases:
Function1D
description :
Class that evaluates the spectrum for a DM particle of a given mass, channel, cross section, and J-factor. Based on standard Fermi Science Tools function DMFitFunction. Note input table only calculated spectra up to m_DM of 10 TeV
The parameterization is given by
F(x) = 1 / (8 * pi) * (1/mass^2) * sigmav * J * dN/dE(E,mass,i)
latex : $$
parameters :
- mass :
desc : DM mass (GeV) initial value : 10 fix : yes
- channel :
desc : DM annihilation channel initial value : 4 fix : yes
- sigmav :
desc : DM annihilation cross section (cm^3/s) initial value : 1.e-26
- J :
desc : Target total J-factor (GeV^2 cm^-5) initial value : 1.e20 fix : yes
- static info()
- class astromodels.functions.DMSpectra(**kwargs)[source]
Bases:
Function1D
description :
Class that evaluates the spectrum for a DM particle of a given mass, channel, cross section, and J-factor. Combines Pythia-based tables from both Fermi (2 GeV < m_DM < 10 TeV) and HAWC (10 TeV < m_dm < 1 PeV)
The parameterization is given by
F(x) = 1 / (8 * pi) * (1/mass^2) * sigmav * J * dN/dE(E,mass,i)
Note that this class assumes that mass and J-factor are provided in units of GeV and GeV^2 cm^-5
latex : $$
parameters :
- mass :
desc : DM mass (GeV) initial value : 10 fix : yes
- channel :
desc : DM annihilation channel initial value : 4 fix : yes
- sigmav :
desc : DM annihilation cross section (cm^3/s) initial value : 1.e-26
- J :
desc : Target total J-factor (GeV^2 cm^-5) initial value : 1.e20 fix : yes
- static info()
- class astromodels.functions.DiracDelta(**kwargs)[source]
Bases:
Function1D
description :
return at zero_point
latex : $ value $
parameters :
value :
desc : Constant value initial value : 0
zero_point:
desc: value at which function is non-zero initial value : 0 fix : yes
- static info()
- class astromodels.functions.Disk_on_sphere(**kwargs)[source]
Bases:
Function2D
description :
A bidimensional disk/tophat function on a sphere (in spherical coordinates)
latex : $$ f(vec{x}) = left(frac{180}{pi}right)^2 frac{1}{pi~({rm radius})^2} ~left{begin{matrix} 1 & {rm if}& {rm | vec{x} - vec{x}_0| le {rm radius}} \ 0 & {rm if}& {rm | vec{x} - vec{x}_0| > {rm radius}} end{matrix}right. $$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
radius :
desc : Radius of the disk initial value : 15 min : 0 max : 20
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.DoubleSmoothlyBrokenPowerlaw(**kwargs)[source]
Bases:
Function1D
description : A smoothly broken power law with two breaks as parameterized in Ravasio, M. E. et al. Astron Astrophys 613, A16 (2018).
latex : $begin{array}{l}begin{aligned}f(x)=& A x_{mathrm{b}}^{alpha_{1}}left[left[left(frac{x}{x_{mathrm{b}}}right)^{-alpha_{1} n_{1}}+left(frac{x}{x_{mathrm{b}}}right)^{-alpha_{2} n_{1}}right]^{frac{n_{2}}{n_{1}}}right.\&left.+left(frac{x}{x_{mathrm{j}}}right)^{-beta n_{2}} cdotleft[left(frac{x_{mathrm{j}}}{x_{mathrm{b}}}right)^{-alpha_{1} n_{1}}+left(frac{x_{mathrm{j}}}{x_{mathrm{b}}}right)^{-alpha_{2} n_{1}}right]^{frac{n_{2}}{n_{1}}}right]^{-frac{1}{n_{2}}}end{aligned}\text { where }\x_{mathrm{j}}=x_{mathrm{p}} cdotleft(-frac{alpha_{2}+2}{beta+2}right)^{frac{1}{left.beta-alpha_{2}right) n_{2}}}end{array}$
parameters :
K :
desc : Differential flux at the pivot energy initial value : 1e-4 min : 1e-50 is_normalization : True transformation : log10
alpha1 :
desc : photon index below xb initial value : -0.66
xb :
desc : break energy below xp initial value : 100 min : 1e-10 transformation : log10
n1 :
desc : curvature of the first break initial value : 2.0 min : 0 fix: True
alpha2 :
desc : photon index between xb and xp initial value : -1.5
xp :
desc : nuFnu peak initial value : 300 min : 1e-10 transformation : log10
n2 :
desc : curvature of the break at xp initial value : 2.0 min : 0 fix: True
beta :
desc : photon index above xp initial value : -2.5 max : 2
piv :
desc : pivot energy initial value : 1. fix : yes
- static info()
- class astromodels.functions.Ellipse_on_sphere(**kwargs)[source]
Bases:
Function2D
description :
An ellipse function on a sphere (in spherical coordinates)
latex : $$ f(vec{x}) = left(frac{180}{pi}right)^2 frac{1}{pi~ a b} ~left{begin{matrix} 1 & {rm if}& {rm | vec{x} - vec{x}_{f1}| + | vec{x} - vec{x}_{f2}| le {rm 2a}} \ 0 & {rm if}& {rm | vec{x} - vec{x}_{f1}| + | vec{x} - vec{x}_{f2}| > {rm 2a}} end{matrix}right. $$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
a :
desc : semimajor axis of the ellipse initial value : 15. min : 0 max : 20
e :
desc : eccentricity of ellipse initial value : 0.9 min : 0 max : 1
theta :
desc : inclination of semimajoraxis to a line of constant latitude initial value : 0.0 min : -90.0 max : 90.0
- focal_pts = False
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- lat1 = None
- lat2 = None
- lon1 = None
- lon2 = None
- class astromodels.functions.Exponential(**kwargs)[source]
Bases:
Function1D
description :
An exponential distribution function
latex : $ f(x, alpha) = alphaexp(-alpha x)$
parameters :
alpha :
desc : first shape parameter initial value : 1 min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Exponential_cutoff(**kwargs)[source]
Bases:
Function1D
description :
An exponential cutoff
latex : $ K exp{(-x/xc)} $
parameters :
K :
desc : Normalization initial value : 1.0 fix : no is_normalization : True
- xc :
desc : cutoff initial value : 100 min : 1
- static info()
- class astromodels.functions.Function1D(name: Optional[str] = None, function_definition: Optional[str] = None, parameters: Optional[Dict[str, Parameter]] = None, properties: Optional[Dict[str, FunctionProperty]] = None)[source]
Bases:
Function
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- local_spectral_index(x, epsilon=1e-05)[source]
compute the local spectral index of the model at a given set of energies
- Parameters:
x –
epsilon –
- Returns:
- property x_unit
The unit of the independent variable :return: a astropy.Unit instance
- property y_unit: Unit
The unit of the dependent variable :return: a astropy.Unit instance
- class astromodels.functions.Function2D(name: Optional[str] = None, function_definition: Optional[str] = None, parameters: Optional[Dict[str, Parameter]] = None, properties: Optional[Dict[str, FunctionProperty]] = None)[source]
Bases:
Function
- property x_unit
- property y_unit
- property z_unit
- class astromodels.functions.Function3D(name: Optional[str] = None, function_definition: Optional[str] = None, parameters: Optional[Dict[str, Parameter]] = None, properties: Optional[Dict[str, FunctionProperty]] = None)[source]
Bases:
Function
- property w_unit
- property x_unit
- property y_unit
- property z_unit
- class astromodels.functions.FunctionMeta(name, bases, dct)[source]
Bases:
type
A metaclass for the models, which takes care of setting up the parameters and the other attributes according to the definition given in the documentation of the function class.
- static check_calling_sequence(name, function_name, function, possible_variables)[source]
Check the calling sequence for the function looking for the variables specified. One or more of the variables can be in the calling sequence. Note that the order of the variables will be enforced. It will also enforce that the first parameter in the calling sequence is called ‘self’.
- Parameters:
function – the function to check
possible_variables – a list of variables to check, The order is important, and will be enforced
- Returns:
a tuple containing the list of found variables, and the name of the other parameters in the calling
sequence
- static parse_property_definition(func_name, prop_name, definition) FunctionProperty [source]
- class astromodels.functions.GalPropTemplate_3D(name: Optional[str] = None, function_definition: Optional[str] = None, parameters: Optional[Dict[str, Parameter]] = None, properties: Optional[Dict[str, FunctionProperty]] = None)[source]
Bases:
Function3D
description :
Use a 3D template that has morphology and flux information. GalProp, DRAGON or a similar model in fits format would work. Only parameter is a normalization factor.
latex : $ K $
parameters :
K :
desc : normalization initial value : 1 fix : yes
hash :
desc : hash of model map [needed for memoization] initial value : 1 fix : yes
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- class astromodels.functions.Gamma(**kwargs)[source]
Bases:
Function1D
description :
A gamma distribution function
latex : $ f(x, alpha, beta)=frac{beta^alpha x^{alpha-1} e^{-beta x}}{Gamma(alpha)}$
parameters :
alpha :
desc : first shape parameter initial value : 0.5 min: 0.
beta :
desc : second shape parameter initial value : 1. min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Gaussian(**kwargs)[source]
Bases:
Function1D
description :
A Gaussian function
latex : $ K frac{1}{sigma sqrt{2 pi}}exp{frac{(x-mu)^2}{2~(sigma)^2}} $
parameters :
F :
desc : Integral between -inf and +inf. Fix this to 1 to obtain a Normal distribution initial value : 1
mu :
desc : Central value initial value : 0.0
sigma :
desc : standard deviation initial value : 1.0 min : 1e-12
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Gaussian_on_sphere(**kwargs)[source]
Bases:
Function2D
description :
A bidimensional Gaussian function on a sphere (in spherical coordinates)
latex : $$ f(vec{x}) = left(frac{180^circ}{pi}right)^2 frac{1}{2pi sqrt{det{Sigma}}} , {rm exp}left( -frac{1}{2} (vec{x}-vec{x}_0)^intercal cdot Sigma^{-1}cdot (vec{x}-vec{x}_0)right) \ vec{x}_0 = ({rm RA}_0,{rm Dec}_0)\ Lambda = left( begin{array}{cc} sigma^2 & 0 \ 0 & sigma^2 (1-e^2) end{array}right) \ U = left( begin{array}{cc} cos theta & -sin theta \ sin theta & cos theta end{array}right) \Sigma = ULambda U^intercal $$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
sigma :
desc : Standard deviation of the Gaussian distribution initial value : 10 min : 0 max : 20
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.GenericFunction(**kwargs)[source]
Bases:
Function1D
description :
Return k*f(x)
latex : $ k $
parameters :
k :
desc : Constant value initial value : 1
- property function
Get/set function
- static info()
- class astromodels.functions.Inverse_cutoff_powerlaw(**kwargs)[source]
Bases:
Function1D
- description :
A power law multiplied by an exponential cutoff [Note: instead of cutoff energy energy parameter xc, b = 1/xc is used]
latex : $K frac{x}{piv}^{index}exp{(-x~b)} $ parameters :
- K :
desc : Normalization (differential flux at the pivot value) initial value : 1.0 is_normalization : True transformation : log10 min : 1e-30 max : 1e3 delta : 0.1
- piv :
desc : Pivot value initial value : 1 fix : yes
- index :
desc : Photon index initial value : -2 min : -10 max : 10
- b :
desc : inverse cutoff energy i.e 1/xc initial value : 1
- static info()
- class astromodels.functions.Latitude_galactic_diffuse(**kwargs)[source]
Bases:
Function2D
description :
A Gaussian distribution in Galactic latitude around the Galactic plane
latex : $ K exp{left( frac{-b^2}{2 sigma_b^2} right)} $
parameters :
K :
desc : normalization initial value : 1
sigma_b :
desc : Sigma for initial value : 1
l_min :
desc : min Longtitude initial value : 10
l_max :
desc : max Longtitude initial value : 30
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Line(**kwargs)[source]
Bases:
Function1D
description :
A linear function
latex : $ b * x + a $
parameters :
a :
desc : intercept initial value : 0
b :
desc : coeff initial value : 1
- static info()
- class astromodels.functions.Log_normal(**kwargs)[source]
Bases:
Function1D
description :
A log normal function
latex : $ K frac{1}{ x sigma sqrt{2 pi}}exp{frac{(log x/piv - mu/piv)^2}{2~(sigma)^2}} $
parameters :
- F :
desc : Integral between 0and +inf. Fix this to 1 to obtain a log Normal distribution initial value : 1
mu :
desc : Central value initial value : 0.0
sigma :
desc : standard deviation initial value : 1.0 min : 1e-12
- piv :
desc : pivot. Leave this to 1 for a proper log normal distribution initial value : 1.0 fix : yes
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Log_parabola(**kwargs)[source]
Bases:
Function1D
description :
A log-parabolic function. NOTE that we use the high-energy convention of using the natural log in place of the base-10 logarithm. This means that beta is a factor 1 / log10(e) larger than what returned by those software using the other convention.
latex : $ K left( frac{x}{piv} right)^{alpha -beta log{left( frac{x}{piv} right)}} $
parameters :
- K :
desc : Normalization initial value : 1.0 is_normalization : True transformation : log10 min : 1e-30 max : 1e5
- piv :
desc : Pivot (keep this fixed) initial value : 1 fix : yes
alpha :
desc : index initial value : -2.0
beta :
desc : curvature (positive is concave, negative is convex) initial value : 1.0
- static info()
- property peak_energy
Returns the peak energy in the nuFnu spectrum
- Returns:
peak energy in keV
- class astromodels.functions.Log_uniform_prior(**kwargs)[source]
Bases:
Function1D
description :
A function which is K/x on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are NOT counted as part of the interval. Lower_bound must be >= 0.
latex : $ f(x)=K~begin{cases}0 & x le text{lower_bound} \frac{1}{x} & text{lower_bound} < x < text{upper_bound} \ 0 & x ge text{upper_bound} end{cases}$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : 1e-20 min : 1e-30 max : np.inf
upper_bound :
desc : Upper bound for the interval initial value : 100 min : 1e-30 max : np.inf
K :
desc : Normalization initial value : 1 fix : yes
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.ModifiedBlackbody(**kwargs)[source]
Bases:
Function1D
- description :
A blackbody function
latex : $f(x) = K frac{x^2}{exp(frac{x}{kT}) -1} $
- parameters :
- K :
desc : initial value : 1e-4 min : 0. is_normalization : True
- kT :
desc : temperature of the blackbody initial value : 30.0 min: 0.
- static info()
- class astromodels.functions.NonDissipativePhotosphere(**kwargs)[source]
Bases:
Function1D
- description :
Non-dissipative photosphere of a GRB occuring above the saturation radius Acuner, Z., Ryde, F. & Yu, H.-F. Mon Not R Astron Soc 487, 5508–5519 (2019).
latex : $N_{mathrm{E}}=Kleft(frac{E}{E_{mathrm{pivot}}}right)^{0.4} e^{-left(frac{E}{E_{c}}right)^{0.65}}$
- parameters :
- K :
desc : initial value : 1e-4 min : 0. is_normalization : True
- ec :
desc : peak energy initial value : 200.0 min: 0.
- piv :
desc : the pivot energy initial value: 100. fix: True
- static info()
- class astromodels.functions.NonDissipativePhotosphere_Deep(**kwargs)[source]
Bases:
Function1D
- description :
Non-dissipative photosphere of a GRB occuring BELOW the saturation radius. Acuner, Z., Ryde, F. & Yu, H.-F. Mon Not R Astron Soc 487, 5508–5519 (2019).
latex : $N_{mathrm{E}}=Kleft(frac{E}{E_{mathrm{pivot}}}right)^{0.66} e^{-left(frac{E}{E_{c}}right)}$
- parameters :
- K :
desc : initial value : 1e-4 min : 0. is_normalization : True
- ec :
desc : peak energy initial value : 200.0 min: 0.
- piv :
desc : the pivot energy initial value: 100. fix: True
- static info()
- class astromodels.functions.PhAbs(**kwargs)[source]
Bases:
Function1D
- description :
Photometric absorption (phabs implementation), f(E) = exp(- NH * sigma(E)) contributed by Dominique Eckert
- parameters :
- NH :
desc : absorbing column density in units of 1e22 particles per cm^2 initial value : 1.0 is_normalization : False transformation : log10 min : 1e-4 max : 1e4 delta : 0.1
- redshift :
desc : the redshift of the source initial value : 0. is_normalization : False min : 0 max : 15 delta : 0.1 fix: True
- properties:
- abundance_table:
desc: the abundance table for the model initial value: AG89 allowed values: - AG89 - ASPL function: _init_xsect
- property abundance_table_info
- static info()
- class astromodels.functions.Power_law_on_sphere(**kwargs)[source]
Bases:
Function2D
description :
A power law function on a sphere (in spherical coordinates)
latex : $$ f(vec{x}) = left(frac{180}{pi}right)^{-1.*index} left{begin{matrix} 0.05^{index} & {rm if} & ||vec{x}-vec{x}_0|| le 0.05\ ||vec{x}-vec{x}_0||^{index} & {rm if} & 0.05 < ||vec{x}-vec{x}_0|| le maxr \ 0 & {rm if} & ||vec{x}-vec{x}_0||>maxrend{matrix}right. $$
parameters :
lon0 :
desc : Longitude of the center of the source initial value : 0.0 min : 0.0 max : 360.0
lat0 :
desc : Latitude of the center of the source initial value : 0.0 min : -90.0 max : 90.0
index :
desc : power law index initial value : -2.0 min : -5.0 max : -1.0
maxr :
desc : max radius initial value : 20. fix : yes
minr :
desc : radius below which the PL is approximated as a constant initial value : 0.05 fix : yes
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Powerlaw(**kwargs)[source]
Bases:
Function1D
description :
A simple power-law
latex : $ K~frac{x}{piv}^{index} $
parameters :
K :
desc : Normalization (differential flux at the pivot value) initial value : 1.0 is_normalization : True transformation : log10 min : 1e-30 max : 1e3 delta : 0.1
piv :
desc : Pivot value initial value : 1 fix : yes
index :
desc : Photon index initial value : -2.01 min : -10 max : 10
- tests :
{ x : 10, function value: 0.01, tolerance: 1e-20}
{ x : 100, function value: 0.0001, tolerance: 1e-20}
- static info()
- class astromodels.functions.Powerlaw_Eflux(**kwargs)[source]
Bases:
Function1D
- description :
A power-law where the normalization is the energy flux defined between a and b
latex : $F~frac{x}{piv}^{index} $ parameters :
- F :
desc : Normalization (energy flux at the between a and b) erg /cm2 s initial value : 1.e-5 is_normalization : True transformation : log10 min : 1e-30 max : 1e3 delta : 0.1
- piv :
desc : Pivot value initial value : 1 fix : yes
- index :
desc : Photon index initial value : -2 min : -10 max : 10
- a :
desc : lower energy integral bound (keV) initial value : 1 min : 0 fix: yes
- b :
desc : upper energy integral bound (keV) initial value : 100 min : 0 fix: yes
- static info()
- class astromodels.functions.Powerlaw_Prior(**kwargs)[source]
Bases:
Function1D
description :
An power law distribution function between a-b
latex : $ f(x, alpha) = alpha x^{alpha-1)$
parameters :
alpha :
desc : slope parameter initial value : 1 min: 0.
- a :
desc: lower bound of distribution initial value : 0. min: 0.
- b:
desc: upper bound of distribution initial value: 1 min: 0.
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.Powerlaw_flux(**kwargs)[source]
Bases:
Function1D
description :
A simple power-law with the photon flux in a band used as normalization. This will reduce the correlation between the index and the normalization.
latex : $ frac{F(gamma+1)} {b^{gamma+1} - a^{gamma+1}} (x)^{gamma}$
parameters :
F :
desc : Integral between a and b initial value : 1 is_normalization : True transformation : log10 min : 1e-30 max : 1e3 delta : 0.1
index :
desc : Photon index initial value : -2 min : -10 max : 10
a :
desc : lower bound for the band in which computing the integral F initial value : 1.0 fix : yes
b :
desc : upper bound for the band in which computing the integral F initial value : 100.0 fix : yes
- static info()
- class astromodels.functions.Quadratic(**kwargs)[source]
Bases:
Function1D
description :
A Quadratic function
latex : $ a + b cdot x + c cdot x^2 $
parameters :
a :
desc : coefficient initial value : 1
b :
desc : coefficient initial value : 1
c :
desc : coefficient initial value : 1
- static info()
- class astromodels.functions.Quartic(**kwargs)[source]
Bases:
Function1D
description :
A quartic function
latex : $ a + b cdot x + c cdot x^2 + d cdot x^3 + e cdot x^4$
parameters :
a :
desc : coefficient initial value : 1
b :
desc : coefficient initial value : 1
c :
desc : coefficient initial value : 1
d :
desc : coefficient initial value : 1
e :
desc : coefficient initial value : 1
- static info()
- class astromodels.functions.Sin(**kwargs)[source]
Bases:
Function1D
description :
A sinusodial function
latex : $ K~sin{(2pi f x + phi)} $
parameters :
K :
desc : Normalization initial value : 1 is_normalization : True
f :
desc : frequency initial value : 1.0 / (2 * np.pi) min : 0
phi :
desc : phase initial value : 0 min : -np.pi max : +np.pi unit: rad
- tests :
{ x : 0.0, function value: 0.0, tolerance: 1e-10}
{ x : 1.5707963267948966, function value: 1.0, tolerance: 1e-10}
- static info()
- class astromodels.functions.SmoothlyBrokenPowerLaw(**kwargs)[source]
Bases:
Function1D
description :
A Smoothly Broken Power Law
Latex : $ $
parameters :
K :
desc : normalization initial value : 1 min : 1e-50 is_normalization : True transformation : log10
alpha :
desc : power law index below the break initial value : -1 min : -1.5 max : 2
break_energy:
desc: location of the peak initial value : 300 fix : no min : 10 transformation : log10
break_scale :
desc: smoothness of the break initial value : 0.5 min : 0. max : 10. fix : yes
beta:
desc : power law index above the break initial value : -2. min : -5.0 max : -1.6
pivot:
desc: where the spectrum is normalized initial value : 100. fix: yes
- static info()
- class astromodels.functions.SpatialTemplate_2D(**kwargs)[source]
Bases:
Function2D
description :
User input Spatial Template. Expected to be normalized to 1/sr
latex : $ hi $
parameters :
K :
desc : normalization initial value : 1 fix : yes
hash :
desc: hash of model map [needed for memoization] initial value: 1 fix: yes
- ihdu:
desc: header unit index of fits file initial value: 0 fix: True min: 0
- properties:
- fits_file:
desc: fits file to load defer: True function: _load_file
- frame:
desc: coordinate frame initial value: icrs allowed values: - icrs - galactic - fk5 - fk4 - fk4_no_e
- get_boundaries()[source]
Returns the boundaries of this function. By default there is no boundary, but subclasses can override this.
- Returns:
a tuple of tuples containing the boundaries for each coordinate (ra_min, ra_max), (dec_min, dec_max)
- get_total_spatial_integral(z=None)[source]
Returns the total integral (for 2D functions) or the integral over the spatial components (for 3D functions). needs to be implemented in subclasses.
- Returns:
an array of values of the integral (same dimension as z).
- static info()
- class astromodels.functions.Standard_Rv(value)[source]
Bases:
Enum
An enumeration.
- LMC = 3.16
- MW = 3.08
- SMC = 2.93
- class astromodels.functions.StepFunction(**kwargs)[source]
Bases:
Function1D
description :
A function which is constant on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are counted as part of the interval.
latex : $ f(x)=begin{cases}0 & x < text{lower_bound} \text{value} & text{lower_bound} le x le text{upper_bound} \ 0 & x > text{upper_bound} end{cases}$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : 0
upper_bound :
desc : Upper bound for the interval initial value : 1
value :
desc : Value in the interval initial value : 1.0
- tests :
{ x : 0.5, function value: 1.0, tolerance: 1e-20}
{ x : -0.5, function value: 0, tolerance: 1e-20}
- static info()
- class astromodels.functions.StepFunctionUpper(**kwargs)[source]
Bases:
Function1D
description :
A function which is constant on the interval lower_bound - upper_bound and 0 outside the interval. The upper interval is open.
latex : $ f(x)=begin{cases}0 & x < text{lower_bound} \text{value} & text{lower_bound} le x le text{upper_bound} \ 0 & x > text{upper_bound} end{cases}$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : 0 fix : yes
upper_bound :
desc : Upper bound for the interval initial value : 1 fix : yes
value :
desc : Value in the interval initial value : 1.0
- tests :
{ x : 0.5, function value: 1.0, tolerance: 1e-20}
{ x : -0.5, function value: 0, tolerance: 1e-20}
- static info()
- class astromodels.functions.Super_cutoff_powerlaw(**kwargs)[source]
Bases:
Function1D
description :
A power law with a super-exponential cutoff
latex : $ K~frac{x}{piv}^{index}~exp{(-x/xc)^{gamma}} $
parameters :
K :
desc : Normalization (differential flux at the pivot value) initial value : 1.0 min : 1e-50 is_normalization : True transformation : log10
piv :
desc : Pivot value initial value : 1 fix : yes
index :
desc : Photon index initial value : -2 min : -10 max : 10
xc :
desc : Cutoff energy initial value : 10.0 min : 1.0 transformation : log10
gamma :
desc : Index of the super-exponential cutoff initial value : 1.0 min : 0.1 max : 10.0
- static info()
- class astromodels.functions.TbAbs(**kwargs)[source]
Bases:
Function1D
- description :
Photometric absorption (Tbabs implementation), f(E) = exp(- NH * sigma(E)) contributed by Dominique Eckert
- parameters :
- NH :
desc : absorbing column density in units of 1e22 particles per cm^2 initial value : 1.0 is_normalization : True transformation : log10 min : 1e-4 max : 1e4 delta : 0.1
- redshift :
desc : the redshift of the source initial value : 0. is_normalization : False min : 0 max : 15 delta : 0.1 fix: True
- properties:
- abundance_table:
desc: the abundance table for the model initial value: WILM allowed values: - WILM - AG89 - ASPL function: _init_xsect
- property abundance_table_info
- static info()
- class astromodels.functions.TemplateModel(model_name: str, other_name: Optional[str] = None, log_interp: bool = True)[source]
Bases:
Function1D
- description :
A template model
- latex :
$n.a.$
- parameters :
- K :
desc : Normalization (freeze this to 1 if the template provides the normalization by itself) initial value : 1.0
- scale :
- descScale for the independent variable. The templates are handled as if they contains the fluxes
at E = scale * x.This is useful for example when the template describe energies in the rest frame, at which point the scale describe the transformation between rest frame energy and observer frame energy. Fix this to 1 to neutralize its effect.
initial value : 1.0 min : 1e-5
- redshift:
desc: redshift the energies initial value: 0. min: 0 fix: True
- clean()[source]
Table models can consume a lot of memory. If are creating lots of table models in memory for simulations, you may want to call clean on the model try and remove some of the memory consumed by the models
- Returns:
- property data_file
- static info()
- class astromodels.functions.TemplateModelFactory(name: str, description: str, energies: ndarray, names_of_parameters: List[str], interpolation_degree: int = 1, spline_smoothing_factor: int = 0)[source]
Bases:
object
- add_interpolation_data(differential_fluxes: ndarray, **parameters_values_input: Dict[str, float])[source]
- class astromodels.functions.Truncated_gaussian(**kwargs)[source]
Bases:
Function1D
description :
A truncated Gaussian function defined on the interval between the lower_bound (a) and upper_bound (b)
latex : $begin{split}f(x;mu,sigma,a,b)=frac{frac{1}{sigma} phileft( frac{x-mu}{sigma} right)}{Phileft( frac{b-mu}{sigma} right) - Phileft( frac{a-mu}{sigma} right)}\phileft(zright)=frac{1}{sqrt{2 pi}}expleft(-frac{1}{2}z^2right)\Phileft(zright)=frac{1}{2}left(1+erfleft(frac{z}{sqrt(2)}right)right)end{split}$
parameters :
F :
desc : Integral between -inf and +inf. Fix this to 1 to obtain a Normal distribution initial value : 1
mu :
desc : Central value initial value : 0.0
sigma :
desc : standard deviation initial value : 1.0 min : 1e-12
lower_bound :
desc: lower bound of gaussian, setting to -np.inf results in half normal distribution initial value : -1.
upper_bound :
desc: upper bound of gaussian setting to np.inf results in half normal distribution initial value : 1.
- tests :
{ x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}
{ x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}
- static info()
- class astromodels.functions.Uniform_prior(**kwargs)[source]
Bases:
Function1D
description :
A function which is constant on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are counted as part of the interval.
latex : $ f(x)=begin{cases}0 & x < text{lower_bound} \text{value} & text{lower_bound} le x le text{upper_bound} \ 0 & x > text{upper_bound} end{cases}$
parameters :
lower_bound :
desc : Lower bound for the interval initial value : 0 min : -np.inf max : np.inf
upper_bound :
desc : Upper bound for the interval initial value : 1 min : -np.inf max : np.inf
value :
desc : Value in the interval initial value : 1.0
- tests :
{ x : 0.5, function value: 1.0, tolerance: 1e-20}
{ x : -0.5, function value: 0, tolerance: 1e-20}
- from_unit_cube(x)[source]
Used by multinest
- Parameters:
x – 0 < x < 1
lower_bound –
upper_bound –
- Returns:
- static info()
- class astromodels.functions.WAbs(**kwargs)[source]
Bases:
Function1D
- description :
Photometric absorption (Wabs implementation), f(E) = exp(- NH * sigma(E)) contributed by Dominique Eckert
- parameters :
- NH :
desc : absorbing column density in units of 1e22 particles per cm^2 initial value : 1.0 is_normalization : True transformation : log10 min : 1e-4 max : 1e4 delta : 0.1
- redshift :
desc : the redshift of the source initial value : 0. is_normalization : False min : 0 max : 15 delta : 0.1 fix: True
- property abundance_table_info
- static info()
- class astromodels.functions.XSPECTableModel(xspec_table_model_file, interpolation_degree=1, spline_smoothing_factor=0, log_centers=True)[source]
Bases:
object
- class astromodels.functions.ZDust(**kwargs)[source]
Bases:
Function1D
- description :
Extinction by dust grains from Pei (1992), suitable for IR, optical and UV energy bands, including the full energy ranges of the Swift UVOT and XMM-Newton OM detectors. Three models are included which characterize the extinction curves of (1) the Milky Way, (2) the LMC and (3) the SMC. The models can be modified by redshift and can therefore be applied to extragalactic sources. The transmission is set to unity shortward of 912 Angstroms in the rest frame of the dust. This is incorrect physically but does allow the model to be used in combination with an X-ray photoelectric absorption model such as phabs. Parameter 1 (method) describes which extinction curve (MW, LMC or SMC) will be constructed and should never be allowed to float during a fit. The extinction at V, A(V) = E(B-V) x Rv. Rv should typically remain frozen for a fit. Standard values for Rv are MW = 3.08, LMC = 3.16 and SMC = 2.93 (from table 2 of Pei 1992), although these may not be applicable to more distant dusty sources.
- parameters :
- e_bmv :
desc : color excess initial value : 1.0 min: 0 is_normalization : False delta : 0.1
- rv :
desc : ratio of total to selective extinction initial value : 3.08 is_normalization : False delta : 0.1 fix: True
- redshift :
desc : the redshift of the source initial value : 0. is_normalization : False min : 0 max : 15 delta : 0.1 fix: True
- properties:
- extinction_law:
desc: the abundance table for the model initial value: mw allowed values: - mw - lmc - smc
function: _set_extinction_law
- static info()
- astromodels.functions.get_polynomial(order: int) Function1D [source]
get a polynomial function of order
- Parameters:
order (int) – the order of the polynomical
- Returns: