hips2fitsClass

class astroquery.hips2fits.hips2fitsClass(*args)[source]

Bases: BaseQuery

Query the CDS hips2fits service

The CDS hips2fits service offers a way to extract FITS images from HiPS sky maps. HiPS is an IVOA standard that combines individual images in order to produce a progressive hierarchical sky map describing the whole survey. Please refer to the IVOA paper for more info.

Given an astropy user-defined WCS with an HiPS name (see the list of valid HiPS names hosted in CDS here), hips2fits will return you the corresponding FITS image (JPG/PNG output formats are also implemented).

This package implements two methods:

  • query_with_wcs() extracting a FITS image from a HiPS and an astropy wcs.WCS.

    See here all the valid HiPS names hosted in CDS.

  • query() extracting a FITS image from a HiPS given the output image pixel size, the center of projection, the type of projection and the field of view.

    See here all the valid HiPS names hosted in CDS.

Attributes Summary

server

timeout

Methods Summary

query(hips, width, height, projection, ra, ...)

Query the CDS hips2fits service.

query_async([get_query_payload])

query_with_wcs(hips, wcs[, format, min_cut, ...])

Query the CDS hips2fits service with a astropy WCS.

query_with_wcs_async([get_query_payload])

Attributes Documentation

server = 'http://alasky.u-strasbg.fr/hips-image-services/hips2fits'
timeout = 30

Methods Documentation

query(hips, width, height, projection, ra, dec, fov, coordsys='icrs', rotation_angle=<Angle 0. deg>, format='fits', min_cut=0.5, max_cut=99.5, stretch='linear', cmap='Greys_r', get_query_payload=False, verbose=False)[source]

Query the CDS hips2fits service.

If you have not any WCS, you can call this method by passing: * The width/height size of the output pixel image * The center of projection in world coordinates (ra, dec) * The fov angle in world coordinates * The rotation angle of the projection * The name of the projection. All astropy projections are supported:

Parameters:
hipsstr

ID or keyword identifying the HiPS to use. If multiple HiPS surveys match, one is chosen randomly. See the list of valid HiPS ids hosted by the CDS here.

widthint

Width in pixels of the output image.

heightint

Height in pixels of the output image.

projectionstr

Name of the requested projection, eg: SIN, TAN, MOL, AIT, CAR, CEA, STG Compulsory if wcs is not provided. See this page for an exhaustive list.

fovAngle

Size (FoV) of the cutout on the sky. This is the size of the largest dimension of the image.

raLongitude

Right ascension of the center of the output image.

decLatitude

Declination of the center of the output image.

coordsysstr, optional

Coordinate frame system to be used for the projection Possible values are icrs or galactic. Default value is icrs.

rotation_angleAngle, optional

Angle value to be applied to the projection Default value is Angle(0 * u.deg)

formatstr, optional

Format of the output image. Allowed values are fits (default), jpg and png In case of jpg or png format, scaling of the pixels value can be controlled with parameters min_cut, max_cut and stretch

min_cutfloat, optional

Minimal value considered for contrast adjustment normalization. Only applicable to jpg/png output formats. Can be given as a percentile value, for example min_cut=1.5%. Default value is 0.5%.

max_cutfloat, optional

Maximal value considered for contrast adjustment normalization. Only applicable to jpg/png output formats. Can be given as a percentile value, for example max_cut=97%. Default value is 99.5%.

stretchstr, optional

Stretch function used for contrast adjustment. Only applicable to jpg/png output formats. Possible values are: power, linear, sqrt, log, asinh. Default value is linear.

cmapColormap or str, optional

Name of the color map. Only applicable to jpg/png output formats. Any colormap supported by Matplotlib can be specified. Default value is Greys_r (grayscale)

get_query_payloadbool, optional

If True, returns a dictionary of the query payload instead of the parsed response.

verbosebool, optional
Returns:
responseHDUList or ndarray

Returns an astropy HDUList for fits output format or a 3-dimensional numpy array for jpg/png output formats.

Examples

>>> from astroquery.hips2fits import hips2fits
>>> import matplotlib.pyplot as plt
>>> from matplotlib.colors import Colormap
>>> import astropy.units as u
>>> from astropy.coordinates import Longitude, Latitude, Angle
>>> hips = 'CDS/P/DSS2/red'
>>> result = hips2fits.query(
...    hips=hips,
...    width=1000,
...    height=500,
...    ra=Longitude(0 * u.deg),
...    dec=Latitude(20 * u.deg),
...    fov=Angle(80 * u.deg),
...    projection="TAN",
...    get_query_payload=False,
...    format='jpg',
...    min_cut=0.5,
...    max_cut=99.5,
...    cmap=Colormap('viridis'),
... )
>>> im = plt.imshow(result)
>>> plt.show(im)
query_async(get_query_payload=False, **kwargs)[source]
query_with_wcs(hips, wcs, format='fits', min_cut=0.5, max_cut=99.5, stretch='linear', cmap='Greys_r', get_query_payload=False, verbose=False)[source]

Query the CDS hips2fits service with a astropy WCS.

Parameters:
hipsstr

ID or keyword identifying the HiPS to use. If multiple HiPS surveys match, one is chosen randomly. See the list of valid HiPS ids hosted by the CDS here.

wcsWCS

An astropy WCS defining the astrometry you wish. Alternatively, you can pass lon, lat, fov, coordsys keywords.

formatstr, optional

Format of the output image. Allowed values are fits (default), jpg and png In case of jpg or png format, scaling of the pixels value can be controlled with parameters min_cut, max_cut and stretch

min_cutfloat, optional

Minimal value considered for contrast adjustment normalization. Only applicable to jpg/png output formats. Can be given as a percentile value, for example min_cut=1.5%. Default value is 0.5%.

max_cutfloat, optional

Maximal value considered for contrast adjustment normalization. Only applicable to jpg/png output formats. Can be given as a percentile value, for example max_cut=97%. Default value is 99.5%.

stretchstr, optional

Stretch function used for contrast adjustment. Only applicable to jpg/png output formats. Possible values are: power, linear, sqrt, log, asinh. Default value is linear.

cmapColormap or str, optional

Name of the color map. Only applicable to jpg/png output formats. Any colormap supported by Matplotlib can be specified. Default value is Greys_r (grayscale)

get_query_payloadbool, optional

If True, returns a dictionary of the query payload instead of the parsed response.

verbosebool, optional
Returns:
responseHDUList or ndarray

Returns an astropy HDUList for fits output format or a 3-dimensional numpy array for jpg/png output formats.

Examples

>>> from astroquery.hips2fits import hips2fits
>>> import matplotlib.pyplot as plt
>>> from matplotlib.colors import Colormap
>>> from astropy import wcs as astropy_wcs
>>> # Create a new WCS astropy object
>>> w = astropy_wcs.WCS(header={
...     'NAXIS1':                 2000,  # Width of the output fits/image
...     'NAXIS2':                 1000,  # Height of the output fits/image
...     'WCSAXES':                   2,  # Number of coordinate axes
...     'CRPIX1':                1000.0, # Pixel coordinate of reference point
...     'CRPIX2':                500.0,  # Pixel coordinate of reference point
...     'CDELT1':                -0.18,  # [deg] Coordinate increment at reference point
...     'CDELT2':                 0.18,  # [deg] Coordinate increment at reference point
...     'CUNIT1': 'deg',                 # Units of coordinate increment and value
...     'CUNIT2': 'deg',                 # Units of coordinate increment and value
...     'CTYPE1': 'GLON-MOL',            # galactic longitude, Mollweide's projection
...     'CTYPE2': 'GLAT-MOL',            # galactic latitude, Mollweide's projection
...     'CRVAL1':                  0.0,  # [deg] Coordinate value at reference point
...     'CRVAL2':                  0.0,  # [deg] Coordinate value at reference point
... })
>>> hips = 'CDS/P/DSS2/red'
>>> result = hips2fits.query_with_wcs(
...    hips=hips,
...    wcs=w,
...    get_query_payload=False,
...    format='jpg',
...    min_cut=0.5,
...    max_cut=99.5,
...    cmap=Colormap('viridis'),
... )
>>> im = plt.imshow(result)
>>> plt.show(im)
query_with_wcs_async(get_query_payload=False, **kwargs)[source]