### Install via PyPI Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/user/install.md Installs the most recently released version of the tool via PyPI. ```bash pip install triceratops ``` -------------------------------- ### Install in a conda environment Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/user/install.md Creates and activates a new conda environment, then installs the tool and jupyterlab. ```bash conda create -n myenv python=3.8 conda activate myenv pip install triceratops jupyterlab ``` -------------------------------- ### Example initialization Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/kepler_example.ipynb This code snippet demonstrates how to initialize and use the .calc_prob method. ```python import numpy as np from triceratops.triceratops import Triceratops # Example data (replace with your actual data) time = np.linspace(0, 1, 100) # Example time in days flux_0 = np.ones(100) # Example normalized flux flux_err_0 = np.full(100, 0.01) # Example flux error P_orb = 1.5 # Example orbital period in days triceratops_instance = Triceratops() probabilities = triceratops_instance.calc_prob(time, flux_0, flux_err_0, P_orb) print(probabilities) ``` -------------------------------- ### Installation Source: https://github.com/stevengiacalone/triceratops/blob/master/README.rst You can install the most recently released version of this tool via PyPI. ```bash $ pip install triceratops ``` -------------------------------- ### Example Data and Method Call Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/example.ipynb Shows example data that might be used with the calc_prob method and the method signature. ```python 20 NaN NaN NaN 169.752 222.255 1.765258e-21 21 NaN NaN 0.089077 172.176 124.825 4.631424e-20 22 NaN NaN NaN 185.052 303.511 4.447183e-26 23 0.496960 5080.0 0.683115 190.431 134.474 3.037689e-24 24 NaN 3583.0 0.907077 193.543 311.921 2.707183e-27 25 NaN NaN NaN 202.347 307.577 1.995252e-30 tdepth 0 0.005007 1 0.000000 2 0.000000 3 0.000000 4 0.000000 5 0.000000 6 0.000000 7 0.000000 8 0.000000 9 0.000000 10 0.000000 11 0.000000 12 0.000000 13 0.000000 14 0.000000 15 0.000000 16 0.000000 17 0.000000 18 0.000000 19 0.000000 20 0.000000 21 0.000000 22 0.000000 23 0.000000 24 0.000000 25 0.000000 ``` -------------------------------- ### Example Data Output Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/example.ipynb This snippet shows a sample output from a data processing step. ```text 28 0.762538 184.552 73.669 1.345936e-22 0.000000 29 0.802713 196.897 151.108 5.313263e-24 0.000000 30 0.194394 198.877 192.424 1.544053e-25 0.000000 31 1.127660 200.705 343.072 1.367531e-23 0.000000 ``` -------------------------------- ### Plot Transit Fits Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/kepler_example.ipynb Plots the transit fits for each scenario. ```python target.plot_fits(time=lc.time.value, flux_0=lc.flux.value, flux_err_0=np.mean(lc.flux_err.value)) ``` -------------------------------- ### Read in the light curve Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/example.ipynb Reads a CSV light curve file and initializes a TessLightCurve object. ```python lc = pd.read_csv("TOI465_01_lightcurve.csv", header=None) time, flux, flux_err = lc[0].values, lc[1].values, lc[2].values P_orb = 3.836169 lc_binsize = (time.max()-time.min())/100 lc = TessLightCurve(time=time, flux=flux, flux_err=flux_err).bin(time_bin_size=lc_binsize) target.calc_probs(time=lc.time.value, flux_0=lc.flux.value, flux_err_0=np.mean(lc.flux_err.value), P_orb=P_orb) ``` -------------------------------- ### Initialize target object Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/example.ipynb Initializes the target object with the star's ID and the sectors it was observed in. ```python ID = 100990000 sectors = np.array([3,4]) target = tr.target(ID=ID, sectors=sectors) ``` -------------------------------- ### Calculate Probabilities Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/kepler_example.ipynb Calculates transit, eclipse, and other scenario probabilities using the light curve data. ```python target.calc_probs(time=lc.time.value, flux_0=lc.flux.value, flux_err_0=np.mean(lc.flux_err.value), P_orb=P_orb, parallel=True) ``` -------------------------------- ### Calculate Probability Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/kepler_example.ipynb This code snippet shows how to calculate the probability using the .calc_prob method. ```python tdepth 0 0.00019 1 0.00000 2 0.00000 3 0.00000 4 0.00000 5 0.00000 ``` ```python After doing this, we can calculate the probability of each scenario using the .calc_prob(time, flux_0, flux_err_0, P_orb) method, which requires as arguments time (times from phase-folded light curve in units of days from transit center), flux_0 (normalized flux from phase-folded light curve), flux_err_0 (flux error values of the target's phase-folded light curve), and P_orb (orbital period of the TOI in days). ``` -------------------------------- ### Help - Create Conda Environment Source: https://github.com/stevengiacalone/triceratops/blob/master/README.rst If you are having trouble getting triceratops working on your machine, I recommend installing it in a fresh conda environment. You can download the latest distribution of anaconda here. After doing so, run the following in terminal: ```bash $ conda create -n myenv python=3.8 $ conda activate myenv (myenv) $ pip install triceratops jupyterlab ``` -------------------------------- ### Load and plot initial light curve data Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/TSCIII_tutorial.ipynb Loads the folded TESS light curve data from a CSV file and plots it. ```python lc = pd.read_csv("TOI1228_folded_lightcurve.csv") t = lc.x_fold.values y = lc.y.values + 1 plt.scatter(t, y, marker='.') plt.xlabel("Time from Transit Midpoint (days)", fontsize=14) plt.ylabel("Normalized Flux", fontsize=14) plt.show() ``` -------------------------------- ### Import necessary libraries Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/TSCIII_tutorial.ipynb Imports the required Python libraries for data manipulation, light curve analysis, and TRICERATOPS. ```python import numpy as np import pandas as pd import time from lightkurve import TessLightCurve import matplotlib.pyplot as plt %matplotlib inline import triceratops.triceratops as tr ``` -------------------------------- ### Example Data Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/example.ipynb A sample of tabular data with NaN values and scientific notation. ```text 20 NaN NaN NaN 169.752 222.255 1.765258e-21 21 NaN NaN 0.089077 172.176 124.825 4.631424e-20 22 NaN NaN NaN 185.052 303.511 4.447183e-26 23 0.496960 5080.0 0.683115 190.431 134.474 3.037689e-24 24 NaN 3583.0 0.907077 193.543 311.921 2.707183e-27 25 NaN NaN NaN 202.347 307.577 1.995252e-30 tdepth 0 0.005007 1 0.000000 2 0.000000 3 0.000000 4 0.000000 5 0.000000 6 0.000000 7 0.000000 8 0.000000 9 0.000000 10 0.000000 11 0.000000 12 0.000000 13 0.000000 14 0.000000 15 0.000000 16 0.000000 17 0.000000 18 0.000000 19 0.000000 20 0.000000 21 0.000000 22 0.000000 23 0.000000 24 0.000000 25 0.000000 ``` -------------------------------- ### Import necessary libraries Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/kepler_example.ipynb Imports the required libraries for the TRICERATOPS analysis, including numpy, pandas, lightkurve, sys, matplotlib, and triceratops. ```python import numpy as np import pandas as pd import time from lightkurve import KeplerLightCurve import sys import matplotlib.pyplot as plt %matplotlib inline import triceratops.triceratops as tr import warnings warnings.filterwarnings('ignore') ``` -------------------------------- ### Load contrast curve data Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/TSCIII_tutorial.ipynb Loads the speckle contrast curve data from a table file. ```python cc = pd.read_csv("TOI1228_cc.tbl", header=None) cc ``` -------------------------------- ### Display Scenario Probabilities Source: https://github.com/stevengiacalone/triceratops/blob/master/examples/TSCIII_tutorial.ipynb Prints a table containing the relative probability of each scenario, including parameters like stellar mass (M_s), stellar radius (R_s), orbital period (P_orb), inclination (inc), impact parameter (b), eccentricity (ecc), argument of periastron (w), planetary radius (R_p), companion stellar mass (M_EB), companion stellar radius (R_EB), and probability (prob). ```python target.probs ``` -------------------------------- ### Deactivate conda environment Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/user/install.md Exits the current conda environment. ```bash conda deactivate ``` -------------------------------- ### Calculate Probabilities Source: https://github.com/stevengiacalone/triceratops/blob/master/docs/tutorials/kepler_example.ipynb Calculates the probabilities for different scenarios (TP, EB, EBx2P, etc.) using the calc_probs method. ```python %%time target.calc_probs(time=lc.time.value, flux_0=lc.flux.value, flux_err_0=np.mean(lc.flux_err.value), P_orb=P_orb, parallel=True) ```