astro_prost.diagnose

Functions

get_images(ra, dec[, size, filters, type])

Query Pan-STARRS PS1 to get a list of images.

get_url(ra, dec[, size, output_size, filters, format, ...])

Get the URL for images in the table.

get_ps1_pic(path, objid, ra, dec, size, band[, safe, save])

Downloads PS1 picture (in fits) centered at a given location.

find_all(name, path)

Crawls through a directory and all its sub-directories looking for a file matching

plot_match(host_ra, host_dec, host_redshift_mean, ...)

Plots a host-galaxy match with panstarrs postage stamp.

diagnose_ranking(true_index, post_probs, ...[, ...])

Prints summary statistics from association run.

Module Contents

get_images(ra, dec, size=240, filters='grizy', type='stack')[source]

Query Pan-STARRS PS1 to get a list of images.

Parameters:
  • ra (float) – Right ascension of position, in decimal degrees.

  • dec (float) – Declination of position, in decimal degrees.

  • size (int) – The image size in pixels (0.25 arcsec/pixel).

  • filters (str) – A string with the filters to include.

Returns:

The results of the search for relevant images.

Return type:

astropy.Table

get_url(ra, dec, size=240, output_size=None, filters='grizy', format='jpg', color=False, type='stack')[source]

Get the URL for images in the table.

Parameters:
  • ra (float) – Right ascension of position, in degrees.

  • dec (float) – Declination of position, in degrees.

  • size (int) – The extracted image size in pixels (0.25 arcsec/pixel)

  • output_size (int) – output (display) image size in pixels (default = size). The output_size has no effect for fits format images.

  • filters (str) – The string with filters to include.

  • format (str) – The data format (options are "jpg", "png” or "fits").

  • color (boolean) – If True, creates a color image (only for jpg or png format). If False, return a list of URLs for single-filter grayscale images.

Returns:

The url for the image to download.

Return type:

url

get_ps1_pic(path, objid, ra, dec, size, band, safe=False, save=False)[source]

Downloads PS1 picture (in fits) centered at a given location.

Parameters:
  • path (str) – The filepath where the fits file will be saved.

  • objid (int) – The PS1 objid of the object of interest (to save as filename).

  • ra (float) – Right ascension of position, in degrees.

  • dec (float) – Declination of position, in degrees.

  • size (int) – The extracted image size in pixels (0.25 arcsec/pixel)

  • band (str) – The PS1 band.

  • safe (boolean) – If True, include the objid of the object of interest in the filename (useful when saving multiple files at similar positions).

Returns:

fn – File retrieved from ps1

Return type:

fits file

find_all(name, path)[source]
Crawls through a directory and all its sub-directories looking for a file matching

‘name’. If found, it is returned.

Parameters:
  • name (str) – The filename for which to search.

  • path (str) – the absolute path to search within.

Returns:

result – List of absolute paths to all files called ‘name’ in ‘path’.

Return type:

list

plot_match(host_ra, host_dec, host_redshift_mean, host_redshift_std, transient_ra, transient_dec, transient_name, transient_redshift, bayesflag, fn, logger, true_host_ra=None, true_host_dec=None)[source]

Plots a host-galaxy match with panstarrs postage stamp.

Parameters:
  • host_ra (list) – List of right ascension coordinates for associated hosts, in decimal degrees. (Can provide up to 10 hosts)

  • host_dec (list) – List of declination coordinates for associated hosts, in decimal degrees.

  • host_redshift_mean (float) – Point estimate of host-galaxy redshift.

  • host_redshift_std (float) – Error on host_redshift_mean.

  • transient_ra (float) – Right ascension of transient, in decimal degrees.

  • transient_dec (float) – Declination of transient, in decimal degrees.

  • transient_name (str) – Name of transient for plot.

  • transient_redshift (float) – Redshift of transient, if available.

  • bayesflag (int) – Flag from association run. If 0, bayes factor is sufficient for confident association. If 1, bayes factor is weak. If 2, bayes factor is strong.

  • fn (str) – Name of saved image.

  • logger (logging.Logger) – Logger instance for messages to console or output file.

  • true_host_ra (float) – Right ascension of the true galaxy in decimal degrees.

  • true_host_dec (float) – Declination of the true galaxy in decimal degrees.

diagnose_ranking(true_index, post_probs, galaxy_catalog, post_offset, post_z, post_absmag, galaxy_ids, z_sn, transient_position, logger, post_offset_true=None, post_z_true=None, post_absmag_true=None)[source]

Prints summary statistics from association run.

Parameters:
  • true_index (int) – Index of the true host in galaxy_ids.

  • post_probs (list) – List of total posterior probabilities for candidate hosts.

  • galaxy_catalog (str) – Galaxy catalog used for association.

  • post_offset (list) – Posterior probabilities for fractional offset.

  • post_z (list) – Posterior probabilities for redshift.

  • post_absmag (list) – Posterior probabilities for absolute magnitude.

  • galaxy_ids (list) – List of catalog ids for candidate hosts.

  • z_sn (float) – Redshift of the transient.

  • transient_position (astropy.coordinates SkyCoord) – Position of the associated transient.

  • logger (logging.Logger) – Logger instance for messages to console or output file.

  • post_offset_true (float) – Posterior probability for true host’s fractional offset.

  • post_z_true (float) – Posterior probability for true host’s redshift.

  • post_absmag_true (float) – Posterior probability for true host’s absolute magnitude.

Returns:

  • true_rank (int) – Rank of the true host galaxy in final association.

  • post_probs[true_index] (float) – Total posterior probability for true host