astromodels.functions.functions_1D package

Submodules

Module contents

class astromodels.functions.functions_1D.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 is_normalization : True

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

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

evaluate(x, K, alpha, xp, beta, piv)[source]
static info()
class astromodels.functions.functions_1D.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 : 0

F :

desc : integral in the band defined by a and b initial value : 1e-6 is_normalization : True

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

evaluate(x, alpha, beta, xp, F, a, b, opt)[source]
static ggrb_int_cpl(a, Ec, Emin, Emax)[source]
static info()
class astromodels.functions.functions_1D.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 is_normalization : True

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

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

evaluate(x, K, alpha, xc, beta, piv)[source]
static info()
class astromodels.functions.functions_1D.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.

evaluate(x, K, kT)[source]
static info()
class astromodels.functions.functions_1D.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 is_normalization : True

xb :

desc : Break point initial value : 10 min : 1.0

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

evaluate(x, K, xb, alpha, beta, piv)[source]
static info()
class astromodels.functions.functions_1D.Constant(**kwargs)[source]

Bases: Function1D

description :

Return k

latex : $ k $

parameters :

k :

desc : Constant value initial value : 0

evaluate(x, k)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, a, b, c, d)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, piv, index, xc)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, piv, index, xp)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, value, zero_point)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, xc)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, piv, index, b)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, a, b)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, piv, alpha, beta)[source]
static info()
property peak_energy

Returns the peak energy in the nuFnu spectrum

Returns

peak energy in keV

class astromodels.functions.functions_1D.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.

evaluate(x, K, kT)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, ec, piv)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, K, ec, piv)[source]
static info()
class astromodels.functions.functions_1D.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
evaluate(x, NH, redshift)[source]
static info()
class astromodels.functions.functions_1D.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}

evaluate(x, K, piv, index)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, F, piv, index, a, b)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, F, index, a, b)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, a, b, c)[source]
static info()
class astromodels.functions.functions_1D.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

evaluate(x, a, b, c, d, e)[source]
static info()
class astromodels.functions.functions_1D.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}

evaluate(x, K, f, phi)[source]
static info()
class astromodels.functions.functions_1D.SmoothlyBrokenPowerLaw(**kwargs)[source]

Bases: Function1D

description :

A Smoothly Broken Power Law

Latex : $ $

parameters :

K :

desc : normalization initial value : 1 min : 0 is_normalization : True

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

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

evaluate(x, K, alpha, break_energy, break_scale, beta, pivot)[source]
static info()
class astromodels.functions.functions_1D.Standard_Rv(value)[source]

Bases: Enum

An enumeration.

LMC = 3.16
MW = 3.08
SMC = 2.93
class astromodels.functions.functions_1D.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}

evaluate(x, lower_bound, upper_bound, value)[source]
static info()
class astromodels.functions.functions_1D.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}

evaluate(x, lower_bound, upper_bound, value)[source]
static info()
class astromodels.functions.functions_1D.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 is_normalization : True

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

gamma :

desc : Index of the super-exponential cutoff initial value : 1.0 min : 0.1 max : 10.0

evaluate(x, K, piv, index, xc, gamma)[source]
static info()
class astromodels.functions.functions_1D.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
evaluate(x, NH, redshift)[source]
static info()
class astromodels.functions.functions_1D.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
evaluate(x, NH, redshift)[source]
static info()
class astromodels.functions.functions_1D.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 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

evaluate(x, e_bmv, rv, redshift)[source]
property extinction_law: _ExtinctionCurve

Get/set extinction law

get_extinction_law() _ExtinctionCurve[source]
static info()
set_extinction_law(extinction_law: str = 'MW') None[source]
astromodels.functions.functions_1D.get_polynomial(order: int) Function1D[source]

get a polynomial function of order

Parameters

order (int) – the order of the polynomical

Returns