HipsTileAllskyArray

class hips.HipsTileAllskyArray(meta: hips.tiles.tile.HipsTileMeta, raw_data: bytes)[source]

Bases: hips.HipsTile

All-sky tile array container.

To quote from section 4.3.2 “Allsky preview file” of the HiPS IVOA working draft: “The tiles at low orders (0 to 3) may be packaged together into a unique file called Allsky.”

This class implements that all-sky tile array format.

TODO: We’re sub-classing HipsTile here at the moment. This is weird! Probably the current HipsTile should be renamed ImageIO or be split up into functions that do image I/O in the three supported formats?

TODO: We re-use the HipsTileMeta class to store order as well as other info like file_format and frame. Note that ipix doesn’t make sense for an AllSkyTileArray. Maybe there’s a better way to handle this without code duplication?

Examples

Load an example existing HiPS all-sky image (unfortunately one has to pass a dummy ipix value here):

>>> from hips import HipsTileAllskyArray, HipsTileMeta
>>> meta = HipsTileMeta(order=3, ipix=-1, file_format='jpg', frame='icrs')
>>> url = 'http://alasky.unistra.fr/Fermi/Color/Norder3/Allsky.jpg'
>>> allsky = HipsTileAllskyArray.fetch(meta, url)

Now you can extract tiles (e.g. for drawing):

>>> tile = allsky.tile(ipix=42)
>>> tile.meta
HipsTileMeta(order=3, ipix=42, file_format='jpg', frame='icrs', width=64)

TODO: add an example how to go the other way: combine tiles into an allsky image.

Attributes Summary

height Image pixel height (int)
n_tiles Number of tiles in the image (int).
n_tiles_in_row Number of tiles per tile row (int).
tile_width Pixel width of a single tile (int).
tiles Split into a list of HipsTile.
width Image pixel width (int).

Methods Summary

from_tiles(tiles) Create all-sky image from list of tiles.
tile(ipix) Extract one of the tiles (HipsTile)
tiles_to_allsky_array(tiles) Combine tiles into an all-sky image.

Attributes Documentation

height

Image pixel height (int)

n_tiles

Number of tiles in the image (int).

n_tiles_in_row

Number of tiles per tile row (int).

tile_width

Pixel width of a single tile (int).

tiles

Split into a list of HipsTile.

This is called when using the all-sky image for drawing.

width

Image pixel width (int).

Methods Documentation

classmethod from_tiles(tiles: List[hips.tiles.tile.HipsTile]) → hips.tiles.allsky.HipsTileAllskyArray[source]

Create all-sky image from list of tiles.

tile(ipix: int) → hips.tiles.tile.HipsTile[source]

Extract one of the tiles (HipsTile)

A copy of the data by default. For drawing we could avoid the copy by passing copy=False here.

static tiles_to_allsky_array(tiles: List[hips.tiles.tile.HipsTile]) → numpy.ndarray[source]

Combine tiles into an all-sky image.