def sanity_exampleExoplanetEU2(self):
        """
      Example of ExoplanetEU2
    """
        from PyAstronomy import pyasl
        import matplotlib.pylab as plt

        # Instantiate exoplanetEU2 object
        v = pyasl.ExoplanetEU2()

        # Show the available data
        v.showAvailableData()
        print()

        # Get a list of all available column names
        acs = v.getColnames()
        print("Available column names: " + ", ".join(acs))
        print()

        # Select data by planet name (returns a dictionary)
        print(v.selectByPlanetName("CoRoT-2 b"))
        print()

        # Get all data as an astropy table
        at = v.getAllDataAPT()

        # Export all data as a pandas DataFrame
        pd = v.getAllDataPandas()

        # Plot mass vs. SMA
        plt.title("Mass vs. SMA")
        plt.xlabel("[" + v.getUnitOf("mass") + "]")
        plt.ylabel("[" + v.getUnitOf("semi_major_axis") + "]")
        plt.loglog(at["mass"], at["semi_major_axis"], 'b.')
def tick():
    print('Downloading exoplanetEU')
    df = pyasl.ExoplanetEU2(forceUpdate=True)
    df = df.getAllDataPandas()
    df['name'] = [
        s.decode() if isinstance(s, bytes) else s for s in df['name']
    ]
    df['star_name'] = [
        s.decode() if isinstance(s, bytes) else s for s in df['star_name']
    ]
    path = 'sweetercat/data/exoplanetEU.csv'
    df.to_csv(path, index=False)
    print('Saved as exoplanetEU.csv')
Exemple #3
0
from __future__ import division
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from PyAstronomy import pyasl

plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.top'] = False
plt.rcParams['axes.linewidth'] = 2
plt.rcParams['xtick.major.width'] = 2
plt.rcParams['ytick.major.width'] = 2

if __name__ == '__main__':
    df = pyasl.ExoplanetEU2().getAllDataPandas()
    rename = {
        'name': 'plName',
        'radius': 'plRadius',
        'orbital_period': 'period',
        'semi_major_axis': 'sma'
    }
    df.rename(columns=rename, inplace=True)
    idx = df['detection_type'] == 'Primary Transit'
    df = df[idx]

    plt.loglog(df['period'], df['plRadius'], '.', alpha=0.3)
    plt.xlabel('Period [days]')
    plt.ylabel(r'Planetary radius [R$_\mathrm{Jup}$]')

    plt.tight_layout()
        image = plt.imread(image)
    except TypeError:
        # Likely already an array...
        pass
    im = OffsetImage(image, zoom=zoom)
    x, y = np.atleast_1d(x, y)
    artists = []
    for x0, y0 in zip(x, y):
        ab = AnnotationBbox(im, (x0, y0), xycoords='data', frameon=False)
        artists.append(ax.add_artist(ab))
    ax.update_datalim(np.column_stack([x, y]))
    return artists


if __name__ == '__main__':
    df = pyasl.ExoplanetEU2(skipUpdate=True).getAllDataPandas()
    detectionTypes = {
        'Transit': ['Primary Transit', 2, 'C0'],
        'RV': ['Radial Velocity', 2, 'C1'],
        'Imaging': ['Imaging', 5, 'C5'],
        'Astrometry': ['Astrometry', 20, 'C3'],
        'TTV': ['TTV', 10, 'C2'],
        'Microlensing': ['Microlensing', 5, 'C4']
    }
    planets = {
        'mercury': [0.390, 0.00017, 0.02],
        # 'venus':   [0.723, 0.00256, 0.02],
        'earth': [1.000, 0.00315, 0.04],
        # 'mars':    [1.524, 0.00034, 0.01],
        'jupiter': [5.203, 1.00000, 0.03]
    }
Exemple #5
0
def load_db():
    """Load the database exoplanet.et as a DataFrame and return it.
    """
    return pyasl.ExoplanetEU2().getAllDataPandas()
 def get_planets():
     v = pyasl.ExoplanetEU2()
     return v.getAllDataPandas()