diff --git a/ares/populations/GalaxyCohort.py b/ares/populations/GalaxyCohort.py index 90d3722aa..11f21138f 100755 --- a/ares/populations/GalaxyCohort.py +++ b/ares/populations/GalaxyCohort.py @@ -1737,6 +1737,17 @@ def _ngtm_from_ham(self, z): return self._ngtm_from_ham_[z] + def get_AUV(self, z, MUV): + """ + Return extinction in rest-UV at redshift `z` for absolute magnitude(s) + `MUV`. + + .. note :: Just a wrapper around `self.dust.AUV`, which is using + empirical dust corrections. + + """ + return self.dust.AUV(z, MUV) + def run_abundance_match(self, z, Mh, uvlf=None, wave=1600.): """ These are the star-formation efficiencies derived from abundance @@ -1778,7 +1789,7 @@ def uvlf(z, mag): mags = [] for mag in mags_obs: - mags.append(mag-self.dust.AUV(z_ham, mag)) + mags.append(mag-self.get_AUV(z_ham, mag)) # Mass function if self.pf['pop_histories'] is not None: diff --git a/ares/populations/GalaxyEnsemble.py b/ares/populations/GalaxyEnsemble.py index f82890f6d..d1d29a75c 100755 --- a/ares/populations/GalaxyEnsemble.py +++ b/ares/populations/GalaxyEnsemble.py @@ -953,6 +953,9 @@ def deposit_in(self, tnow, delay): return inow + ifut + def get_fstar(self, z, Mh): + return self.guide.get_fstar(z=z, Mh=Mh) + def _gen_prescribed_galaxy_histories(self, zstop=0): """ Take halo histories and paint on galaxy histories in deterministic way. @@ -1029,7 +1032,7 @@ def _gen_prescribed_galaxy_histories(self, zstop=0): SFR = halos['SFR'][:,-1::-1] else: iz = np.argmin(np.abs(6. - z)) - SFR = self.guide.SFE(z=z2d, Mh=Mh) + SFR = self.guide.get_fstar(z=z2d, Mh=Mh) np.multiply(SFR, MAR, out=SFR) SFR *= fb @@ -3244,6 +3247,7 @@ def get_AUV(self, z, Mwave=1600., cam=None, MUV=None, Mstell=None, AUV = AUV_r assert MUV is None + MAB = None # May specify a single magnitude at which to return AUV if MUV is not None: @@ -3258,7 +3262,7 @@ def get_AUV(self, z, Mwave=1600., cam=None, MUV=None, Mstell=None, return np.interp(np.log10(Mstell), x1, y1, left=0., right=0.) # Otherwise, return raw (or binned) results - return AUV + return MAB, AUV def get_dBeta_dMUV(self, z, magbins, presets=None, model='exp', return_funcs=False, maglim=None, dlam=20., magmethod='gmean', diff --git a/tests/test_populations_ensemble.py b/tests/test_populations_ensemble.py index 729ef26ce..45565056f 100644 --- a/tests/test_populations_ensemble.py +++ b/tests/test_populations_ensemble.py @@ -80,12 +80,12 @@ def test(): assert 1e4 <= np.mean(Md) <= 1e10, "Dust masses unreasonable!" # Test extinction - AUV = pop.get_AUV(6., magbins=mags_cr, return_binned=False) + x, AUV = pop.get_AUV(6., magbins=mags_cr, return_binned=False) assert np.all(AUV >= 0), "AUV < 0! AUV={}".format(AUV) assert 0 < np.mean(AUV) <= 3, "AUV unreasonable!" - AUV2 = pop.get_AUV(6., magbins=mags_cr, return_binned=True) + x2, AUV2 = pop.get_AUV(6., magbins=mags_cr, return_binned=True) assert AUV2.size == mags_cr.size AUV20 = AUV2[np.argmin(np.abs(mags_cr + 20))] AUV16 = AUV2[np.argmin(np.abs(mags_cr + 16))]