Wrapper Modules

These modules contain a wrapper for the full association pipeline.

ghostHelperFunctions

astro_ghost.ghostHelperFunctions.checkSimbadHierarchy(df, verbose=False)[source]

Throw a warning if the source has a parent in simbad!

Parameters:

df (Pandas DataFrame) – The final associated data frame containing host and transient features.

Returns:

The dataframe, after correcting for SIMBAD hierarchical information.

Return type:

Pandas DataFrame

astro_ghost.ghostHelperFunctions.cleanup(path)[source]

Cleans up the working directory.

This is done after host-galaxy association is completed.

Parameters:

path (str) – filepath where association files are saved

astro_ghost.ghostHelperFunctions.coneSearchPairs(coord, radius, GHOSTpath='')[source]

A cone search for all transient-host pairs within a certain radius, returned as a pandas dataframe.

Parameters:
  • coord (Position for cone search.) – Astropy SkyCoord

  • radius (float) – Search radius, in arcsec.

  • GHOSTpath (str) – The path to the saved GHOST database.

Returns:

GHOST galaxies within search radius.

Return type:

Pandas DataFrame

astro_ghost.ghostHelperFunctions.findNewHosts(transientName, snCoord, snClass, verbose=False, starcut='gentle', ascentMatch=False, px=800, savepath='./', rad=60, GLADE=True)[source]

Associates hosts of transients not in the GHOST database.

Parameters:
  • transientName (array-like) – List of transients to associate.

  • snCoord (array-like) – List of astropy SkyCoord transient positions.

  • snClass (array-like) – List of transient classifications (if they exist).

  • verbose (bool, optional) – If True, print logging information.

  • starcut (str, optional) – Strings corresponding to the classification thresholds required to classify a star as such. Options are 'gentle' (P>0.8), normal (P>0.5), and aggressive (P>0.3).

  • ascentMatch (bool, optional) – If True, run the gradient ascent algorithm for the transients not matched with the Directional Light Radius algorithm.

  • px (int) – Size of the image used in gradient ascent (ignored if ascentMatch=False).

  • savepath (str) – Filepath where dataframe of associated hosts will be saved.

  • rad (float) – The search radius around each transient position, in arcseconds.

Returns:

Final dataframe of associated transients and host galaxies.

Return type:

Pandas DataFrame

astro_ghost.ghostHelperFunctions.fracWithHosts(transient_dict)[source]

Calculates transient fraction with at least one candidate host.

Parameters:

transient_dict (dictionary) – The dictionary of supernovae and their host galaxy candidate objIDs from PS1.

Returns:

The fraction of supernovae with at least one candidate host galaxy.

Return type:

dictionary

astro_ghost.ghostHelperFunctions.fullData(GHOSTpath='')[source]

Returns the full GHOST database.

Parameters:

GHOSTpath (str) – The path to the saved GHOST database.

Returns:

GHOST database.

Return type:

Pandas DataFrame

astro_ghost.ghostHelperFunctions.getDBHostFromTransientCoords(transientCoords, GHOSTpath='')[source]

Gets the host of a GHOST transient by position.

Parameters:
  • transientCoords (array-like) – A list of astropy SkyCoord coordinates of transients.

  • GHOSTpath (str) – The path to the saved GHOST database.

Returns:

The PS1 objects associated with the queried transients in GHOST.

Return type:

Pandas DataFrame

Returns:

A list of the coordinates of transients not found in the database.

Return type:

host_DF : array-like

astro_ghost.ghostHelperFunctions.getDBHostFromTransientName(transientNames, GHOSTpath='')[source]

Gets the host of a GHOST transient by transient name.

Parameters:
  • transientNames (array-like) – A list of transient names.

  • GHOSTpath (str) – The path to the saved GHOST database.

Returns:

The PS1 objects associated with the queried transients in GHOST.

Return type:

Pandas DataFrame

Returns:

A list of the coordinates of transients not found in the database.

Return type:

array-like

astro_ghost.ghostHelperFunctions.getGHOST(real=False, verbose=False, installpath='', clobber=False)[source]

Downloads the GHOST database.

Parameters:
  • real (bool, optional) – If True, download the GHOST database. If False, write an empty files with relevant columns (so that every transient is manually associated).

  • verbose (bool, optional) – If True, print debugging info.

  • installpath (str) – Filepath where GHOST database will be installed.

  • clobber (bool, optional) – If True, write new GHOST database even if it already exists at installpath.

astro_ghost.ghostHelperFunctions.getHostFromHostCoords(hostCoords, GHOSTpath='')[source]

Gets hosts in the GHOST database by coordinates.

:param hostCoords : A list of astropy SkyCoord coordinates of host galaxies. :type hostCoords: array-like :param GHOSTpath: The path to the saved GHOST database. :type GHOSTpath: str :return: The subset of discovered hosts. :rtype: Pandas DataFrame

astro_ghost.ghostHelperFunctions.getHostFromHostName(hostNames, GHOSTpath='')[source]

Gets hosts in the GHOST database by name.

Parameters:
  • hostNames (array-like) – A list of host galaxy names.

  • GHOSTpath (str) – The path to the saved GHOST database.

Returns:

The host galaxies found in GHOST.

Return type:

Pandas DataFrame

astro_ghost.ghostHelperFunctions.getHostImage(transientName='', band='grizy', rad=60, save=False, GHOSTpath='')[source]
Returns a postage stamp of the most likely host in one of the PS1 bands - g,r,i,z,y - as a

fits file with radius rad, and plots the image.

Parameters:
  • transientName (str) – Name of queried transient.

  • band (str) – Band for host-galaxy image.

  • rad (float) – Size of the image, in arcsec.

  • save (bool, optional) – If True, save host image.

  • GHOSTpath (str) – The path to the saved GHOST database.

astro_ghost.ghostHelperFunctions.getHostSpectra(transientName, path)[source]

Retrieves all saved spectra associated with a host galaxy.

Parameters:
  • path (str) – Filepath to spectra.

  • transientName (str) – Name of transient to query.

Returns:

Saved spectra.

Return type:

list of Pandas DataFrames

astro_ghost.ghostHelperFunctions.getHostStatsFromTransientCoords(transientCoordsList, GHOSTpath='')[source]
Returns basic statistics for the most likely

host of a previously identified transient, from the transient’s coordinates.

Parameters:
  • transientCoordsList (array-like) – A list of astropy SkyCoord coordinates of transients.

  • GHOSTpath (str) – The path to the saved GHOST database.

astro_ghost.ghostHelperFunctions.getHostStatsFromTransientName(transientName, GHOSTpath='')[source]

Returns basic statistics for the most likely host of a previously identified transient.

Parameters:
  • transientName (array-like) – Array of transient names.

  • GHOSTpath (str) – The path to the saved GHOST database.

astro_ghost.ghostHelperFunctions.getTransientHosts(transientName=[''], snCoord=[''], snClass=[''], verbose=False, starcut='normal', ascentMatch=False, GLADE=True, px=800, savepath='./', GHOSTpath='', redo_search=True)[source]
The wrapper function for the main host association pipeline. The function first

searches the pre-existing GHOST database by transient name, then by transient coordinates, and finally associates the remaining transients not found.

Parameters:
  • transientName (array-like) – List of transients to associate.

  • snCoord (array-like) – List of astropy SkyCoord transient positions.

  • snClass (array-like) – List of transient classifications (if they exist).

  • verbose (bool, optional) – If True, print logging information.

  • starcut (str) – Strings corresponding to the classification thresholds required to classify a star as such. Options are 'gentle' (P>0.8), normal (P>0.5), and aggressive (P>0.3).

  • ascentMatch (bool) – If True, run the gradient ascent algorithm for the transients not matched with the Directional Light Radius algorithm.

  • px (int) – Size of the image used in gradient ascent (ignored if ascentMatch=False).

  • savepath (str) – Filepath where dataframe of associated hosts will be saved.

  • GHOSTpath (str) – The path to the saved GHOST database.

  • redo_search (bool) – If True, redo the search with 150" cone search radius if hosts were not found for any of the queried transients.

Returns:

Final dataframe of associated transients and host galaxies.

Return type:

Pandas DataFrame

astro_ghost.ghostHelperFunctions.getTransientSpectra(path, transientName)[source]

Retrieves all saved spectra associated with a transient.

Parameters:
  • path (str) – Filepath to spectra.

  • transientName (str) – Name of transient to query.

Returns:

Saved spectra.

Return type:

list of Pandas DataFrames

astro_ghost.ghostHelperFunctions.getTransientStatsFromHostCoords(hostCoord)[source]
Prints basic statistics for transient,

based on a query of the coordinates of its host.

Parameters:

hostCoord (Astropy SkyCoord Object) – The position of the host galaxy.

astro_ghost.ghostHelperFunctions.getTransientStatsFromHostName(hostName)[source]
Returns basic statistics for transient,

based on a query of the name of its host.

Parameters:

hostName (str) – The name of the host galaxy.

astro_ghost.ghostHelperFunctions.remove_prefix(text, prefix)[source]

Removes the prefix from a string.

Very useful for removing the ‘SN’ from supernova names!

Parameters:
  • text (str) – The full text.

  • prefix (str) – The prefix to remove from the text.

Returns:

The input text, with prefix removed.

Return type:

str