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

For the cache to be efficient it needs to be shared between all instances of...

For the cache to be efficient it needs to be shared between all instances of the class. As the computation is done in separate processes, we do not need to worry about race conditions, the cache will only ever be accessed by a single instance at any given time.
parent 2b237fff
......@@ -48,6 +48,10 @@ class SED(object):
"""Spectral Energy Distribution with associated information
"""
# We declare the filters cache here as to be efficient it needs to be
# shared between different objects.
cache_filters = {}
def __init__(self, sfh=None):
"""Create a new SED
......@@ -67,7 +71,6 @@ class SED(object):
self.luminosities = None
self.info = OrderedDict()
self.mass_proportional_info = set()
self.cache_filters = {}
@property
def sfh(self):
......@@ -350,6 +353,5 @@ class SED(object):
sed.contribution_names = self.contribution_names[:]
sed.info = self.info.copy()
sed.mass_proportional_info = self.mass_proportional_info.copy()
sed.cache_filters = self.cache_filters
return sed
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