astrobase.services.identifiers module

Easy conversion between survey identifiers. Works best on bright and/or famous objects, particularly when SIMBAD is involved.

simbad_to_gaiadr2(): given simbad name, attempt to get GAIA DR2 source_id

gaiadr2_to_tic(): given GAIA DR2 source_id, attempt to get TIC ID

simbad_to_tic(): given simbad name, get TIC ID

tic_to_gaiadr2(): given TIC ID, get GAIA DR2 source_id

astrobase.services.identifiers.simbad_to_gaiadr2(simbad_name, simbad_mirror='simbad', returnformat='csv', forcefetch=False, cachedir='~/.astrobase/simbad-cache', verbose=True, timeout=10.0, refresh=2.0, maxtimeout=90.0, maxtries=1, complete_query_later=True)[source]

Convenience function that, given a SIMBAD object name, returns string of the Gaia-DR2 identifier.

Parameters:
  • simbad_name (str) – The SIMBAD object name to search for.
  • simbad_mirror (str) – This is the key used to select a SIMBAD mirror from the SIMBAD_URLS dict above. If set, the specified mirror will be used. If None, a random mirror chosen from that dict will be used.
  • returnformat ({'csv','votable','json'}) – The returned file format to request from the GAIA catalog service.
  • forcefetch (bool) – If this is True, the query will be retried even if cached results for it exist.
  • cachedir (str) – This points to the directory where results will be downloaded.
  • verbose (bool) – If True, will indicate progress and warn of any issues.
  • timeout (float) – This sets the amount of time in seconds to wait for the service to respond to our initial request.
  • refresh (float) – This sets the amount of time in seconds to wait before checking if the result file is available. If the results file isn’t available after refresh seconds have elapsed, the function will wait for refresh seconds continuously, until maxtimeout is reached or the results file becomes available.
  • maxtimeout (float) – The maximum amount of time in seconds to wait for a result to become available after submitting our query request.
  • maxtries (int) – The maximum number of tries (across all mirrors tried) to make to either submit the request or download the results, before giving up.
  • complete_query_later (bool) – If set to True, a submitted query that does not return a result before maxtimeout has passed will be cancelled but its input request parameters and the result URL provided by the service will be saved. If this function is then called later with these same input request parameters, it will check if the query finally finished and a result is available. If so, will download the results instead of submitting a new query. If it’s not done yet, will start waiting for results again. To force launch a new query with the same request parameters, set the forcefetch kwarg to True.
Returns:

gaiadr2_id – Returns the GAIA DR2 ID as a string.

Return type:

str

astrobase.services.identifiers.gaiadr2_to_tic(source_id, gaia_mirror='heidelberg', gaia_data_release='dr2', returnformat='csv', forcefetch=False, cachedir='~/.astrobase/simbad-cache', verbose=True, timeout=10.0, refresh=2.0, maxtimeout=90.0, maxtries=1, complete_query_later=True)[source]

First, gets RA/dec from Gaia DR2, given source_id. Then searches TICv8 spatially, and returns matches with the correct DR2 source_id.

Parameters:
  • source_id (str) – The GAIA DR2 source identifier.
  • gaia_mirror ({'gaia','heidelberg','vizier'} or None) – This is the key used to select a GAIA catalog mirror from the GAIA_URLS dict above. If set, the specified mirror will be used. If None, a random mirror chosen from that dict will be used.
  • gaia_data_release ({'dr2', 'edr3'}) – The Gaia data release to use for the query. This provides hints for which table to use for the GAIA mirror being queried.
  • returnformat ({'csv','votable','json'}) – The returned file format to request from the GAIA catalog service.
  • forcefetch (bool) – If this is True, the query will be retried even if cached results for it exist.
  • cachedir (str) – This points to the directory where results will be downloaded.
  • verbose (bool) – If True, will indicate progress and warn of any issues.
  • timeout (float) – This sets the amount of time in seconds to wait for the service to respond to our initial request.
  • refresh (float) – This sets the amount of time in seconds to wait before checking if the result file is available. If the results file isn’t available after refresh seconds have elapsed, the function will wait for refresh seconds continuously, until maxtimeout is reached or the results file becomes available.
  • maxtimeout (float) – The maximum amount of time in seconds to wait for a result to become available after submitting our query request.
  • maxtries (int) – The maximum number of tries (across all mirrors tried) to make to either submit the request or download the results, before giving up.
  • completequerylater (bool) – If set to True, a submitted query that does not return a result before maxtimeout has passed will be cancelled but its input request parameters and the result URL provided by the service will be saved. If this function is then called later with these same input request parameters, it will check if the query finally finished and a result is available. If so, will download the results instead of submitting a new query. If it’s not done yet, will start waiting for results again. To force launch a new query with the same request parameters, set the forcefetch kwarg to True.
Returns:

tic_id – Returns the TIC ID of the object as a string.

Return type:

str

astrobase.services.identifiers.simbad_to_tic(simbad_name)[source]

This goes from a SIMBAD name to a TIC name.

Parameters:simbad_name (str) – The SIMBAD name of the object to look up the TIC ID for.
Returns:tic_id – Returns the TIC ID of the object as a string.
Return type:str
astrobase.services.identifiers.tic_to_gaiadr2(tic_id, raiseonfail=False)[source]

This goes from a TIC name to a GAIA DR2 source_id.

Parameters:tic_id (str) – The TIC ID to look for, e.g., “260265964”.
Returns:source_id – Returns the GAIA DR2 ID of the object as a string.
Return type:str