srcmodel.spectrum¶
-
ximpol.srcmodel.spectrum.int_eflux2pl_norm(integral, emin, emax, index, erg=True)[source]¶ Convert an integral energy flux into the corresponding power-law normalization.
-
ximpol.srcmodel.spectrum.pl_norm(integral, emin, emax, index, energy_power=0.0)[source]¶ Return the power-law normalization resulting in a given integral flux (or integral energy flux, or more in general integral of the flux multiplied by a generic power of the energy) between the minimum and maximum energies assuming a given spectral index.
More specifically, given a power law of the form
![\mathcal{S}(E) = C\left( \frac{E}{E_0} \right)^{-\Gamma}
\quad [{\rm keV}^{-1}~{\rm cm}^{-2}~{\rm s}^{-1}],](../_images/math/eb6a8e1e68b33745dfc753da710da02ef0158e90.png)
(where
) we define
and calculate![I_{p} = \int_{E_{\rm min}}^{E_{\rm max}} E^{p}\mathcal{S}(E) dE =
\begin{cases}
\frac{C E_0^{\Gamma}}{\beta}
\left( E_{\rm max}^{\beta} - E_{\rm min}^{\beta}\right)
\quad \beta \neq 0\\
C E_0^{\Gamma} \ln \left( E_{\rm max}/E_{\rm min} \right)
\quad \beta = 0\\
\end{cases}
\quad [{\rm keV}^{p}~{\rm cm}^{-2}~{\rm s}^{-1}].](../_images/math/0a728a3e5391ced8e82289779af434b211516f78.png)
Hence

Parameters: - integral (float or array) – The value of the integral flux or energy-to-some-power flux
- emin (float) – The minimum energy for the integral flux
- emax (float) – The maximum energy for the integral flux
- index (float) – The power-law index
- energy_power (float) – The power of the energy in the integral
- erg (bool) – if True, convert erg to keV in the calculation.
-
ximpol.srcmodel.spectrum.power_law(C, Gamma)[source]¶ Photon energy spectrum as a function of energy and time.
If C and Gamma are callable, we assume that the argument of the __call__ function is the time, and this is how we treat them internally.
-
class
ximpol.srcmodel.spectrum.xCountSpectrum(source_spectrum, aeff, t, column_density=0.0, redshift=0.0, scale_factor=1.0)[source]¶ Class representing a count spectrum, i.e., the convolution of the source photon spectrum and the detector effective area
![\mathcal{C}(E, t) = \mathcal{S}(E, t) \times A_{\rm eff}(E)
\quad [\text{s}^{-1}~\text{keV}^{-1}].](../_images/math/cdb277958fd7465b14a32b389322b423a93d310b.png)
This is a subclass of xUnivariateAuxGenerator, providing all the facilities implemented in a bivariate spline, along with the capability of extracting random numbers.
Note that the light curve corresponding to the count spectrum is calculated when a class object is instantiated.
-
build_energy_integral(emin=None, emax=None)[source]¶ Build the energy-integrated count spectrum, i.e.
![\int_{E_{\rm min}}^{E_{\rm max}} \mathcal{C}(E, t) dE \quad
[\text{Hz}].](../_images/math/6a847febc18b2ea3201dccd67d638732497e83f3.png)
The output is stored in the form of a xUnivariateGenerator, featuring all the spline facilities, along with the capability of extracting random numbers.
-
build_light_curve()[source]¶ Build the light curve, i.e., the count spectrum, integrated over the entire energy range, as a function of time.
-
build_mdp_table(energy_binning, modulation_factor)[source]¶ Calculate the MDP values in energy bins, given the modulation factor of the instrument as a function of the energy.
Parameters: - energy_binning (array) – The energy binning
- modulation_factor (ximpol.irf.mrf.xModulationFactor instance) – The instrument modulation factor as a function of the energy.
-
![\int_{t_{\rm min}}^{t_{\rm max}} \mathcal{C}(E, t) dt \quad
[\text{keV}^{-1}].](../_images/math/4238fc0d76dbff8a8e16f06186e38561d787935a.png)
