Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
titodalcanton committed Dec 18, 2024
1 parent acf87e7 commit 1892c60
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pycbc/distributions/sky_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def pixel_corners(self, indices):
[self.healpix_map.boundaries(pi, step=1) for pi in indices]
)

def normalize_azimuth(phi):
def normalize_azimuth(self, phi):
"""Helper function to ensure the azimuthal coordinate stays within
[0,2π).
"""
Expand Down Expand Up @@ -269,7 +269,7 @@ def rvs(self, size):
# especially for MOC maps. For MOC maps, I obtain around one million
# samples per minute.

boundaries_vec = pixel_corners(pix_indices)
boundaries_vec = self.pixel_corners(pix_indices)

boundaries_z_min = boundaries_vec[:,2,:].min(axis=1)
boundaries_z_max = boundaries_vec[:,2,:].max(axis=1)
Expand All @@ -289,7 +289,7 @@ def rvs(self, size):
# We will shift the corresponding samples back after drawing them.
straddler_mask = (boundaries_phi_max - boundaries_phi_min) > numpy.pi / 2
boundaries_phi[straddler_mask,:] -= numpy.pi / 2
boundaries_phi[straddler_mask,:] = normalize_azimuth(
boundaries_phi[straddler_mask,:] = self.normalize_azimuth(
boundaries_phi[straddler_mask,:]
)
boundaries_phi_min[straddler_mask] = boundaries_phi[straddler_mask,:].min(axis=1)
Expand All @@ -310,7 +310,7 @@ def rvs(self, size):

# Now we can undo the shift for the straddlers. Ugly!
random_phis[straddler_mask] += numpy.pi / 2
random_phis[straddler_mask] = normalize_azimuth(
random_phis[straddler_mask] = self.normalize_azimuth(
random_phis[straddler_mask]
)

Expand Down

0 comments on commit 1892c60

Please sign in to comment.