Skip to content

Commit

Permalink
Merge pull request #728 from lsst/tickets/DM-36807
Browse files Browse the repository at this point in the history
DM-36807: Replace healpy with hpgeom in hips.py
  • Loading branch information
erykoff committed Nov 1, 2022
2 parents e54c72f + bb1e618 commit 5fc1c12
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/lsst/pipe/tasks/hips.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import warnings
import math
from datetime import datetime
import healpy as hp
import hpgeom as hpg
import healsparse as hsp
from astropy.io import fits
from astropy.visualization.lupton_rgb import AsinhMapping
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def _write_properties_and_moc(
multiband : `bool`
Is band multiband / color?
"""
area = hp.nside2pixarea(2**max_order, degrees=True)*len(pixels)
area = hpg.nside_to_pixel_area(2**max_order, degrees=True)*len(pixels)

initial_ra = self.config.properties.initial_ra
initial_dec = self.config.properties.initial_dec
Expand All @@ -1206,8 +1206,8 @@ def _write_properties_and_moc(
if temp_pixels.size % 2 == 0:
temp_pixels = np.append(temp_pixels, [temp_pixels[0]])
medpix = int(np.median(temp_pixels))
_initial_ra, _initial_dec = hp.pix2ang(2**max_order, medpix, lonlat=True, nest=True)
_initial_fov = hp.nside2resol(2**max_order, arcmin=True)/60.
_initial_ra, _initial_dec = hpg.pixel_to_angle(2**max_order, medpix)
_initial_fov = hpg.nside_to_resolution(2**max_order, units='arcminutes')/60.

if initial_ra is None or initial_dec is None:
initial_ra = _initial_ra
Expand Down Expand Up @@ -1311,7 +1311,7 @@ def _write_property(fh, name, value):
bitpix = 32

date_iso8601 = datetime.utcnow().isoformat(timespec="seconds") + "Z"
pixel_scale = np.rad2deg(hp.nside2resol(2**(max_order + shift_order)))
pixel_scale = hpg.nside_to_resolution(2**(max_order + shift_order), units='degrees')

uri = hips_base_path.join("properties")
with ResourcePath.temporary_uri(suffix=uri.getExtension()) as temporary_uri:
Expand Down Expand Up @@ -1469,7 +1469,7 @@ def _write_allsky_file(self, hips_base_path, allsky_order):
HEALPix order of the minimum order to make allsky file.
"""
tile_size = self.config.allsky_tilesize
n_tiles_per_side = int(np.sqrt(hp.order2npix(allsky_order)))
n_tiles_per_side = int(np.sqrt(hpg.nside_to_npixel(hpg.order_to_nside(allsky_order))))

allsky_image = None

Expand Down

0 comments on commit 5fc1c12

Please sign in to comment.