Skip to content

Commit

Permalink
redden luminosity of progenitor halos by dust column associated with …
Browse files Browse the repository at this point in the history
…descendant
  • Loading branch information
mirochaj committed Apr 1, 2021
1 parent 0abc220 commit c4dbc1e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
2 changes: 0 additions & 2 deletions ares/populations/GalaxyEnsemble.py
Expand Up @@ -1232,10 +1232,8 @@ def _gen_prescribed_galaxy_histories(self, zstop=0):
Rd = self.guide.dust_scale(z=z2d, Mh=Mh)
Sd = np.divide(Md, np.power(Rd, 2.)) \
/ 4. / np.pi
#Sd = Md / 4. / np.pi / self.guide.dust_scale(z=z2d, Mh=Mh)**2

iz = np.argmin(np.abs(6. - z))
#print("Set Sd", Rd[:,iz].mask.sum(), Sd[:,iz].mask.sum())

# Can add scatter to surface density
if self.pf['pop_dust_scatter'] is not None:
Expand Down
39 changes: 18 additions & 21 deletions ares/static/SpectralSynthesis.py
Expand Up @@ -919,7 +919,8 @@ def _cache_lum(self, kwds):
else:
return kwds, None

def Luminosity(self, wave=1600., sfh=None, tarr=None, zarr=None, window=1,
def Luminosity(self, wave=1600., sfh=None, tarr=None, zarr=None,
window=1,
zobs=None, tobs=None, band=None, idnum=None, hist={}, extras={},
load=True, use_cache=True, energy_units=True):
"""
Expand Down Expand Up @@ -1294,6 +1295,7 @@ def Luminosity(self, wave=1600., sfh=None, tarr=None, zarr=None, window=1,
if not do_all_time:
break


##
# Redden spectra
##
Expand Down Expand Up @@ -1388,34 +1390,29 @@ def Luminosity(self, wave=1600., sfh=None, tarr=None, zarr=None, window=1,
# Loop over all 'branches'
for i in range(sfh.shape[0]):

# This means the i'th halo is alive and well at the
# final redshift, i.e., it's a central
# This means the i'th halo is alive and well at
# the final redshift, i.e., it's a central
if is_central[i]:
continue

pb.update(i)

# At this point, need to figure out which child halos
# to dump mass and SFH into...

# Be careful with redshift array.
# We're now working in ascending time, reverse redshift,
# so we need to correct the child iz values. We've also
# chopped off elements at z < zobs.
#iz = Nz0 - child_iz[i]
# At this point, need to figure out which child
# halos to dump mass and SFH into...

# This `iz` should not be negative despite us having
# chopped up the redshift array since getting to this
# point in the loop is predicated on being a parent of
# another halo, i.e., not surviving beyond this redshift.
# Lout is just 1-D at this point, i.e., just
# luminosity *now*.

# Lout is just 1-D at this point, i.e., just luminosity
# *now*.
# Add luminosity to child halo. Zero out
# luminosity of parent to avoid double
# counting. Note that nh will
# also have been zeroed out but it's good to
# zero-out both.
# NOTE: should use dust reddening of
# descendant, hence use of Lhist again
T = np.exp(-tau[child_iM[i],izobs])

# Add luminosity to child halo. Zero out luminosity of
# parent to avoid double counting. Note that nh will
# also have been zeroed out but we're just being careful.
Lout[child_iM[i]] += 1 * Lout[i]
Lout[child_iM[i]] += Lhist[i] * T
Lout[i] = 0.0

pb.finish()
Expand Down
3 changes: 2 additions & 1 deletion ares/util/Survey.py
Expand Up @@ -140,7 +140,8 @@ def read_throughputs(self, filter_set='W', filters=None):
Example
-------
>>> wave, T, mid, wid, Tavg
>>> wave, T, mid, wid, Tavg = self.read_throughputs()
"""
Expand Down

0 comments on commit c4dbc1e

Please sign in to comment.