Skip to content

Commit

Permalink
Merge pull request #334 from wangbingjie/main
Browse files Browse the repository at this point in the history
fix data file names for the theoretical mass functions used in p-beta
  • Loading branch information
bd-j authored May 21, 2024
2 parents b3e5ae6 + 173051a commit 9031e1b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions prospect/models/priors_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ def __init__(self, parnames=[], name='', **kwargs):
self.update(**kwargs)

if self.params['const_phi']:
zreds, pdf_zred = np.loadtxt(os.path.join(prior_data_dir, 'pdf_of_z_l20.txt'), unpack=True)
zreds, pdf_zred = np.loadtxt(file_pdf_of_z_l20, unpack=True)
else:
zreds, pdf_zred = np.loadtxt(os.path.join(prior_data_dir, 'pdf_of_z.txt'), unpack=True)
zreds, pdf_zred = np.loadtxt(file_pdf_of_z_l20t18, unpack=True)

self.finterp_z_pdf, self.finterp_cdf_z = norm_pz(self.params['zred_mini'], self.params['zred_maxi'], zreds, pdf_zred)
self.mgrid = np.linspace(self.params['mass_mini'], self.params['mass_maxi'], 101)
Expand Down Expand Up @@ -768,9 +768,9 @@ def __init__(self, parnames=[], name='', **kwargs):
self.update(**kwargs)

if self.params['const_phi']:
zreds, pdf_zred = np.loadtxt(os.path.join(prior_data_dir, 'pdf_of_z_l20.txt'), unpack=True)
zreds, pdf_zred = np.loadtxt(file_pdf_of_z_l20, unpack=True)
else:
zreds, pdf_zred = np.loadtxt(os.path.join(prior_data_dir, 'pdf_of_z.txt'), unpack=True)
zreds, pdf_zred = np.loadtxt(file_pdf_of_z_l20t18, unpack=True)

self.finterp_z_pdf, self.finterp_cdf_z = norm_pz(self.params['zred_mini'], self.params['zred_maxi'], zreds, pdf_zred)

Expand Down Expand Up @@ -1160,9 +1160,9 @@ def __init__(self, parnames=[], name='', **kwargs):
# the tables were calculated in pdf_z_tables.ipynb
# redshift range is 0 - 20
if self.params['const_phi']:
zreds, pdf_zred = np.loadtxt(os.path.join(prior_data_dir, 'pdf_of_z_l20.txt'), unpack=True)
zreds, pdf_zred = np.loadtxt(file_pdf_of_z_l20, unpack=True)
else:
zreds, pdf_zred = np.loadtxt(os.path.join(prior_data_dir, 'pdf_of_z.txt'), unpack=True)
zreds, pdf_zred = np.loadtxt(file_pdf_of_z_l20t18, unpack=True)

self.finterp_z_pdf, self.finterp_cdf_z = norm_pz(self.params['zred_mini'], self.params['zred_maxi'], zreds, pdf_zred)

Expand Down Expand Up @@ -1514,8 +1514,9 @@ def mass_func_at_z(z, this_logm, const_phi=False, bounds=[6.0, 12.5]):
else:
phi = high_z_mass_func(z0=12, this_m=10**this_logm)

phi[this_logm < bounds[0]] = 0
phi[this_logm > bounds[1]] = 0
if hasattr(this_logm, "__len__"):
phi[this_logm < bounds[0]] = 0
phi[this_logm > bounds[1]] = 0
return np.squeeze(phi)


Expand Down

0 comments on commit 9031e1b

Please sign in to comment.