Commit d44a99c7 authored by Médéric Boquien's avatar Médéric Boquien

Compute the best fit at the at the exact distance of the analysed object and...

Compute the best fit at the at the exact distance of the analysed object and not at the distance of the rounded redshift. This eliminates the need for a correction factor.
parent fb870383
......@@ -17,6 +17,7 @@
- Corrected a typo that prevented `restframe\_parameters` from being listed among the available modules. (Médéric Boquien)
- The filters in the residual plot of `pcigale-plots sed` are now drawn in order of increasing wavelength so that the line joining all the filters does not make loops. (Médéric Boquien)
- In the absence of a nebular component `restframe\_parameters` would crash when attempting to compute the equivalent widths of the lines listed in `EW_lines`. Now they are simply ignored. (Médéric Boquien)
- The luminosity spectrum of the best fit was saved assuming the distance corresponding to the redshift rounded to two decimals. This was an issue in particular at very low redshift as a difference of 0.005 in redshift can translate to a large difference on the luminosity distance. Now the exact luminosity distance of the object is used to compute the spectrum luminosity. (Médéric Boquien, reported by Jorge Melnick)
### Optimised
- The cache architecture has been simplified, making it somewhat faster. It speeds up the model generation by ~1%. (Médéric Boquien)
......
......@@ -6,6 +6,7 @@
# Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt
# Author: Yannick Roehlly, Médéric Boquien & Denis Burgarella
from copy import deepcopy
import time
import numpy as np
......@@ -236,8 +237,12 @@ def bestfit(oidx, obs):
gbl_warehouse.partial_clear_cache(
gbl_params.index_module_changed(gbl_previous_idx, best_index))
gbl_previous_idx = best_index
sed = gbl_warehouse.get_sed(gbl_params.modules,
gbl_params.from_index(best_index))
# We compute the model at the exact redshift not to have to correct for the
# difference between the object and the grid redshifts.
params = deepcopy(gbl_params.from_index(best_index))
params[-1]['redshift'] = obs['redshift']
sed = gbl_warehouse.get_sed(gbl_params.modules, params)
fluxes = np.array([sed.compute_fnu(filt) for filt in gbl_obs.bands])
obs_fluxes = np.array([obs[name] for name in gbl_obs.bands])
......@@ -249,8 +254,7 @@ def bestfit(oidx, obs):
gbl_results.best.propertiesnames]
iprop = [i for i, k in enumerate(gbl_results.best.propertiesnames)
if k in gbl_results.best.massproportional]
corr_dz = compute_corr_dz(sed.info['universe.redshift'], obs['redshift'])
gbl_results.best.properties[oidx, iprop] *= scaling * corr_dz
gbl_results.best.properties[oidx, iprop] *= scaling
gbl_results.best.fluxes[oidx, :] = fluxes * scaling
if gbl_conf['analysis_params']["save_best_sed"]:
......
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