Commit 0b4f5376 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Correct the scaling of the best-fit to account to the difference between the...

Correct the scaling of the best-fit to account to the difference between the grid and the observed redshifts/distances.
parent 133d0941
......@@ -9,6 +9,7 @@
- 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)
- As the best-fit properties are computed at the exact observed redshift, correct the scaling factor as it is computed at the grid redshift. This corrects for slight offsets on the best-fit properties when the input redshift has more decimals than the grid redshift. (Médéric Boquien)
### Optimised
## 2018.0 (2018-11-06)
......@@ -235,16 +235,32 @@ def bestfit(oidx, obs):
# difference between the object and the grid redshifts.
params = deepcopy(gbl_params.from_index(best_index))
if obs.redshift >= 0.:
model_z = params[gbl_params.modules.index('redshifting')]['redshift']
params[gbl_params.modules.index('redshifting')]['redshift'] = obs.redshift
corr_dz = compute_corr_dz(obs.redshift, obs)
# Correct fluxes for the fact that the scaling factor was computed on
# the grid redshift. Because of the difference in redshift the distance
# is different and must be reflected in the scaling
corr_scaling = compute_corr_dz(model_z, obs) / \
compute_corr_dz(obs.redshift, obs)
else: # The model redshift is always exact in redhisfting mode
corr_dz = 1.
corr_scaling = 1.
sed = gbl_warehouse.get_sed(gbl_params.modules, params)
scaling =[oidx]
# Handle the case where the distance does not correspond to the redshift.
if obs.redshift >= 0.:
corr_dz = (obs.distance /['universe.luminosity_distance']) ** 2
corr_dz = 1.
scaling =[oidx] * corr_scaling
for band in[band][oidx] = sed.compute_fnu(band) * scaling
# If the distance is user defined, the redshift-based luminosity distance
# of the model is probably incorrect so we replace it
sed.add_info('universe.luminosity_distance', obs.distance, force=True)
for prop in[prop][oidx] =[prop]
Supports Markdown
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