HipsPainter

class hips.HipsPainter(geometry: Union[dict, hips.utils.wcs.WCSGeometry], hips_survey: Union[str, hips.tiles.survey.HipsSurveyProperties], tile_format: str, precise: bool = False, progress_bar: bool = True, fetch_opts: dict = None)[source]

Bases: object

Paint a sky image from HiPS image tiles.

Paint HiPS tiles onto a ky image using a simple projective transformation method. The algorithm implemented is described here: HiPS tile drawing.

Parameters:

geometry : dict or WCSGeometry

An object of WCSGeometry

hips_survey : str or HipsSurveyProperties

HiPS survey properties

tile_format : {‘fits’, ‘jpg’, ‘png’}

Format of HiPS tile

precise : bool

Use the precise drawing algorithm

progress_bar : bool

Show a progress bar for tile fetching and drawing

fetch_opts : dict

Keyword arguments for fetching HiPS tiles. To see the list of passable arguments, refer to fetch_tiles

Examples

>>> from astropy.coordinates import SkyCoord
>>> from hips import WCSGeometry
>>> from hips import HipsSurveyProperties
>>> from hips import HipsPainter
>>> geometry = WCSGeometry.create(
...     skydir=SkyCoord(0, 0, unit='deg', frame='icrs'),
...     width=2000, height=1000, fov='3 deg',
...     coordsys='icrs', projection='AIT',
... )
>>> url = 'http://alasky.unistra.fr/DSS/DSS2Merged/properties'
>>> hips_survey = HipsSurveyProperties.fetch(url)
>>> painter = HipsPainter(geometry, hips_survey, 'fits')
>>> painter.draw_hips_order
7
>>> painter.run()
>>> painter.image.shape
(1000, 2000)

Attributes Summary

draw_hips_order Compute HiPS tile order matching a given image pixel size.
image Computed sky image (ndarray).
tile_indices Get list of index values for HiPS tiles.
tiles List of HipsTile (cached on multiple access).

Methods Summary

draw_all_tiles() Make an empty sky image and draw all the tiles.
make_tile_list()
plot_mpl_hips_tile_grid() Plot output image and HiPS grid with matplotlib.
projection(tile) Estimate projective transformation on a HiPS tile.
run() Draw HiPS tiles onto an empty image.
warp_image(tile) Warp a HiPS tile and a sky image.

Attributes Documentation

draw_hips_order

Compute HiPS tile order matching a given image pixel size.

image

Computed sky image (ndarray).

  • The dtype is always chosen to match the tile dtype. This is uint8 for JPG or PNG tiles, and can be e.g. int16 or float32 for FITS tiles.
  • The output shape is documented here: shape.
tile_indices

Get list of index values for HiPS tiles.

tiles

List of HipsTile (cached on multiple access).

Methods Documentation

draw_all_tiles()[source]

Make an empty sky image and draw all the tiles.

make_tile_list()[source]
plot_mpl_hips_tile_grid() → None[source]

Plot output image and HiPS grid with matplotlib.

This is mainly useful for debugging the drawing algorithm, not something end-users will call or need to know about.

projection(tile: hips.tiles.tile.HipsTile) → skimage.transform._geometric.ProjectiveTransform[source]

Estimate projective transformation on a HiPS tile.

run() → numpy.ndarray[source]

Draw HiPS tiles onto an empty image.

warp_image(tile: hips.tiles.tile.HipsTile) → numpy.ndarray[source]

Warp a HiPS tile and a sky image.