Skip to content

Commit

Permalink
Fix read_exoplanet_eu.
Browse files Browse the repository at this point in the history
  • Loading branch information
hpparvi committed Sep 1, 2024
1 parent 8e2f38a commit 9050f56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spright/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def read_tepcat(fname: Path, max_rel_r_err: float = 0.08, max_rel_m_err: float =
def read_exoplanet_eu(fname, max_rel_r_err: float = 0.08, max_rel_m_err: float = 0.25):
df = pd.read_csv(fname)
df.dropna(subset=['radius', 'radius_error_min', 'mass', 'mass_error_min', 'orbital_period'], inplace=True)
df = df[(df.planet_status == 'Confirmed') & (df.orbital_period < 10)]
df = df[(df.planet_status == 'Confirmed')]
r = (df.radius.values*R_jup).to(R_earth).value
rerr = (df[['radius_error_min', 'radius_error_max']].mean(1).values * R_jup).to(R_earth).value
m = (df.mass.values*M_jup).to(M_earth).value
merr = (df[['mass_error_min', 'mass_error_max']].mean(1).values * M_jup).to(M_earth).value
df = pd.DataFrame(transpose([df['System'].values, r, rerr, m, merr, df['Period(day)'], df.M_A, df.Teff, df.Teq]),
df = pd.DataFrame(transpose([df.name.values, r, rerr, m, merr, df.orbital_period, df.star_mass, df.star_teff, df.temp_calculated]),
columns='name r rerr m merr period mstar teff teq'.split())
df = df[(df.rerr/df.r < max_rel_r_err) & (df.merr/df.m < max_rel_m_err)]
return df

0 comments on commit 9050f56

Please sign in to comment.