Exoplanet EU data

In [1]:
#basic plotting
import matplotlib.pyplot as plt
#This is my favorite way to deal with importing files
from astropy.io import ascii
#NumPy is the basic module for doing any kind of array manipulation
import numpy as np
#This imports modules which you will then call functions from
#First lets read in a file
dat = ascii.read('exoplanet.eu_catalog.csv')
In [2]:
#see what you can tell about the file you just read in
dir(dat)
#the columns that are in the data is useful to know
dat.colnames
Out[2]:
['name',
 'mass',
 'mass_error_min',
 'mass_error_max',
 'radius',
 'radius_error_min',
 'radius_error_max',
 'orbital_period',
 'orbital_period_err_min',
 'orbital_period_err_max',
 'semi_major_axis',
 'semi_major_axis_error_min',
 'semi_major_axis_error_max',
 'eccentricity',
 'eccentricity_error_min',
 'eccentricity_error_max',
 'angular_distance',
 'inclination',
 'inclination_error_min',
 'inclination_error_max',
 'tzero_tr',
 'tzero_tr_error_min',
 'tzero_tr_error_max',
 'tzero_tr_sec',
 'tzero_tr_sec_error_min',
 'tzero_tr_sec_error_max',
 'lambda_angle',
 'lambda_angle_error_min',
 'lambda_angle_error_max',
 'impact_parameter',
 'impact_parameter_error_min',
 'impact_parameter_error_max',
 'tzero_vr',
 'tzero_vr_error_min',
 'tzero_vr_error_max',
 'K',
 'K_error_min',
 'K_error_max',
 'temp_calculated',
 'temp_measured',
 'hot_point_lon',
 'albedo',
 'albedo_error_min',
 'albedo_error_max',
 'log_g',
 'publication_status',
 'discovered',
 'updated',
 'omega',
 'omega_error_min',
 'omega_error_max',
 'tperi',
 'tperi_error_min',
 'tperi_error_max',
 'detection_type',
 'mass_detection_type',
 'radius_detection_type',
 'alternate_names',
 'molecules',
 'star_name',
 'ra',
 'dec',
 'mag_v',
 'mag_i',
 'mag_j',
 'mag_h',
 'mag_k',
 'star_distance',
 'star_metallicity',
 'star_mass',
 'star_radius',
 'star_sp_type',
 'star_age',
 'star_teff',
 'star_detected_disc',
 'star_magnetic_field']
In [3]:
dir(dat)
Out[3]:
['Column',
 'ColumnClass',
 'MaskedColumn',
 'Row',
 'TableColumns',
 'TableFormatter',
 '__array__',
 '__bytes__',
 '__class__',
 '__copy__',
 '__deepcopy__',
 '__delattr__',
 '__delitem__',
 '__dict__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__getitem__',
 '__getstate__',
 '__gt__',
 '__hash__',
 '__init__',
 '__iter__',
 '__le__',
 '__len__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__next__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__setitem__',
 '__setstate__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__unicode__',
 '__weakref__',
 '_check_names_dtype',
 '_column_class',
 '_convert_string_dtype',
 '_data',
 '_init_from_cols',
 '_init_from_dict',
 '_init_from_list',
 '_init_from_ndarray',
 '_init_from_table',
 '_mask',
 '_masked',
 '_meta',
 '_new_from_slice',
 '_rebuild_table_column_views',
 '_repr_html_',
 '_set_masked',
 '_set_masked_from_cols',
 '_update_table_from_cols',
 'add_column',
 'add_columns',
 'add_row',
 'argsort',
 'colnames',
 'columns',
 'convert_bytestring_to_unicode',
 'convert_unicode_to_bytestring',
 'copy',
 'create_mask',
 'dtype',
 'field',
 'filled',
 'formatter',
 'group_by',
 'groups',
 'index_column',
 'keep_columns',
 'keys',
 'mask',
 'masked',
 'meta',
 'more',
 'next',
 'pformat',
 'pprint',
 'read',
 'remove_column',
 'remove_columns',
 'remove_row',
 'remove_rows',
 'rename_column',
 'reverse',
 'show_in_browser',
 'sort',
 'write']
In [4]:
#This just listed everything we can do to this object and 
#the data columns we can call
#e.g.
dat['star_radius']
Out[4]:
<MaskedColumn name='star_radius' unit=None format=None description=None>
masked_BaseColumn(data = [19.0 24.08 11.0 ..., 1.631 1.631 1.631],
                  mask = [False False False ..., False False False],
            fill_value = 1e+20)
In [5]:
#Don't worry about fill and mask vlues for now
#First let us make a simple plot
plt.scatter(dat['star_metallicity'],dat['star_age'],color='black')
plt.xlabel(u'[Fe/H]')
plt.ylabel(u'Age (Gyr)')
plt.title('Exoplanet Host Stars')
Out[5]:
<matplotlib.text.Text at 0x7f4f39022950>
In [6]:
#A slightly more interesting plot might be
plt.scatter((dat['orbital_period']/365.25)**2.,dat['semi_major_axis']**3.,color='black')
plt.xlabel(u'P^2 (years)')
plt.ylabel(u'A^3 (AU)')
plt.xlim([0.,5.])
plt.ylim([0.,5.])
Out[6]:
(0.0, 5.0)
In [8]:
#Interesting looks like a line (I wonder why)
plt.scatter((dat['orbital_period']/365.25)**2.,dat['semi_major_axis']**3.,color='black')
plt.xlabel(u'P^2 (years)',fontsize=18)
plt.ylabel(u'A^3 (AU)',fontsize=18)
plt.xlim([0.,5.])
plt.ylim([0.,5.])
x = np.arange(6) # counts for 0 to 5 increasing by 1
plt.plot(x,x,color='red',linewidth=3)
Out[8]:
[<matplotlib.lines.Line2D at 0x7f4f38e74790>]