Skip to content

Commit

Permalink
Make mhealpy an optional import
Browse files Browse the repository at this point in the history
  • Loading branch information
titodalcanton committed Dec 18, 2024
1 parent 5539df6 commit b324dd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion companion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ gwpy>=0.8.1

# HEALPix is very useful for some analysis.
healpy
mhealpy

# Needed for GraceDB uploads and skymap generation
ligo-gracedb>=2.10.0
Expand Down
7 changes: 5 additions & 2 deletions pycbc/distributions/sky_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@


from scipy.spatial.transform import Rotation
from mhealpy import HealpixMap

from pycbc.distributions import angular
from pycbc import VARARGS_DELIM
from pycbc.io import FieldArray
from pycbc.types import angle_as_radians
from pycbc.libutils import import_optional

mhealpy = import_optional('mhealpy')


logger = logging.getLogger('pycbc.distributions.sky_location')

Expand Down Expand Up @@ -182,7 +185,7 @@ class HealpixSky:
def __init__(self, **params):
# Read the map file.
file_name = params['healpix_file']
self.healpix_map = HealpixMap.read_map(file_name)
self.healpix_map = mhealpy.HealpixMap.read_map(file_name)

# Get the probabilities at each pixel.
if self.healpix_map.density():
Expand Down

0 comments on commit b324dd9

Please sign in to comment.