pyhips/pyhips.py
def grid_builder(id, frame="ICRS", survey_list = ['DSS', 'DSS2/red', 'CDS/P/AKARI/FIS/N160', 'PanSTARRS/DR1/z', '2MASS/J', 'AllWISE/W3'], cmap="gray", fov=1.0):
    """
        Function to build grid of get_image images. Plots the grid, saves the image as a JPEG (fig.jpg).

        Args:
            id (string): SIMBAD resolvable identifier
            frame (string): coordinate frame to use (default ICRS)
            survey_list (list): HiPS surveys to grab data from (default DSS, DSS2/red, CDS/P/AKARI/FIS/N160, PanSTARRS/DR1/z, 2MASS/J and AllWISE/W3)
            cmap (string): matplotlib colormap to use when plotting (default "gray")
            fov (float): field of view of images (in degrees, default 1.0)

        Return:
            int: status code 0 for successful operation, 1 for error. If an error is returned, it will likely have been printed to stdout
    """

    # instantiate target object
    tgt = Target(id=id, frame=frame, survey='DSS')

    # resolve target name, if this fails, quit execution and return the error code
    code = tgt.resolve_name()
    if code != 0:
        return(1)

    # make the figure for the grid
    fig, axs = plt.subplots(1, len(survey_list), figsize=(4 * len(survey_list), 3 * 1), facecolor='w', edgecolor='k')
    fig.subplots_adjust(hspace = .2, wspace=.001)

    axs = axs.ravel()
    i=0
    for survey in survey_list:

        # make hips2fits query to be placed in url
        query_params = {
            'hips': tgt.survey,
            'object': tgt.id,
            'ra': tgt.coords.ra.value,
            'dec': tgt.coords.dec.value,
            'fov': (fov * u.deg).to(u.deg).value,
            'width': 500,
            'height': 500,
        }

        url = f'http://alasky.u-strasbg.fr/hips-image-services/hips2fits?{urlencode(query_params)}'

        axs[i].set_title('{} - {}'.format(tgt.main_id, survey))
    
        hdu = fits.open(url)
        im = hdu[0].data
        axs[i].imshow(im, origin='lower', cmap=cmap)
        
        i += 1

    fig.savefig(f"{tgt.main_id}" + "_grid.jpg", dpi=200)
    return(0)

    # TODO: need to add error exception

        Function to build grid of get_image images. Plots the grid, saves the image as a JPEG (fig.jpg).

        Args:
            id (string): SIMBAD resolvable identifier
            frame (string): coordinate frame to use (default ICRS)
            survey_list (list): HiPS surveys to grab data from (default DSS, DSS2/red, CDS/P/AKARI/FIS/N160, PanSTARRS/DR1/z, 2MASS/J and AllWISE/W3)
            cmap (string): matplotlib colormap to use when plotting (default "gray")
            fov (float): field of view of images (in degrees, default 1.0)

        Return:
            int: status code 0 for successful operation, 1 for error. If an error is returned, it will likely have been printed to stdout
    
Function to build grid of get_image images. Plots the grid, saves the image as a JPEG (fig.jpg).
Function to build grid of get_image images . Plots the grid saves the image as a JPEG ( fig . jpg ) .
def grid_builder(id, frame="ICRS", survey_list = ['DSS', 'DSS2/red', 'CDS/P/AKARI/FIS/N160', 'PanSTARRS/DR1/z', '2MASS/J', 'AllWISE/W3'], cmap="gray", fov=1.0):
    tgt = Target(id=id, frame=frame, survey='DSS')
    code = tgt.resolve_name()
    if code != 0:
        return(1)
    fig, axs = plt.subplots(1, len(survey_list), figsize=(4 * len(survey_list), 3 * 1), facecolor='w', edgecolor='k')
    fig.subplots_adjust(hspace = .2, wspace=.001)
    axs = axs.ravel()
    i=0
    for survey in survey_list:
        query_params = {
            'hips': tgt.survey,
            'object': tgt.id,
            'ra': tgt.coords.ra.value,
            'dec': tgt.coords.dec.value,
            'fov': (fov * u.deg).to(u.deg).value,
            'width': 500,
            'height': 500,
        }
        url = f'http://alasky.u-strasbg.fr/hips-image-services/hips2fits?{urlencode(query_params)}'
        axs[i].set_title('{} - {}'.format(tgt.main_id, survey))
        hdu = fits.open(url)
        im = hdu[0].data
        axs[i].imshow(im, origin='lower', cmap=cmap)
        i += 1
    fig.savefig(f"{tgt.main_id}" + "_grid.jpg", dpi=200)
    return(0)
def grid_builder ( id , frame = "ICRS" , survey_list = [ 'DSS' , 'DSS2/red' , 'CDS/P/AKARI/FIS/N160' , 'PanSTARRS/DR1/z' , '2MASS/J' , 'AllWISE/W3' ] , cmap = "gray" , fov = 1.0 ) : tgt = Target ( id = id , frame = frame , survey = 'DSS' ) code = tgt . resolve_name ( ) if code != 0 : return ( 1 ) fig , axs = plt . subplots ( 1 , len ( survey_list ) , figsize = ( 4 * len ( survey_list ) , 3 * 1 ) , facecolor = 'w' , edgecolor = 'k' ) fig . subplots_adjust ( hspace = .2 , wspace = .001 ) axs = axs . ravel ( ) i = 0 for survey in survey_list : query_params = { 'hips' : tgt . survey , 'object' : tgt . id , 'ra' : tgt . coords . ra . value , 'dec' : tgt . coords . dec . value , 'fov' : ( fov * u . deg ) . to ( u . deg ) . value , 'width' : 500 , 'height' : 500 , } url = f'http://alasky.u-strasbg.fr/hips-image-services/hips2fits?{urlencode(query_params)}' axs [ i ] . set_title ( '{} - {}' . format ( tgt . main_id , survey ) ) hdu = fits . open ( url ) im = hdu [ 0 ] . data axs [ i ] . imshow ( im , origin = 'lower' , cmap = cmap ) i += 1 fig . savefig ( f"{tgt.main_id}" + "_grid.jpg" , dpi = 200 ) return ( 0 )
Function to build grid of get_image images.
Function to build grid of get_image images .
"""
        Function to build grid of get_image images. Plots the grid, saves the image as a JPEG (fig.jpg).

        Args:
            id (string): SIMBAD resolvable identifier
            frame (string): coordinate frame to use (default ICRS)
            survey_list (list): HiPS surveys to grab data from (default DSS, DSS2/red, CDS/P/AKARI/FIS/N160, PanSTARRS/DR1/z, 2MASS/J and AllWISE/W3)
            cmap (string): matplotlib colormap to use when plotting (default "gray")
            fov (float): field of view of images (in degrees, default 1.0)

        Return:
            int: status code 0 for successful operation, 1 for error. If an error is returned, it will likely have been printed to stdout
    """ # instantiate target object # resolve target name, if this fails, quit execution and return the error code # make the figure for the grid # make hips2fits query to be placed in url # TODO: need to add error exception
id
SIMBAD resolvable identifier
SIMBAD resolvable identifier
frame
coordinate frame to use (default ICRS)
coordinate frame to use ( default ICRS )
survey_list
HiPS surveys to grab data from (default DSS, DSS2/red, CDS/P/AKARI/FIS/N160, PanSTARRS/DR1/z, 2MASS/J and AllWISE/W3)
HiPS surveys to grab data from ( default DSS DSS2 / red CDS / P / AKARI / FIS / N160 PanSTARRS / DR1 / z 2MASS / J and AllWISE / W3 )
cmap
matplotlib colormap to use when plotting (default "gray")
matplotlib colormap to use when plotting ( default " gray " )
fov
field of view of images (in degrees, default 1.0)
field of view of images ( in degrees default 1 . 0 )