Commit 14b34462 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

We rely on OrderedDict to keep the order of the parameters. However given the...

We rely on OrderedDict to keep the order of the parameters. However given the way the code is structured currently, there is really no reason for this. So let's just switch to the standard dictionary. This has two advantages. First the standard dictionary is much faster than OrderedDict (implemented in C rather than in pure python). Then, standard dictionaries are marshalable, which makes them usable as keys for other dictionaries.
parent f84db63e
......@@ -19,7 +19,6 @@ This module implements the radio emission of galaxies, taking into account only
import numpy as np
import scipy.constants as cst
from collections import OrderedDict
from . import CreationModule
......@@ -32,7 +31,7 @@ class Radio(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("qir", (
"float",
"The value of the FIR/radio correlation coefficient.",
......@@ -45,7 +44,7 @@ class Radio(CreationModule):
))
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("qir", "The value of the FIR/radio correlation coefficient."),
("alpha", "The slope of the power-law synchrotron emission.")
])
......
......@@ -18,8 +18,6 @@ is changed, this module may need to be adapted.
"""
from collections import OrderedDict
import numpy as np
from scipy.constants import parsec
from scipy.misc import factorial
......@@ -143,7 +141,7 @@ class Redshifting(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("redshift", (
"float",
"Redshift to apply to the galaxy. Leave empty to use the redshifts"
......
......@@ -13,7 +13,6 @@ decreasing exponentials.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
......@@ -29,7 +28,7 @@ class Sfh2Exp(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("tau_main", (
"float",
"e-folding time of the main stellar population model in Myr.",
......@@ -68,7 +67,7 @@ class Sfh2Exp(CreationModule):
)),
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("tau_main", "e-folding time of the main stellar population model "
"in Myr."),
("tau_burst", "e-folding time of the late starburst population model "
......
......@@ -22,7 +22,6 @@ and interpolate the values of a, b and c.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
......@@ -39,7 +38,7 @@ class SfhBuat08(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("velocity", (
"float",
"Rotational velocity of the galaxy in km/s. Must be between 80 "
......@@ -59,7 +58,7 @@ class SfhBuat08(CreationModule):
))
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("sfh.velocity", "Rotational velocity of the galaxy in km/s."),
("galaxy_mass", "Mass of the galaxy in solar mass.")
])
......
......@@ -15,7 +15,6 @@ constant.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
......@@ -30,7 +29,7 @@ class SfhQuench(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("quenching_age", (
"integer",
"Age of the galaxy at which the quenching happens in Myr.",
......@@ -51,7 +50,7 @@ class SfhQuench(CreationModule):
))
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("sfh.quenching_age", "Age of the galaxt when the quenching occurs "
"in Myr."),
("sfh.quenching_factor", "Quenching factor applied.")
......
......@@ -13,7 +13,6 @@ regularly-spaced short constant SF events.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
......@@ -29,7 +28,7 @@ class SfhComb(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("N_events", (
"integer",
"Number of individual star formation events. ",
......@@ -66,7 +65,7 @@ class SfhComb(CreationModule):
)),
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("N_events", "Number of individual star formation events"),
("t_duration", "Length of each individual star formation event "
"in Myr."),
......
......@@ -13,7 +13,6 @@ regularly-spaced short regularly-spaced delayed-SFH SF events.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
......@@ -29,7 +28,7 @@ class SfhComb(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("N_events", (
"integer",
"Number of individual star formation events. ",
......@@ -65,7 +64,7 @@ class SfhComb(CreationModule):
)),
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("N_events", "Number of individual star formation events"),
("tau_events", "e-folding time of all short events in Myr.."),
("age", "Age of the stellar population in the galaxy in Myr."),
......
......@@ -14,7 +14,6 @@ rise of the SFR up to a maximum, followed by an exponential decrease.
"""
import numpy as np
from collections import OrderedDict
from . import CreationModule
# Time lapse used in the age grid in Myr. If should be consistent with the
......@@ -30,7 +29,7 @@ class SFHDelayed(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("tau_main", (
"float",
"e-folding time of the main stellar population model in Myr.",
......@@ -54,7 +53,7 @@ class SFHDelayed(CreationModule):
))
])
out_parameter_list = OrderedDict([
out_parameter_list = dict([
("tau_main", "e-folding time of the main stellar population model "
"in Myr."),
("age", "Age of the oldest stars in the galaxy in Myr."),
......
......@@ -13,7 +13,6 @@ This module reads the star formation history in a file.
from astropy.table import Table
import numpy as np
from collections import OrderedDict
from ..utils import read_table
from . import CreationModule
......@@ -29,7 +28,7 @@ class SfhFromFile(CreationModule):
"""
parameter_list = OrderedDict([
parameter_list = dict([
("filename", (
"str",
"Name of the file containing the SFH. The first column must be "
......
......@@ -263,7 +263,7 @@ class Configuration(object):
# Parsing the SED modules parameters
configuration['creation_modules_params'] = []
for module in self.config['creation_modules']:
module_params = collections.OrderedDict()
module_params = {}
for key, value in \
self.config['sed_creation_modules'][module].items():
module_params[key] = evaluate_description(value)
......
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