[This notebook is for visualization purposes only. It shows you how the resulting figures should look like, but there's no code to generate them. Hence: don't run the notebook!]
Monitoring the flux of a star might reveal the presence of a exoplanets when the planet "transits" across the front of the start as seen from our perspective. It causes a reduction of the apparent brightness of the star, and conducting large monitoring programs for the transit method has become one of the most successful methods to detect exoplanets.
We will use a simple model to describe the transit signal: a symmetric trapezoid. While it is geometrically simple, it is a non-linear model, that means you canot write down a design matrix for it So we need a more general minimizer to fit any given data. By the end of this notebook you will have all you need to fit transit data.
In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import transit as tr
In [2]:
t,f = tr.read_data(7016.01)
In [3]:
# Inspect the first 10 elements of both t and f
print(t[:10])
print(f[:10])
In [4]:
tr.plot_data(7016.01);
In [5]:
pars = [0, 1.0, 0.2, 200] # t0 [center], T [duration], tau [ingress duration], depth
t,f = tr.read_data(7016.01)
plt.plot(t, tr.trapezoid(pars,t))
plt.ylim(-250,50)
Out[5]:
In [6]:
# Vary depth
depths = np.linspace(200,2000,10)
tr.vary_depth(depths); #plots a trapezoid for each depth, with default other parameters
In [7]:
# Vary duration
durations = np.linspace(0.5,1.5,10)
tr.vary_duration(durations);
In [8]:
# Vary tau
taus = np.linspace(0.05,0.5,10)
tr.vary_tau(taus);
In [9]:
# Vary t0
t0s = np.linspace(-0.5,0.5,10)
tr.vary_t0(t0s);
In [10]:
param_guess = [0, 0.8, 0.2, 200]
tr.plot_fit(7016.01, param_guess);
In [13]:
fit = tr.fit_trapezoid(7016.01, method='Nelder-Mead') #this uses scipy.optimize.minimize
fit
Out[13]:
In [12]:
tr.plot_fit(7016.01, fit.x);
In [ ]: