Skip to content

Commit

Permalink
bandaid: turn off _cache_lum in SpectralSynthesis, seems to be not wo…
Browse files Browse the repository at this point in the history
…rking as intended in all cases.
  • Loading branch information
mirochaj committed Oct 10, 2022
1 parent d958db2 commit 92c37ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ares/populations/GalaxyEnsemble.py
Expand Up @@ -1979,6 +1979,8 @@ def _cache_L(self, key):
if not hasattr(self, '_cache_L_'):
self._cache_L_ = {}


print('hey', key in self._cache_L_, key, self._cache_L_.keys())
if key in self._cache_L_:
return self._cache_L_[key]

Expand Down Expand Up @@ -2500,10 +2502,10 @@ def get_lum(self, z, wave=1600., band=None, idnum=None, window=1,
raw = self.histories
if (wave is not None) and (wave > self.src.wavelengths.max()):
L = self.dust.Luminosity(z=z, wave=wave, band=band, idnum=idnum,
window=window, load=load, energy_units=energy_units)
window=window, load=0, energy_units=energy_units)
else:
L = self.synth.get_lum(wave=wave, zobs=z, hist=raw,
extras=self.extras, idnum=idnum, window=window, load=load,
extras=self.extras, idnum=idnum, window=window, load=0,
band=band, energy_units=energy_units)

self._cache_L_[(z, wave, band, idnum, window, energy_units)] = L.copy()
Expand Down
5 changes: 4 additions & 1 deletion ares/static/SpectralSynthesis.py
Expand Up @@ -855,6 +855,9 @@ def _cache_lum(self, kwds):
if not hasattr(self, '_cache_lum_'):
self._cache_lum_ = {}

return kwds, None
#raise NotImplementedError("Something not working here...")

notok = -1

t1 = time.time()
Expand Down Expand Up @@ -963,7 +966,7 @@ def Luminosity(self, **kwargs):
def get_lum(self, wave=1600., sfh=None, tarr=None, zarr=None,
window=1,
zobs=None, tobs=None, band=None, idnum=None, hist={}, extras={},
load=True, energy_units=True):
load=False, energy_units=True):
"""
Synthesize luminosity of galaxy with given star formation history at a
given wavelength and time.
Expand Down

0 comments on commit 92c37ac

Please sign in to comment.