# 3.1.8. Distance: set the source distance¶

## 3.1.8.1. Overview¶

One of the main principles of SPEX is that spectral models are in principle calculated at the location of the X-ray source. Once the spectrum has been evaluated, the flux received at Earth can be calculated. In order to do that, the distance of the source must be set.

SPEX allows for the simultaneous analysis of multiple sky sectors. In each sector, a different spectral model might be set up, including a different distance. For example, a foreground object that coincides partially with the primary X-ray source has a different distance value.

The user can specify the distance in a number of different units. Allowed distance units are shown in the table below.

Abbrevation |
Unit |
---|---|

spex |
internal SPEX units of m (this is the default) |

m |
meter |

au |
Astronomical Unit, 1.49597892 m |

ly |
lightyear, 9.46073047 m |

pc |
parsec, 3.085678 m |

kpc |
kpc, kiloparsec, 3.085678 m |

mpc |
Mpc, Megaparsec, 3.085678 m |

z |
redshift units for the given cosmological parameters |

cz |
recession velocity in km/s for the given cosmological parameters |

The default unit of m is internally used in all calculations in SPEX. The reason is that with this scaling all calculations ranging from solar flares to clusters of galaxies can be done with single precision arithmetic, without causing underflow or overflow. For the last two units (z and cz), it is necessary to specify a cosmological model. Currently this model is simply described by , (matter density), (cosmological constant related density), and (radiation density). At startup, the values are:

: 70 km/s/Mpc ,

: 0.3 ,

: 0.7 ,

: 0.0

i.e. a flat model with cosmological constant. However, the user can specify other values of the cosmological parameters. Note that the distance is in this case the luminosity distance.

Note that the previous defaults for SPEX (, ) can be obtained by putting H, , and .

Warning

When H or any of the is changed, the luminosity distance will not change, but the equivalent redshift of the source is adjusted. For example, setting the distance first to z=1 with the default =70 km/s/Mpc results into a distance of m. When is then changed to 100 km/s/Mpc, the distance is still m, but the redshift is adjusted to 1.3342.

Warning

In the output also the light travel time is given. This should not be confused with the (luminosity) distance in light years, which is simply calculated from the luminosity distance in m!

## 3.1.8.2. Syntax¶

The following syntax rules apply to setting the distance:

`distance [sector #i:] #r [#a]`

: set the distance to the value #r
in the unit #a. This optional distance unit may be omittted. In that
case it is assumed that the distance unit is the default SPEX unit of
m. The distance is set for the sky sector range #i:.
When the optional sector range is omitted, the distance is set for all
sectors.`distance show`

: displays the distance in various units for all
sectors.`distance h0 #r`

: sets the Hubble constant to the
value #r.`distance om #r`

: sets the parameter to the value
#r.`distance ol #r`

: sets the parameter to the
value #r.`distance or #r`

: sets the parameter to the value
#r.## 3.1.8.3. Examples¶

`distance 2`

: sets the distance to 2 default units, i.e. to 2E22 m.`distance 12.0 pc`

: sets the distance for all sectors to 12 pc.`distance sector 3 0.03 z`

: sets the distance for sector 3 to a
redshift of 0.03.`distance sector 2 : 4 50 ly`

: sets the distance for sectors 2-4 to
50 lightyear.`distance h0 50.`

: sets the Hubble constant to 50 km/s/Mpc.`distance om 0.27`

: sets the matter density parameter
to 0.27`distance show`

: displays the distances for all sectors, see the
example below for the output format.```
SPEX> di 100 mpc
Distances assuming H0 = 70.0 km/s/Mpc, Omega_m = 0.300 Omega_Lambda = 0.700 Omega_r = 0.000
Sector m A.U. ly pc kpc Mpc redshift cz age(yr)
----------------------------------------------------------------------------------------------
1 3.086E+24 2.063E+13 3.262E+08 1.000E+08 1.000E+05 100.0000 0.0229 6878.7 3.152E+08
----------------------------------------------------------------------------------------------
```