diff --git a/Computing TESS RV Semi-Amplitudes.py b/Computing TESS RV Semi-Amplitudes.py new file mode 100644 index 0000000..60ad95e --- /dev/null +++ b/Computing TESS RV Semi-Amplitudes.py @@ -0,0 +1,45 @@ +import requests +url = 'https://exofop.ipac.caltech.edu/tess/download_toi.php?sort=toi&output=csv' +r = requests.get(url, allow_redirects=True) +open('All Rows (CSV)', 'wb').write(r.content) #this downloads and saves the file to wherever this notebook is saved +r.status_code #200 means the request was successful, 404 indicates an unsuccessful request + +import pandas as pd +pd.set_option('display.max_columns', 100) +data = pd.read_csv("All Rows (CSV)") +exofop = pd.DataFrame(data) + +#make sure you have astroquery pip installed before running this code + +#Need to import stellar mass values from other source +#import astroquery.mast catalogs +from astroquery.mast import Catalogs +#Make list of TIC IDs to pull from the catalog +TICID_list = (exofop['TIC ID']).tolist() +#pull the data for the TIC ID's that are also in EXOFOP +catalog_data = Catalogs.query_criteria(catalog='Tic',objType='STAR', ID = TICID_list) +#Turn it into panda df +catalog_data_df = catalog_data.to_pandas() +#Only pull the masses and IDs since that's all I need +catalog_data_df2 = catalog_data_df[['ID','mass']] + +OP = exofop['Period (days)'] +M_sol = catalog_data_df2['mass'] +#assume e = 0 +#sin(i) = 1 +#M2 = 1/317.8 +#M1 >> M2 +RV = 28.4329 * (1/317.8) * (M_sol)**(-2/3) * (OP / 365.25)**(-1/3) + +import matplotlib.pyplot as plt +import numpy as np +plt.figure(figsize = (8, 8)) +plt.hist(RV[np.isfinite(RV)], color = 'green', bins = np.linspace(0, 1, 50)) +plt.axvline(x=.3, color = 'red', linestyle = '--', label = 'representative detection limit') +plt.legend(fontsize = 14) +plt.xlabel('RV Semi-Amplitude (m/s)', fontsize = 15) +plt.ylabel('Count', fontsize = 15) +plt.ylim(0, 110) +plt.tick_params(labelsize = 12) +plt.title('TOI RV Semi-Amplitude Distribution', fontsize = 18) +plt.savefig('TOI Semi-Amplitude Distribution.png') \ No newline at end of file diff --git a/ExoFop Plots.py b/ExoFop Plots.py new file mode 100644 index 0000000..4dd44ce --- /dev/null +++ b/ExoFop Plots.py @@ -0,0 +1,51 @@ +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + +data = pd.read_csv("exofop_tess_tois.csv") +exofop = pd.DataFrame(data) +#print(exofop) +exofop + +Period = exofop["Period (days)"] +P_Radius = exofop["Planet Radius (R_Earth)"] +Distance = (Period / 365.25)**(2/3) + +plt.plot(Period, Distance, 'r.') +plt.xlabel("Period (Days)") +plt.ylabel("Distance (AU)") + +plt.plot(Period, P_Radius, 'r.') +plt.xlabel("Period (Days)") +plt.ylabel("Planetary Radius (R_Earth)") +plt.xscale("log") +plt.yscale("log") + +App_Mag = exofop["TESS mag"] + +plt.plot(P_Radius, App_Mag, 'b.') +plt.xlabel("Planetary Radius (R_Earth)") +plt.ylabel("Apparent Magnitude (from TESS)") + +S_Radius = exofop["Stellar Radius (R_Sun)"] +plt.plot(S_Radius, App_Mag, 'b.') +plt.xlabel("Stellar Radius (R_Sun)") +plt.ylabel("Apparent Magnitude (from TESS)") + +Stellar_D = exofop["Stellar Distance (pc)"] +Stellar_Mag = App_Mag - 5*np.log10(Stellar_D) + 5 + +plt.plot(P_Radius, Stellar_Mag, 'g.') +plt.xlabel("Planetary Radius (R_Earth)") +plt.ylabel("Stellar Magnitude (Absolute)") + +plt.plot(S_Radius, Stellar_Mag, 'g.') +plt.xlabel("Stellar Radius (R_Sun)") +plt.ylabel("Stellar Magnitude (Absolute)") + +P_Insol = exofop["Planet Insolation (Earth flux)"] +P_Eq_Temp = exofop["Planet Eq Temp (K)"] + +plt.plot(P_Insol, P_Eq_Temp, 'r.') +plt.xlabel("Planet Insolation (Earth Flux)") +plt.ylabel ("Planet Eq Temperature (K)") \ No newline at end of file diff --git a/Finding Habitable TOI's.py b/Finding Habitable TOI's.py new file mode 100644 index 0000000..133b181 --- /dev/null +++ b/Finding Habitable TOI's.py @@ -0,0 +1,34 @@ +import requests +url = 'https://exofop.ipac.caltech.edu/tess/download_toi.php?sort=toi&output=csv' +r = requests.get(url, allow_redirects=True) +open('All Rows (CSV)', 'wb').write(r.content) #this downloads and saves the file to wherever this notebook is saved +r.status_code #200 means the request was successful, 404 indicates an unsuccessful request + +import pandas as pd +pd.set_option('display.max_columns', 100) +data = pd.read_csv("All Rows (CSV)") +exofop = pd.DataFrame(data) + +#Planets with insolation flux 0.5-1.5 earth flux +P_Insol = exofop['Planet Insolation (Earth Flux)'] +exofop.loc[(P_Insol >= 0.5) & (P_Insol <= 1.5)] + +#Planets with an earth radius of 0.5-2.5 +P_Rad = exofop['Planet Radius (R_Earth)'] +exofop.loc[(E_Rad >= 0.5) & (E_Rad <= 2.5)] + +#Planets with both conditions +exofop.loc[(P_Insol >= 0.5) & (P_Insol <= 1.5) & (P_Rad >= 0.5) & (P_Rad <= 2.5)] + +#Zink and Hansen (2019) parameters +Sol_Rad = exofop['Stellar Radius (R_Sun)'] +Log = exofop['Stellar log(g) (cm/s^2)'] +Depth = exofop['Depth (ppm)'] +Temp = exofop['Stellar Eff Temp (K)'] +OP = exofop['Period (days)'] +#Semimajor axis constraint will be applied via an approximation of Kepller's 3rd law (p**2 = a**3) +#Period: p = (0.95**3)**0.5 = 0.926 years = 338 days, p = (1.68**3)**0.5 = 2.18 years = 795 days +exofop.loc[(Temp >= 4200) & (Temp <= 6100) & (Sol_Rad <= 2) & (Log >= 4) & (Depth <= 1000) & (P_Rad >= 0.72) & (P_Rad <= 1.7) & (OP >= 338) & (OP <= 795)] + +#Hsu et al (2020) parameters +exofop.loc[(P_Rad >= 0.75) & (P_Rad <= 1.5) & (Sol_Rad >= 0.75) & (OP >= 237) & (OP <= 500)] diff --git a/Web Scrape Test Run.py b/Web Scrape Test Run.py new file mode 100644 index 0000000..bb0ad28 --- /dev/null +++ b/Web Scrape Test Run.py @@ -0,0 +1,12 @@ + +import requests +url = 'https://exofop.ipac.caltech.edu/tess/download_toi.php?sort=toi&output=csv' +r = requests.get(url, allow_redirects=True) +open('All Rows (CSV)', 'wb').write(r.content) #this downloads and saves the file to wherever this notebook is saved +r.status_code #200 means the request was successful, 404 indicates an unsuccessful request + +import pandas as pd +pd.set_option('display.max_columns', 100) +data = pd.read_csv("All Rows (CSV)") +exofop = pd.DataFrame(data) +exofop \ No newline at end of file