image_funcs

Script containing many functions needed for ZTF Check.

These functions were either written originally by Zach Vanderbosch (https://github.com/zvanderbosch) or members of the Space Telescope Science Instutute (STSCI) for handling MAST's Pan-STARRS API (see http://ps1images.stsci.edu/ps1_dr2_api.html AND https://ps1images.stsci.edu/ps1image.html).

image_funcs.checklegal(table, release)

Checks if this combination of table and release is acceptable

Raises a VelueError exception if there is problem

image_funcs.getps1colorim(ra, dec, size=240, output_size=None, filters='grizy', format='jpg')

Get color image at a sky position

ra, dec = position in degrees size = extracted image size in pixels (0.25 arcsec/pixel) output_size = output (display) image size in pixels (default = size).

output_size has no effect for fits format images.

filters = string with filters to include format = data format (options are "jpg", "png") Returns the image

image_funcs.getps1images(ra, dec, size=240, filters='grizy')

Query ps1filenames.py service to get a list of images

ra, dec = position in degrees size = image size in pixels (0.25 arcsec/pixel) filters = string with filters to include Returns a table with the results

image_funcs.getps1url(ra, dec, size=240, output_size=None, filters='grizy', format='jpg', color=False)

Get URL for images in the table

ra, dec = position in degrees size = extracted image size in pixels (0.25 arcsec/pixel) output_size = output (display) image size in pixels (default = size).

output_size has no effect for fits format images.

filters = string with filters to include format = data format (options are "jpg", "png" or "fits") color = if True, creates a color image (only for jpg or png format).

Default is return a list of URLs for single-filter grayscale images.

Returns a string with the URL

image_funcs.getztfrefurls(ra, dec, size=45.0)

Function to retrieve URLs for reference image cutouts from IRSA/IPAC centered on a given RA and DEC.

Author: Zach Vanderbosch

Parameters
  • ra (float) -- Right Ascension in Decimal Degrees

  • dec (float) -- Declination in Decimal Degrees

  • size (float) -- Image size in arcseonds

Returns

urls (list): list of URLs used to download image data

Return type

list

image_funcs.ps1cone(ra, dec, radius, table='mean', release='dr1', format='csv', columns=None, baseurl='https://catalogs.mast.stsci.edu/api/v0.1/panstarrs', verbose=False, **kw)

Do a cone search of the PS1 catalog

Parameters
  • (float) (radius) --

  • (float) --

  • (float) --

  • (string) (release) --

  • (string) --

  • format (csv, votable, json) --

  • columns (list of column names to include (None means use defaults)) --

  • baseurl (base URL for the request) --

  • verbose (print info about request) --

  • **kw (other parameters (e.g., 'nDetections.min':2)) --

image_funcs.ps1metadata(table='mean', release='dr1', baseurl='https://catalogs.mast.stsci.edu/api/v0.1/panstarrs')

Return metadata for the specified catalog and table

Parameters
  • (string) (release) --

  • (string) --

  • baseurl (base URL for the request) --

  • an astropy table with columns name (Returns) --

  • type --

  • description --

image_funcs.ps1search(table='mean', release='dr1', format='csv', columns=None, baseurl='https://catalogs.mast.stsci.edu/api/v0.1/panstarrs', verbose=False, **kw)

Do a general search of the PS1 catalog (possibly without ra/dec/radius)

Parameters
  • (string) (release) --

  • (string) --

  • format (csv, votable, json) --

  • columns (list of column names to include (None means use defaults)) --

  • baseurl (base URL for the request) --

  • verbose (print info about request) --

  • **kw (other parameters (e.g., 'nDetections.min':2) Note this is required!) --

image_funcs.ps_query(ra, dec, rad, full_query=False)

Function to perform a Pan-STARRS query centered on a given RA and DEC. Returns basic information for the target and nearby neighbors.

Author: Zach Vanderbosch (original), Joseph Guidry

Parameters
  • ra (float) -- Right Ascension in Decimal Degrees

  • dec (float) -- Declination in Decimal Degrees

  • rad (float) -- Radius of cone search

  • full_query (bool, optional) -- Optional argument that allows users to query further information for a given target.

Returns

sorted_tab (DataFrame): Pandas DataFrame containung query results

Return type

DataFrame