Package ivs :: Package catalogs :: Module crossmatch
[hide private]
[frames] | no frames]

Module crossmatch

source code

Crossmatch catalogs for data on one target, or crossmatch entire catalogs.

This module is callable from the command line. E.g., simply type:

   $:> python crossmatch.py get_photometry ID=HD180642

or ask for help on any function:

   $:> python crossmatch.py get_photometry --help
Functions [hide private]
record array
get_photometry(ID=None, to_units='erg/s/cm2/AA', extra_fields=[], include=None, exclude=None, **kwargs)
Collect photometry from different sources.
source code
numpy record array
add_bibcodes(master)
Add bibcodes to a master record.
source code
 
make_bibtex(master, filename)
Make a bib file from a master record
source code
 
xmatch(coords1, coords2)
Crossmatch two sets of coordinates.
source code
 
photometry2str(master)
String representation of master record array
source code
Variables [hide private]
  logger = logging.getLogger("CAT.XMATCH")
Function Details [hide private]

get_photometry(ID=None, to_units='erg/s/cm2/AA', extra_fields=[], include=None, exclude=None, **kwargs)

source code 

Collect photometry from different sources.

The output consists of a record array containing the following keys:

'meas': the measurement's value directly from the catalog in original units 'e_meas': the error on the measurements 'flag': any flags that are associated with the measurement in a catalog 'unit': the unit of the original measurement 'source' the source catalog's name 'photband': photometric pass bands' name 'cwave': the effective wavelength of the passband 'cmeas': converted measurement (to to_units) 'e_cmeas': error on converted measurment 'cunit': converted unit

Be aware that some of the values can be 'nan': e.g. sometimes no error is listed in the catalog, or no flag. Also the 'cwave' column will be nan for all photometric colours (e.g. B-V)

If you define extra_fields, make sure all the {get_photometry} know how to handle it: probably some default values need to be inserted if these extra columns are not available in some catalog. It is safest just to leave it blank.

You can include or exclude search sources via include and exclude. When given, these should be a list containing strings. The default is to include gator, vizier and gcpd.

Extra keyword arguments are passed to each get_photometry functions in this package's modules.

Example usage:

  1. You want to download all available photometry and write the results to an ASCII file for later reference.
    >>> master = get_photometry('vega')
    >>> ascii.write_array(master,header=True,auto_width=True)
  2. You want to plot the raw, unmodelled SED of an object:
    >>> master = get_photometry('vega')
    >>> pl.errorbar(master['cwave'],master['cmeas'],yerr=master['e_cmeas'],fmt='ko')
    >>> pl.gca().set_xscale('log',nonposx='clip')
    >>> pl.gca().set_yscale('log',nonposy='clip')

We made no difference between colors (B-V) and magnitude (V), because the 'cwave' for colors is 'nan', so they will not be plotted anyway.The final two lines are just to correct errorbars that go below zero in a logarithmic plot.

Parameters:
  • ID (str) - the target's name, understandable by SIMBAD
  • to_units () - units to convert everything to.
  • include (list of strings (from gator, vizier or gcpd)) - sources to include
  • exclude (list of strings (from gator, vizier or gcpd)) - sources to include
Returns: record array
record array where eacht entry is a photometric measurement

add_bibcodes(master)

source code 

Add bibcodes to a master record.

Parameters:
  • master (numpy record array) - master record of photometry
Returns: numpy record array
master record of photometry with additional column

photometry2str(master)

source code 

String representation of master record array

Parameters:
  • master (numpy record array) - master record array containing photometry