Commit 133d0941 authored by Médéric Boquien's avatar Médéric Boquien

Always store the distance of observed objects in m and not in Mpc.

parent 3846752c
......@@ -8,6 +8,7 @@
- Make sure we can plot the PDF of equivalent widths. (Médéric Boquien)
- Fix a crash when generating a mock catalogue containing intensive properties. (Médéric Boquien)
- In the `sfhdelayed` and `sfhdelayedbq` modules, provide the correct description for the sfr_A parameter (Médéric Boquien & Laure Ciesla)
- Internally the luminosity distance was erroneously stored in Mpc rather than in m for non-zero redshifts. This has now been standardised to m. (Médéric Boquien)
### Optimised
## 2018.0 (2018-11-06)
......
......@@ -49,8 +49,10 @@ def compute_corr_dz(model_z, obs):
"""
if model_z == 0.:
return (obs.distance / (10. * parsec)) ** 2. / (1. + obs.redshift)
return (obs.distance / cosmo.luminosity_distance(model_z).value) ** 2. * \
mod_distance = 10. * parsec
else:
mod_distance = cosmo.luminosity_distance(model_z).value * 1e6 * parsec
return (obs.distance / mod_distance) ** 2. * \
(1. + model_z) / (1. + obs.redshift)
......
......@@ -304,7 +304,8 @@ class Observation(object):
if self.redshift == 0.:
self.distance = 10. * parsec
elif self.redshift > 0.:
self.distance = cosmo.luminosity_distance(self.redshift).value
self.distance = cosmo.luminosity_distance(self.redshift).value \
* 1e6 * parsec
else:
self.distance = np.nan
self.flux = {k: row[k] for k in cls.bands
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment