diff --git a/CHANGELOG.md b/CHANGELOG.md index 1490f9b796c941931694adbcaeccc451ebf9f826..0cdd18442525d3a09485f4aee7309cb2c9ea71e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added - It is now possible to optionally indicate the distance in Mpc in the input file. If present it will be used in lieu of the distance computed from the redshift. This is especially useful in the nearby universe where the redshift is a very poor indicator of the actual distance. (Médéric Boquien) - It is now possible to fit any physical property indicated by the code (e.g. equivalent width, dust luminosity, etc.). For this the physical property needs to be given in the input file and the properties to be fitted must be given in the properties filed in pcigale.ini. (Héctor Salas & Médéric Boquien) +- It is now possible to fit emission lines. For this the line has to be indicated in the same way as any other band both in the input flux file (in units of W/m²) and in the list of bands in `pcigale.ini`. Lines are prefixed with `line.` followed by the name of the line, for instance `line.H-alpha` for Hɑ. The following lines are supported at the moment: `Ly-alpha`, `CII-133.5`, `SiIV-139.7`, `CIV-154.9`, `HeII-164.0`, `OIII-166.5`, `CIII-190.9`, `CII-232.6`, `MgII-279.8`, `OII-372.7`, `H-10`, `H-9`, `NeIII-386.9` `HeI-388.9`, `H-epsilon`, `SII-407.0`, `H-delta`, `H-gamma`, `H-beta`, `OIII-495.9`, `OIII-500.7`, `OI-630.0`, `NII-654.8`, `H-alpha`, `NII-658.4`, `SII-671.6`, `SII-673.1`. ### Changed - The `sfhdelayed` module has been extended to optionally include an exponential burst to model the latest episode of star formation. (Médéric Boquien & Barbara Lo Faro) diff --git a/pcigale/managers/models.py b/pcigale/managers/models.py index f71d16e0f5fb452df1d23799be3b400fe27a292a..c16c242114645df35c3ad955198194df35b55ab9 100644 --- a/pcigale/managers/models.py +++ b/pcigale/managers/models.py @@ -55,8 +55,12 @@ class ModelsManager(object): table = Table() table.add_column(Column(self.block, name='id')) for band in sorted(self.flux.keys()): + if band.startswith('line.'): + unit = 'W/m^2' + else: + unit = 'mJy' table.add_column(Column(self.flux[band], name=band, - unit='mJy')) + unit=unit)) for prop in sorted(self.extprop.keys()): table.add_column(Column(self.extprop[prop], name=prop)) for prop in sorted(self.intprop.keys()): diff --git a/pcigale/managers/results.py b/pcigale/managers/results.py index 666fffdb81232a879a244b2436f0d43595335790..6f79e606e85c491f9d5581167c03d32451d3fe4a 100644 --- a/pcigale/managers/results.py +++ b/pcigale/managers/results.py @@ -371,8 +371,12 @@ class ResultsManager(object): name="best."+prop)) for band in self.obs.bands: + if band.startswith('line.'): + unit = 'W/m^2' + else: + unit = 'mJy' table.add_column(Column(self.best.flux[band], - name="best."+band, unit='mJy')) + name="best."+band, unit=unit)) table.write("out/{}.txt".format(filename), format='ascii.fixed_width', diff --git a/pcigale/sed/__init__.py b/pcigale/sed/__init__.py index 74c9aa1c2baa39d433e4a612fbf453f19f28a686..f6c888b01c3a2b6a589973597c564dcf03285f4f 100644 --- a/pcigale/sed/__init__.py +++ b/pcigale/sed/__init__.py @@ -64,6 +64,7 @@ class SED(object): self.contribution_names = [] self.luminosity = None self.luminosities = None + self.lines = dict() self.info = dict() self.mass_proportional_info = set() @@ -286,6 +287,13 @@ class SED(object): key = (wavelength.size, filter_name, 0.) dist = 10. * parsec + if filter_name.startswith('line.'): + lum = 0 + for name in filter_name.split('+'): + line = self.lines[name.split('.', maxsplit=1)[1]] + lum += line[1] + line[2] # Young and old components + return utils.luminosity_to_flux(lum, dist) + if key in self.cache_filters: wavelength_r, transmission_r, lambda_piv = self.cache_filters[key] else: @@ -373,6 +381,7 @@ class SED(object): sed.luminosity = self.luminosity.copy() sed.luminosities = self.luminosities.copy() sed.contribution_names = self.contribution_names[:] + sed.lines = self.lines.copy() sed.info = self.info.copy() sed.mass_proportional_info = self.mass_proportional_info.copy() diff --git a/pcigale/session/configuration.py b/pcigale/session/configuration.py index 61cca1259b5c0cc229238b9ec76a31b3b9082e6d..bd2d7e8db89e76d0db6a2cd2670c13aeef94b354 100644 --- a/pcigale/session/configuration.py +++ b/pcigale/session/configuration.py @@ -69,11 +69,12 @@ class Configuration(object): "File containing the input data. The columns are 'id' (name of the" " object), 'redshift' (if 0 the distance is assumed to be 10 pc), " "'distance' (Mpc, optional, if present it will be used in lieu " - "of the distance computed from the redshift), the filter names for" - " the fluxes, and the filter names with the '_err' suffix for the " - "uncertainties. The fluxes and the uncertainties must be in mJy. " - "This file is optional to generate the configuration file, in " - "particular for the savefluxes module.") + "of the distance computed from the redshift), the filter names for " + "the fluxes, and the filter names with the '_err' suffix for the " + "uncertainties. The fluxes and the uncertainties must be in mJy " + "for broadband data and in W/m² for emission lines. This file is " + "optional to generate the configuration file, in particular for " + "the savefluxes module.") self.spec['data_file'] = "string()" self.config['parameters_file'] = ""