elisa.models.conv#
Convolution models.
- class EnFlux(emin, emax, F: 'Parameter' | float | None = None, latex: str | None = None, ngrid=None, elog=None)[source]#
Bases:
NormConvolutionNormalize an additive model by energy flux between emin and emax.
\[N'(E) = \mathcal{F}_\mathrm{en} \left[\int_{E_\mathrm{min}}^{E_\mathrm{max}} EN(E)\,dE\right]^{-1} N(E)\]Warning
The normalization of one of the additive components must be fixed to a positive value.
Warning
The flux is calculated by trapezoidal rule, and is accurate only if enough numbers of energy grids are used.
- Parameters:
- emin
floatorint Minimum energy of the band to calculate the flux, in units of keV.
- emax
floatorint Maximum energy of the band to calculate the flux, in units of keV.
- F
Parameter, optional Energy flux \(\mathcal{F}_\mathrm{en}\), in units of erg cm⁻² s⁻¹.
- latex
str, optional \(\LaTeX\) format of the component. Defaults to class name.
- ngrid
int, optional The energy grid number to use. The default is 1000.
- elogbool, optional
Whether to use logarithmically regular energy grids. The default is True.
- emin
Attributes
EnFlux parameter \(\mathcal{F}_\mathrm{en}\).
elogWhether to use logarithmically regular energy grids.
emaxMaximum value of photon energy grid
eminMinimum value of photon energy grid
evalGet side-effect free component evaluation function.
latex\(\LaTeX\) format of the component.
nameComponent name.
ngridPhoton energy grid number.
param_namesComponent's parameter names.
typeComponent type.
Methods
convolve(egrid, params, model_fn, flux_egrid)Convolve a model function.
- static convolve(egrid: JAXArray, params: NameValMapping, model_fn: Callable[[JAXArray], JAXArray], flux_egrid: JAXArray) JAXArray[source]#
Convolve a model function.
- Parameters:
- egrid
ndarray Photon energy grid in units of keV.
- params
dict Parameter dict for the convolution model.
- model_fn
callable() The model function to be convolved, which takes the energy grid as input and returns the model flux over the grid.
- flux_egrid
ndarray Photon energy grid used to calculate flux in units of keV.
- egrid
- Returns:
- value
ndarray The re-normalized model over egrid, in units of ph cm⁻² s⁻¹ keV⁻¹.
- value
- class PhFlux(emin, emax, F: 'Parameter' | float | None = None, latex: str | None = None, ngrid=None, elog=None)[source]#
Bases:
NormConvolutionNormalize an additive model by photon flux between emin and emax.
\[N'(E) = \mathcal{F}_\mathrm{ph} \left[\int_{E_\mathrm{min}}^{E_\mathrm{max}} N(E) \, dE\right]^{-1} N(E)\]Warning
The normalization of one of the additive components must be fixed to a positive value.
Warning
The flux is calculated by trapezoidal rule, and is accurate only if enough numbers of energy grids are used.
- Parameters:
- emin
floatorint Minimum energy of the band to calculate the flux, in units of keV.
- emax
floatorint Maximum energy of the band to calculate the flux, in units of keV.
- F
Parameter, optional Photon flux \(\mathcal{F}_\mathrm{ph}\), in units of ph cm⁻² s⁻¹.
- latex
str, optional \(\LaTeX\) format of the component. Defaults to class name.
- ngrid
int, optional The energy grid number to use. The default is 1000.
- elogbool, optional
Whether to use logarithmically regular energy grids. The default is True.
- emin
Attributes
PhFlux parameter \(\mathcal{F}_\mathrm{ph}\).
elogWhether to use logarithmically regular energy grids.
emaxMaximum value of photon energy grid
eminMinimum value of photon energy grid
evalGet side-effect free component evaluation function.
latex\(\LaTeX\) format of the component.
nameComponent name.
ngridPhoton energy grid number.
param_namesComponent's parameter names.
typeComponent type.
Methods
convolve(egrid, params, model_fn, flux_egrid)Convolve a model function.
- static convolve(egrid: Array, params: dict[str, Array], model_fn: Callable[[Array], Array], flux_egrid: Array) Array[source]#
Convolve a model function.
- Parameters:
- egrid
ndarray Photon energy grid in units of keV.
- params
dict Parameter dict for the convolution model.
- model_fn
callable() The model function to be convolved, which takes the energy grid as input and returns the model flux over the grid.
- flux_egrid
ndarray Photon energy grid used to calculate flux in units of keV.
- egrid
- Returns:
- value
ndarray The re-normalized model over egrid, in units of ph cm⁻² s⁻¹ keV⁻¹.
- value
- class ZAShift(z: 'Parameter' | float | None = None, latex: str | None = None)[source]#
Bases:
ConvolutionComponentRedshifts an additive model.
Consider a source with an emission area of radius \(R\) at redshift \(z\). Given the flux function \(N(E)\) [ph s⁻¹ cm⁻² keV⁻¹] at the radius \(R\), the observed number of photons \(n\) between the energy range \(e_1\) [keV] and \(e_2\) [keV] during an exposure time of \(\Delta t\) [s] is calculated as follows:
\[\begin{split}n &= \frac{R^2}{{D_\mathrm{c}}^2} \frac{\Delta t}{1+z} \int_{e_1(1+z)}^{e_2(1+z)} N(E) \, \mathrm{d}E \\\\ &= \frac{R^2}{{D_\mathrm{c}}^2} \frac{\Delta t}{1+z} \int_{E_1}^{E_2} N(E) \, \mathrm{d}E,\end{split}\]where \(E_1 = e_1 (1+z)\) [keV], \(E_2 = e_2 (1+z)\) [keV] and \(D_\mathrm{c}\) is the comoving distance of the source at redshift \(z\).
Note that the \(\frac{R^2}{{D_\mathrm{c}}^2}\) factor is absorbed into the normalization of \(N(E)\) in practice.
- Parameters:
Attributes
evalGet side-effect free component evaluation function.
latex\(\LaTeX\) format of the component.
nameComponent name.
param_namesComponent's parameter names.
typeComponent type.
ZAShift parameter \(z\).
Methods
convolve(egrid, params, model_fn)Convolve a model function.
- static convolve(egrid: Array, params: dict[str, Array], model_fn: Callable[[Array], Array]) Array[source]#
Convolve a model function.
- Parameters:
- egrid
ndarray Photon energy grid in units of keV.
- params
dict Parameter dict for the convolution model.
- model_fn
callable() The model function to be convolved, which takes the energy grid as input and returns the model value over the grid.
- egrid
- Returns:
jax.ArrayThe convolved model value over egrid.
- class ZMShift(z: 'Parameter' | float | None = None, latex: str | None = None)[source]#
Bases:
ConvolutionComponentRedshifts a multiplicative model.
Consider a source at redshift \(z\). Given the dimensionless model function \(M(E)\), the observed value between the energy range \(e_1\) [keV] and \(e_2\) [keV] is calculated as follows:
\[\begin{split}m &= \frac{1}{(e_2 - e_1)(1+z)} \int_{e_1(1+z)}^{e_2(1+z)} M(E) \, \mathrm{d}E \\\\ &= \frac{1}{E_2 - E_1} \int_{E_1}^{E_2} M(E) \, \mathrm{d}E,\end{split}\]where \(E_1 = e_1 (1+z)\) [keV] and \(E_2 = e_2 (1+z)\) [keV].
- Parameters:
Attributes
evalGet side-effect free component evaluation function.
latex\(\LaTeX\) format of the component.
nameComponent name.
param_namesComponent's parameter names.
typeComponent type.
ZMShift parameter \(z\).
Methods
convolve(egrid, params, model_fn)Convolve a model function.
- static convolve(egrid: Array, params: dict[str, Array], model_fn: Callable[[Array], Array]) Array[source]#
Convolve a model function.
- Parameters:
- egrid
ndarray Photon energy grid in units of keV.
- params
dict Parameter dict for the convolution model.
- model_fn
callable() The model function to be convolved, which takes the energy grid as input and returns the model value over the grid.
- egrid
- Returns:
jax.ArrayThe convolved model value over egrid.
- class VAShift(v: 'Parameter' | float | None = None, latex: str | None = None)[source]#
Bases:
ConvolutionComponentVelocity shifts an additive model.
Consider a source with an emission area of radius \(R\), moving with speed \(v\) along line of sight. Given the flux function \(N(E)\) [ph s⁻¹ cm⁻² keV⁻¹] at the radius \(R\), the observed number of photons \(n\) between the energy range \(e_1\) [keV] and \(e_2\) [keV] during an exposure time of \(\Delta t\) [s] is calculated as follows:
\[\begin{split}n &= \Delta t \int_{fe_1}^{fe_2} N(E) \, \mathrm{d}E \\\\ &= \Delta t \int_{E_1}^{E_2} N(E) \, \mathrm{d}E,\end{split}\]where \(E_1 = f e_1\) [keV], \(E_2 = f e_2\) [keV], and \(f = 1 - v/c\).
- Parameters:
Attributes
evalGet side-effect free component evaluation function.
latex\(\LaTeX\) format of the component.
nameComponent name.
param_namesComponent's parameter names.
typeComponent type.
VAShift parameter \(v\).
Methods
convolve(egrid, params, model_fn)Convolve a model function.
- static convolve(egrid: Array, params: dict[str, Array], model_fn: Callable[[Array], Array]) Array[source]#
Convolve a model function.
- Parameters:
- egrid
ndarray Photon energy grid in units of keV.
- params
dict Parameter dict for the convolution model.
- model_fn
callable() The model function to be convolved, which takes the energy grid as input and returns the model value over the grid.
- egrid
- Returns:
jax.ArrayThe convolved model value over egrid.
- class VMShift(v: 'Parameter' | float | None = None, latex: str | None = None)[source]#
Bases:
ConvolutionComponentVelocity shifts a multiplicative model.
Consider a source moving with speed \(v\) along line of sight. Given the dimensionless model function \(M(E)\), the observed value between the energy range \(e_1\) [keV] and \(e_2\) [keV] is calculated as follows:
\[\begin{split}m &= \frac{1}{f (e_2 - e_1)} \int_{f e_1}^{f e_2} M(E) \, \mathrm{d}E \\\\ &= \frac{1}{E_2 - E_1} \int_{E_1}^{E_2} M(E) \, \mathrm{d}E,\end{split}\]where \(E_1 = f e_1\) [keV], \(E_2 = f e_2\) [keV], and \(f = 1 - v/c\).
- Parameters:
Attributes
evalGet side-effect free component evaluation function.
latex\(\LaTeX\) format of the component.
nameComponent name.
param_namesComponent's parameter names.
typeComponent type.
VMShift parameter \(v\).
Methods
convolve(egrid, params, model_fn)Convolve a model function.
- static convolve(egrid: Array, params: dict[str, Array], model_fn: Callable[[Array], Array]) Array[source]#
Convolve a model function.
- Parameters:
- egrid
ndarray Photon energy grid in units of keV.
- params
dict Parameter dict for the convolution model.
- model_fn
callable() The model function to be convolved, which takes the energy grid as input and returns the model value over the grid.
- egrid
- Returns:
jax.ArrayThe convolved model value over egrid.