Commit 421fb3bf authored by Médéric Boquien's avatar Médéric Boquien

Make redshifting rounding an option in pdf_analysis.

parent 8df2e55e
......@@ -3,6 +3,7 @@
## Unreleased
### Added
- Provide the possibility not to store a given module in cache. This can be useful on computers with a limited amount of memory. The downside is that when not caching the model generation will be slower. (Médéric Boquien)
- An option `redshift\_decimals` is now provided in `pdf\_analysis` to indicate the number of decimals to round the observed redshifts to compute the grid of models. By default the model redshifts are rounded to two decimals but this can be insufficient at low z and/or when using narrow-band filters for instance. This only applies to the grid. The physical properties are still computed for the redshift at full precision. (Médéric Boquien)
### Changed
- Make the timestamp more readable when moving the out/ directory. (Médéric Boquien)
......
......@@ -87,6 +87,14 @@ class PdfAnalysis(AnalysisModule):
"If true, for each object we create a mock object "
"and analyse them.",
False
)),
("redshift_decimals", (
"integer()",
"When redshifts are not given explicitly in the redshifting "
"module, number of decimals to round the observed redshifts to "
"compute the grid of models. To disable rounding give a negative "
"value. Do not round if you use narrow-band filters.",
2
))
])
......
......@@ -23,10 +23,6 @@ from ..warehouse import SedWarehouse
from . import validation
# Limit the redshift to this number of decimals
REDSHIFT_DECIMALS = 2
class Configuration(object):
"""This class manages the configuration of pcigale.
"""
......@@ -300,8 +296,15 @@ class Configuration(object):
if type(z_mod) is str and not z_mod:
if self.config['data_file']:
obs_table = read_table(self.config['data_file'])
z = list(np.unique(np.around(obs_table['redshift'],
decimals=REDSHIFT_DECIMALS)))
if 'redshift_decimals' in self.config['analysis_params']:
decimals = self.config['analysis_params']['redshift_decimals']
if decimals < 0:
z = list(np.unique(obs_table['redshift']))
else:
z = list(np.unique(np.around(obs_table['redshift'],
decimals=decimals)))
else:
z = list(np.unique(obs_table['redshift']))
self.config['sed_modules_params']['redshifting']['redshift'] = z
elif self.config['parameters_file']:
# The entry will be ignored anyway. Just pass a dummy list
......
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