Skip to content

Commit 165c76d

Browse files
committed
slight generalization so pop_scatter_mar works even if pop_sfr is supplied
1 parent 3118cd7 commit 165c76d

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ares/populations/GalaxyEnsemble.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1101,10 +1101,16 @@ def _gen_prescribed_galaxy_histories(self, zstop=0):
11011101
if 'SFR' in halos:
11021102
SFR = halos['SFR'][:,-1::-1]
11031103
else:
1104-
iz = np.argmin(np.abs(6. - z))
1105-
SFR = self.guide.get_fstar(z=z2d, Mh=Mh)
1106-
np.multiply(SFR, MAR, out=SFR)
1107-
SFR *= fb
1104+
if self.pf['pop_sfr'] is not None:
1105+
SFR = np.ones_like(MAR) * self.pf['pop_sfr']
1106+
sigma_mar = self.pf['pop_scatter_mar']
1107+
np.random.seed(self.pf['pop_scatter_mar_seed'])
1108+
noise = self.get_noise_lognormal(SFR, sigma_mar)
1109+
SFR += noise
1110+
else:
1111+
SFR = self.guide.get_fstar(z=z2d, Mh=Mh)
1112+
np.multiply(SFR, MAR, out=SFR)
1113+
SFR *= fb
11081114

11091115
##
11101116
# Duty cycle effects

ares/util/SetDefaultParameterValues.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ def PopulationParameters():
515515

516516
"pop_target_volume": None,
517517
"pop_target_redshift": None,
518+
"pop_target_density": 0.,
518519
"pop_target_seed": None,
519520

520521
"pop_tunnel": None,
@@ -655,8 +656,6 @@ def PopulationParameters():
655656
"pop_fstar_max": 1.0,
656657
"pop_fstar_negligible": 1e-5, # relative to maximum
657658

658-
"pop_sfr": None,
659-
660659
"pop_facc": 0.0,
661660
"pop_fsmooth": 1.0,
662661

input/litdata/harikane2022.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
'alpha': [],
3535
}
3636

37-
# Table 5
37+
# Table 5: reminder, errors stored in (+/-) order, will be flipped in internal
38+
# analysis routines to satisfy matplotlib's errorbar.
3839
tmp_data = {}
3940
tmp_data['lf'] = \
4041
{

0 commit comments

Comments
 (0)