Commit 7f3456f8 authored by Yannick Roehlly's avatar Yannick Roehlly
Browse files

Use a set for mass_proportional_info

Using a list to keep the information keys that are proportional to the
mass leads to problems when forcing the update of a proportional
information: the key name appears then twice (or more) in the list and
the information is multiplied twice (or more) by the mass.
parent 2f9d9be7
......@@ -25,7 +25,7 @@ Such SED is characterised by:
- info: a dictionary containing various information about the SED.
- mass_proportional_info: the list of keys in the info dictionary whose value
- mass_proportional_info: the set of keys in the info dictionary whose value
is proportional to the galaxy mass.
......@@ -65,7 +65,7 @@ class SED(object):
self.luminosity = None
self.luminosities = None = OrderedDict()
self.mass_proportional_info = []
self.mass_proportional_info = set()
def sfh(self):
......@@ -134,7 +134,7 @@ class SED(object):
if (key not in or force:[key] = value
if mass_proportional:
raise KeyError("The information %s is already present "
"in the SED. " % key)
......@@ -353,6 +353,6 @@ class SED(object):
sed.luminosities = None
sed.contribution_names = self.contribution_names[:] =
sed.mass_proportional_info = self.mass_proportional_info[:]
sed.mass_proportional_info = self.mass_proportional_info.copy()
return sed
Supports Markdown
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