Commit 3846752c authored by Médéric Boquien's avatar Médéric Boquien

Take into account the effect of the differential redshifting between the...

Take into account the effect of the differential redshifting between the observed and grid redshifts.
parent 5c317d72
......@@ -2,6 +2,7 @@
## Unreleased
### Added
- The (1+z1)/(1+z2) factor between observed and grid flux densities caused by the differential redshifting is now taken into account. With a default grid redshift rounding of two decimals this yields a difference of at most 0.5% in the estimated physical properties at z=0 and even less at higher z. (Médéric Boquien)
### Changed
### Fixed
- Make sure we can plot the PDF of equivalent widths. (Médéric Boquien)
......
......@@ -30,26 +30,28 @@ def save_chi2(obs, variable, models, chi2, values):
@lru_cache(maxsize=None)
def compute_corr_dz(model_z, obs_dist):
def compute_corr_dz(model_z, obs):
"""The mass-dependent physical properties are computed assuming the
redshift of the model. However because we round the observed redshifts to
two decimals, there can be a difference of 0.005 in redshift between the
models and the actual observation. At low redshift, this can cause a
models and the actual observation. This causes two issues. First there is a
difference in the luminosity distance. At low redshift, this can cause a
discrepancy in the mass-dependent physical properties: ~0.35 dex at z=0.010
vs 0.015 for instance. Therefore we correct these physical quantities by
multiplying them by corr_dz.
vs 0.015 for instance. In addition, the 1+z dimming will be different.
We compute here the correction factor for these two effects.
Parameters
----------
model_z: float
Redshift of the model.
obs_dist: float
Luminosity distance of the observed object.
obs: instance of the Observation class
Object containing the distance and redshift of an object
"""
if model_z == 0.:
return (obs_dist / (10. * parsec)) ** 2.
return (obs_dist / cosmo.luminosity_distance(model_z).value) ** 2.
return (obs.distance / (10. * parsec)) ** 2. / (1. + obs.redshift)
return (obs.distance / cosmo.luminosity_distance(model_z).value) ** 2. * \
(1. + model_z) / (1. + obs.redshift)
def dchi2_over_ds2(s, obsdata, obsdata_err, obslim, obslim_err, moddata,
......
......@@ -142,7 +142,7 @@ def analysis(idx, obs):
z = np.array(
gbl_models.conf['sed_modules_params']['redshifting']['redshift'])
wz = slice(np.abs(obs.redshift-z).argmin(), None, z.size)
corr_dz = compute_corr_dz(z[wz.start], obs.distance)
corr_dz = compute_corr_dz(z[wz.start], obs)
else: # We do not know the redshift so we use the full grid
wz = slice(0, None, 1)
corr_dz = 1.
......@@ -236,7 +236,7 @@ def bestfit(oidx, obs):
params = deepcopy(gbl_params.from_index(best_index))
if obs.redshift >= 0.:
params[gbl_params.modules.index('redshifting')]['redshift'] = obs.redshift
corr_dz = compute_corr_dz(obs.redshift, obs.distance)
corr_dz = compute_corr_dz(obs.redshift, obs)
else: # The model redshift is always exact in redhisfting mode
corr_dz = 1.
sed = gbl_warehouse.get_sed(gbl_params.modules, params)
......
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