While reviewing likelihood.py, I noticed these lines in the get_convolved_Px_AA function, near these lines.
# loop through the large-theta bins from the data
Px_ZAM_allz = []
for Px_Zam_zindex, iiz in enumerate(iz):
Px_ZAM_all = []
for itheta_A in theta_A:
# get the small-theta indices in this coarse-theta bin
ind_in_theta = self.data.B_A_a.astype(bool)[itheta_A,:] # generally this could be different with redshift; assume it's not for now
theta_a_inds = np.where(ind_in_theta)[0]
k_AA_binned = (self.data.k_M_edges[iiz][:-1] + self.data.k_M_edges[iiz][1:]) / 2.
Px_ZaM_all = np.zeros((len(theta_a_inds), len(k_AA_binned)))
V_ZaM_all = np.zeros((len(theta_a_inds), len(k_AA_binned)))
for save_index, a in enumerate(theta_a_inds):
# retrieve the window matrix for this small-theta bin
if self.data.U_ZaMn is not None:
U_ZaMn = self.data.U_ZaMn[iiz,a]
# check later if the window convolution can also be vectorized
Px_ZaM = convolve_window(U_ZaMn,Px_Zam[Px_Zam_zindex,a].T)
Px_ZaM_all[save_index,:] = Px_ZaM
V_ZaM = self.data.V_ZaM[iiz,a]
V_ZaM_all[save_index,:] = V_ZaM
# rebin in theta
Px_ZAM = rebin_theta(V_ZaM_all, Px_ZaM_all)
Px_ZAM_all.append(Px_ZAM)
Px_ZAM_allz.append(np.asarray(Px_ZAM_all))
if squeeze_result:
return np.squeeze(np.asarray(Px_ZAM_allz))
else:
return np.asarray(Px_ZAM_allz)
Most of it makes sense, I believe, but I'm not sure why you define Px_Zam_zindex and iiz with enumerate, if iz here is always a single integer? Although then I see that you are actually collecting Px_ZAM_allz as if you could have more than one integer in iz? Is this left-over code from previous versions?
I believe having k_M_edges and other binning settings be the same for all redshifts might simplify the code here,
While reviewing likelihood.py, I noticed these lines in the get_convolved_Px_AA function, near these lines.
Most of it makes sense, I believe, but I'm not sure why you define
Px_Zam_zindexandiizwith enumerate, ifizhere is always a single integer? Although then I see that you are actually collectingPx_ZAM_allzas if you could have more than one integer iniz? Is this left-over code from previous versions?I believe having k_M_edges and other binning settings be the same for all redshifts might simplify the code here,