Open Exoplanet Catalogue(astroquery.open_exoplanet_catalogue)

Getting started

This module gives easy access to the open exoplanet catalogue in the form of an XML element tree.

To start import the catalog and generate the catalogue.

from astroquery import open_exoplanet_catalogue as oec
from astroquery.open_exoplanet_catalogue import findvalue

# getting the catalogue from the default remote source
cata = oec.get_catalogue()

# getting the catalogue from a local path
cata = oec.get_catalogue("path/to/file/systems.xml.gz")

Examples

First import the module and generate the catalogue. The findvalue function provides a simple method of getting values from Elements.

from astroquery import open_exoplanet_catalogue as oec
from astroquery.open_exoplanet_catalogue import findvalue

cata = oec.get_catalogue()

Prints all planets and their masses.

for planet in oec.findall(".//planet"):
    print(findvalue(planet, 'name'), findvalue(planet, 'mass'))

Prints all of the planets with known mass around stars of known mass in a machine readable format.

for star in oec.findall(".//star[mass]"):
    for planet in star.findall(".//planet[mass]"):
        print(findvalue(planet, 'mass').machine_readable(), findvalue(star, 'mass').machine_readable())

Print all the names of stars in binaries.

for star in oec.findall(".//binary/star"):
    print(findvalue(star, 'name'))

Prints all the planet names and period of planets around binaries

for planet in oec.findall(".//binary/planet"):
    print(findvalue( planet, 'name'), findvalue( planet, 'period'))

Prints the name, radius and mass of the planet Kepler-68 b.

planet = oec.find(".//planet[name='Kepler-68 b']")
print(findvalue( planet, 'name'), findvalue(planet, 'radius'), findvalue(planet, 'mass'))

Prints the name and radius of planets with a radius greater than 1 jupiter radius.

for planet in oec.findall(".//planet[radius]"):
    if findvalue(planet, 'radius') > 1:
        print(findvalue( planet, 'name'), findvalue( planet, 'radius'))

Prints the names of the planets around a single star in a binary.

for binary in oec.findall(".//binary/star/planet"):
    print(findvalue( binary, 'name'))

Prints a ratio of star and planet mass.

for star in oec.findall(".//star[mass]/planet[mass].."):
    if findvalue(star, 'mass') != None:
        for planet in star.findall(".//planet"):
            if findvalue(planet, 'mass') != None:
                print(findvalue( star, 'name'), findvalue( planet, 'name'), "Ratio:", findvalue( star, 'mass')/findvalue( planet, 'mass'))

Prints planets whose mass has an upper limit

for planet in oec.findall(".//planet/mass[@upperlimit].."):
    print(findvalue( planet, 'name'), findvalue(planet, 'mass'))

Prints all stars with the number of planets orbiting them

for star in oec.findall(".//star[planet]"):
    print(findvalue( star, 'name'), len(star.findall(".//planet")))

Prints all the properties of Kepler-20 b.

for properties in oec.findall(".//planet[name='Kepler-20 b']/*"):
    print("\t" + properties.tag + ":", properties.text)

Prints the right ascension and declination of systems with planets of known mass.

for systems in oec.findall(".//system[declination][rightascension]"):
    for planet in systems.findall(".//planet[mass]"):
        print(findvalue( systems, 'name'), findvalue( systems, 'rightascension'), findvalue( systems, 'declination'), findvalue( planet, 'mass'))

Prints the names of rogue planets.

for planets in oec.findall(".//system/planet"):
    print(findvalue( planets, 'name'))

Reference/API

astroquery.open_exoplanet_catalogue Package

Access to the Open Exoplanet Catalogue. Hanno Rein 2013

https://github.com/hannorein/open_exoplanet_catalogue https://github.com/hannorein/oec_meta http://openexoplanetcatalogue.com

Functions

xml_element_to_dict(e)

Creates a dictionary of the given xml tree.

findvalue(element, searchstring)

Searches given string in element.

get_catalogue([filepath])

Parses the Open Exoplanet Catalogue file.

To contribute to the open exoplanet catalogue, fork the project on github! https://github.com/OpenExoplanetCatalogue/open_exoplanet_catalogue