6.3.3. Model class structures¶
6.3.3.1. Model¶
- class pyspex.model.Model[source]¶
Top class containing the entire model, containing all sectors and components.
- par_couple(isect, icomp, iname, csect, ccomp, cname, factor)[source]¶
Couple parameter (iname) to another parameter with cname, with a coupling factor.
- Parameters:
isect (int) – Sector number of the parameter.
icomp (int) – Component number of the parameter.
iname (str) – Parameter name.
csect (int) – Sector number of the parameter to couple to.
ccomp (int) – Component number of the parameter to couple to.
cname (str) – Parameter name of the parameter to couple to.
factor (float) – Multiplication factor (value(name) = factor * value(cname)).
- par_get(isect, icomp, name)[source]¶
Get the parameter object for sector isect, component icomp and parameter with name.
- Parameters:
- Return type:
- par_norm_set(ins, reg, value, status)[source]¶
Set the instrument normalisation for an instrument number and region number.
- par_set(isect, icomp, name, value, thawn=False)[source]¶
Set parameter to value and optionally indicate thawn or frozen status.
- par_show(option='')[source]¶
Display parameter overview through the Python interface.
- Parameters:
option (str) – Select which information should be shown (free/couple/flux/stat/corr/all)
- par_show_classic(option='')[source]¶
Display parameter overview in terminal through the Fortran interface.
- Parameters:
option (str) – Select which information should be shown (free/couple/flux/stat/corr/all)
- par_show_couple()[source]¶
Display the coupled parameters through the Python interface and as Astropy table.
- Returns:
par_show_table
- Rtype par_show_table:
astropy.table.QTable
- par_show_flux()[source]¶
Display the flux information of the model components.
- Returns:
par_show_table
- Rtype par_show_table:
astropy.table.QTable
- par_show_free()[source]¶
Display the free parameters through the Python interface.
- Returns:
par_show_table
- Rtype par_show_table:
astropy.table.QTable
- par_show_param()[source]¶
Display the parameters through the Python interface and create Astropy table.
- Returns:
par_show_table
- Rtype par_show_table:
astropy.table.QTable
- sector_copy(isect)[source]¶
Copy an existing sector to a new one.
- Parameters:
isect (int) – Sector number to copy.
6.3.3.2. Sector¶
6.3.3.3. Component¶
- class pyspex.model.Component[source]¶
Class containing a model component.
- Variables:
index (int) – Component number.
umodel (int) – Model ID number.
add (bool) – Is this an additive component?
mul (bool) – Is this a multiplicative component?
operator (bool) – True for complex components.
npar (int) – Number of parameters in components.
name (str) – Name of model.
nmul (int) – Number of elements in addmul (below).
addmul (numpy.ndarray) – Array with the numbers of the multiplicative components to multiply with.
par (list) – List of parameter objects.
6.3.3.4. Parameter¶
- class pyspex.model.Parameter[source]¶
Class for model parameters.
- Variables:
isect – Sector number
icomp – Component number
index (int) – Parameter number
name (str) – Name of parameter
type (str) – Type of parameter (norm, abun, fitp, cons or text)
desc (str) – Description of parameter
value (float) – Value
low (float) – Lower boundary of parameter range
upp (float) – Upper boundary of parameter range
err_low (float) – Lower error boundary
err_upp (float) – Upper error boundary
free (bool) – True if parameter is free
linked (bool) – True if parameter is linked
link_sector (int) – Sector to which parameter is linked
link_comp (int) – Component to which parameter is linked
link_par (int) – Parameter to which parameter is linked
coupling (float) – Coupling factor
6.3.3.5. Abundance¶
6.3.3.6. Aerror¶
- class pyspex.model.Aerror[source]¶
Class for calculating the uncertainty in a parameter due to atomic data uncertainties.
- Variables:
aerr (float) – Error value for the requested parameter.
6.3.3.7. Distance¶
- class pyspex.model.Distance[source]¶
This class is used to set and get the distances in SPEX.
- Variables:
m (astropy.units.quantity.Quantity) – Distance in meter
au (astropy.units.quantity.Quantity) – Distance in Astronomical Units
ly (astropy.units.quantity.Quantity) – Distance in light year
pc (astropy.units.quantity.Quantity) – Distance in parsec
kpc (astropy.units.quantity.Quantity) – Distance in kiloparsec
mpc (astropy.units.quantity.Quantity) – Distance in megaparsec
z (astropy.units.quantity.Quantity) – Distance in redshift
cz (astropy.units.quantity.Quantity) – Distance in cz
age (astropy.units.quantity.Quantity) – Lookback time (yr)
h0 (astropy.units.quantity.Quantity) – Hubble constant (km/s/Mpc)
omega_m (astropy.units.quantity.Quantity) – Omega Matter
omega_l (astropy.units.quantity.Quantity) – Omega Lambda
omega_r (astropy.units.quantity.Quantity) – Omega R
- get(isect)[source]¶
Get the distances for a sector from SPEX.
- Parameters:
isect (int) – Sector number.
- set_cosmo(h0, omega_m, omega_l, omega_r)[source]¶
Set the cosmological constants for the distance calculation.
- Parameters:
h0 (astropy.units.quantity.Quantity) – Hubble constant (km/s/Mpc).
omega_m (astropy.units.quantity.Quantity) – Omega matter.
omega_l (astropy.units.quantity.Quantity) – Omega lambda.
omega_r (astropy.units.quantity.Quantity) – Omega R.
6.3.3.8. Energy grids¶
- class pyspex.model.Egrid[source]¶
This class is used to specify the model energy grid.
- Variables:
nbins (int) – Number of bins
energy (astropy.units.quantity.Quantity) – Centroids of bins (Energy, keV)
energy_upper (astropy.units.quantity.Quantity) – Upper boundaries of bins (Energy, keV)
energy_width (astropy.units.quantity.Quantity) – Widths of bins (Energy, keV)
- grid(ebounds)[source]¶
Provide a grid to SPEX by providing a numpy array with the bin boundaries. Please note that the length of this array is the number of bins + 1!
- Parameters:
ebounds (numpy.ndarray) – Array containing the energy boundaries of the new energy grid (keV).
- read(readfile)[source]¶
Read the energy grid from a file named readfile (extension: .egr).
- Parameters:
readfile (str) – Filename to read the energy grid from (including .egr extension)
- save(savefile)[source]¶
Save the energy grid to a file named savefile (extension: .egr).
- Parameters:
savefile (str) – Filename to save the energy grid to (including .egr extension)
- set(elow, ehigh, nbins, unit, log)[source]¶
Set egrid using limits and number of bins.
- Parameters:
elow (float) – Lowest energy/wavelength for energy grid.
ehigh (float) – Highest energy/wavelength for energy grid.
nbins (int) – Number of bins for energy grid.
unit (str) – Unit of the energy/wavelength range, for example: ‘kev’, ‘ev’, ‘ryd’, ‘j’, ‘hz’, ‘ang’, ‘nm’
log (bool) – Make the energy grid logarithmic (True or False)
- set_step(elow, ehigh, step, unit, log)[source]¶
Set egrid using limits and step size.
- Parameters:
elow (float) – Lowest energy/wavelength for energy grid.
ehigh (float) – Highest energy/wavelength for energy grid.
step (float) – Step size for the energy grid.
unit (str) – Unit of the energy/wavelength range, for example: ‘kev’, ‘ev’, ‘ryd’, ‘j’, ‘hz’, ‘ang’, ‘nm’
log (bool) – Make the energy grid logarithmic (True or False)
6.3.3.9. Fluxes and luminosities¶
- class pyspex.model.Fluxes[source]¶
This class is used to calculate fluxes and luminosities of spectra in a spectral band.
- Variables:
sector (int) – Sector number of flux calculation
component (int) – Component number of flux calculation
photflux (astropy.units.quantity.Quantity) – Photon flux (phot/m**2/s)
enerflux (astropy.units.quantity.Quantity) – Energy flux (W/m**2)
photlum (astropy.units.quantity.Quantity) – Photon luminosity (photons/s)
enerlum (astropy.units.quantity.Quantity) – Energy luminosity (W)
elimflux (astropy.units.quantity.Quantity) – Flux energy limits (keV)
- calc(isect, icomp)[source]¶
Calculate and get flux and luminosity from SPEX for a given sector and component number.
- elimflux¶
Flux energy limits (keV)
6.3.3.10. Ionisation balance¶
6.3.3.11. Ion selection¶
- class pyspex.model.Ions[source]¶
Class to manage the ions taken into account in the model calculation.
- Variables:
- ignore_iso(iso)[source]¶
Ignore this iso-electronic sequence.
- Parameters:
iso (int) – Iso-electronic sequence.
- lmax_all(lmax)[source]¶
Set all ions to maximum angular momentum lmax.
- Parameters:
lmax (int) – Maximum angular momentum to use.
- new_iso(iso)[source]¶
Use new calculations for this iso-electronic sequence.
- Parameters:
iso (int) – Iso-electronic sequence.
- new_z(z)[source]¶
Use new calculations for all ions of this element.
- Parameters:
z (int) – Atomic number
- nmax_all(nmax)[source]¶
Set all ions to maximum quantum number nmax.
- Parameters:
nmax (int) – Maximum principle quantum number to use.
- old_iso(iso)[source]¶
Use old calculations for this iso-electronic sequence.
- Parameters:
iso (int) – Iso-electronic sequence.
- old_z(z)[source]¶
Use old calculations for all ions of this element.
- Parameters:
z (int) – Atomic number
- qc_iso(iso)[source]¶
Use qc calculations for this iso-electronic sequence.
- Parameters:
iso (int) – Iso-electronic sequence.
- qc_z(z)[source]¶
Use qc calculations for all ions of this element.
- Parameters:
z (int) – Atomic number
6.3.3.12. Model spectra¶
- class pyspex.model.Spectrum[source]¶
This class obtains and stores the model spectrum from SPEX.
- Variables:
nbins (int) – Number of bins
energy (astropy.units.quantity.Quantity) – Centroids of bins (Energy, keV)
energy_upper (astropy.units.quantity.Quantity) – Upper boundaries of bins (Energy, keV)
energy_width (astropy.units.quantity.Quantity) – Widths of bins (Energy, keV)
spectrum (astropy.units.quantity.Quantity) – Spectrum of bins (in ph/s/m**2/bin at observatory)
luminosity (astropy.units.quantity.Quantity) – Spectrum of bins (in 10^44 ph/s/keV at source distance)
table (astropy.table.QTable) – Astropy QTable containing spectrum.
6.3.3.13. DEM Modeling¶
- class pyspex.model.Dem[source]¶
SPEX DEM modeling interface.
- Variables:
nr (int) – Number of temperature bins.
tw (astropy.quantity.Quantity) – Temperature bins in keV.
yw (astropy.quantity.Quantity) – Differential emission measure as a function of temperature (in 10^64 m**3 / keV).
ywerr (astropy.quantity.Quantity) – Error on the differential emission measure as a function of temperature (in 10^64 m**3 / keV).
chisq (float) – Chi^2 value for the DEM fit.
dempen (float) – Dem penalty, number of bins that are less or equal to 0.
table (astropy.table.QTable) – Astropy QTable containing DEM model.
6.3.3.14. Plasma parameters¶
- class pyspex.model.Var[source]¶
Various settings for the plasma models.
- Variables:
gacc (float) – Free-bound accuracy
line_ex (bool) – Electron excitation included
line_px (bool) – Proton excitation included
line_rr (bool) – Radiative recombination included
line_dr (bool) – Di-electronic recombination included
line_ds (bool) – Di-electronic satellites included
line_ii (bool) – Inner shell ionisation included
doppler (int) – Doppler broadening
newcalc (bool) – SPEXACT 3 calculations (False: SPEXACT 2)
occstart (int) – Occupation calculations
mekal_wav (bool) – Wavelength corrections according to the work of Phillips et al. (1999)
mekal_fe17 (bool) – The strongest Fe XVII lines by Doron & Behar (2002).
mekal_update (book) – Several minor corrections
ibalmaxw (bool) – Multi-Maxwellians for the ionisation balance
newcoolexc (bool) – Cooling by collisional excitation by Stofanova (SPEXACT 3)
newcooldr (bool) – Cooling by dielectronic recombination (SPEXACT 3)
- set_calc(status)[source]¶
Perform SPEXACT 3 line calculations.
- Parameters:
status (int) – Use SPEXACT 2 (0), Quick SPEXACT 3 (1), or SPEXACT 3 (1)
- set_cxcon(value)[source]¶
Set charge exchange recombination and ionization rates according to either 1 = Arnaud & Rothenflug (1985) or 2 = Kingdon & Ferland (1996). Default is 2.
- Parameters:
value (int) – Recombination and ionisation rateset. 1 = Arnaud & Rothenflug, 2 = Kingdon & Ferland.
- set_gacc(value)[source]¶
Set the free-bound emission accuracy.
- Parameters:
value (float) – Free-bound emission accuracy.
- set_ibalmaxw(status)[source]¶
Switch the Multi-Maxwellians for the ionisation balance on/off (True/False).
- Parameters:
status (bool) – On (True) or off (False)
- set_newcooldr(status)[source]¶
Cooling by dielectronic recombination (SPEXACT 3) on/off (True/False).
- Parameters:
status (bool) – On (True) or off (False)
- set_newcoolexc(status)[source]¶
Cooling by collisional excitation by Stofanova (SPEXACT 3) on/off (True/False).
- Parameters:
status (bool) – On (True) or off (False)