Commit 8b3bfe7e authored by Yannick Roehlly's avatar Yannick Roehlly

Homogenise metallicity and IMF notation

In Maraston 2005 module, use Z value for metallicity (instead of
log10[Z/H]) and homogenise IMF name with BC03 ones.
parent 6d1b31b4
......@@ -11,7 +11,8 @@ When a parameter is an array (like the filters for which the attenuation is
computed in the attenuation modules) the user must use the "eval ..."
notation. Try to find a better notation. Implement the generation for default
parameters. Maybe use tuples instead of arrays.
** TODO Homogenise the metallicity numbering. .
** DONE Homogenise the metallicity numbering. .
CLOSED: [2013-07-09 mar. 11:25]
Use the one for which the "solar" metallicity is 0.02.
** TODO Code the creation of mock catalogues.
** TODO Create some plot to check the fit quality:
......
......@@ -182,10 +182,10 @@ def build_m2005(base):
metallicity = spec_table[1, 0]
if 'krz' in spec_file:
imf = 'kr'
imf = 'krou'
mass_table = np.copy(kroupa_mass)
elif 'ssz' in spec_file:
imf = 'ss'
imf = 'salp'
mass_table = np.copy(salpeter_mass)
else:
raise ValueError('Unknown IMF!!!')
......@@ -212,7 +212,7 @@ def build_m2005(base):
lambda_grid = np.unique(spec_table[1])
# Creation of the age vs lambda flux table
tmpList = []
tmp_list = []
for wavelength in lambda_grid:
[age_grid_orig, lambda_grid_orig, flux_orig] = \
spec_table[:, spec_table[1, :] == wavelength]
......@@ -221,8 +221,14 @@ def build_m2005(base):
flux_regrid = interpolate.interp1d(age_grid_orig,
flux_orig)(age_grid)
tmpList.append(flux_regrid)
flux_age = np.array(tmpList)
tmp_list.append(flux_regrid)
flux_age = np.array(tmp_list)
# Use Z value for metallicity, not log([Z/H])
metallicity = {-1.35: 0.001,
-0.33: 0.01,
0.0: 0.02,
0.35: 0.04}[metallicity]
base.add_ssp_m2005(SspM2005(imf, metallicity, age_grid,
lambda_grid, mass_table, flux_age))
......
......@@ -37,16 +37,11 @@ class SspM2005(object):
Parameters
----------
imf : string
Initial mass function (IMF): either 'ss' for single Salpeter
(1955) or 'kr' for Kroupa (2001).
Initial mass function (IMF): either 'salp' for single Salpeter
(1955) or 'krou' for Kroupa (2001).
metallicity : float
The metallicity [Z/H] defined as the abundance of heavy elements
with respect to hydrogen, normalised to the solar values:
[Z/H] = Log10(Z/Zsun) - Log10(H/Hsun). The possible values are:
* +0.35 (corresponding to 2.0 Zsun)
* +0.00 (corresponding to 1.0 Zsun)
* -0.33 (corresponding to 0.5 Zsun)
* -1.35 (corresponding to 1/50 Zsun)
The metallicity. Possible values are 0.001, 0.01, 0.02 (solar
metallicity) and 0.04.
time_grid : array of floats
The time [Myr] grid used in the mass_table and the spec_table.
wavelength_grid : array of floats
......@@ -68,11 +63,11 @@ class SspM2005(object):
"""
if imf in ['ss', 'kr']:
if imf in ['salp', 'krou']:
self.imf = imf
else:
raise ValueError('IMF must be either ss for Salpeter or '
'kr for Krupa.')
raise ValueError('IMF must be either salp for Salpeter or '
'krou for Krupa.')
self.metallicity = metallicity
self.time_grid = time_grid
self.wavelength_grid = wavelength_grid
......
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