pyke
pyke copied to clipboard
Adding Cotrend Tutorial
Added a tutorial for CBVs on Tabby's star. It's pretty brief, maybe that's a good thing?
Is it ready for review?
@barentsen Yes please, it's a bit rough and I'm not sure it's what you wanted...? Early comments are much appreciated! :D Easier to read here.

import matplotlib.pyplot as plt
from tqdm import tqdm
from pyke import KeplerCBVCorrector
cbv = KeplerCBVCorrector("kplr008462852-2011073133259_llc.fits")
list_of_cbvs = []
for n in range(1, 16):
list_of_cbvs.append(range(1, n+1))
neg_log_likelihood = []
for cbvs in tqdm(list_of_cbvs):
cbv.correct(list(cbvs))
neg_log_likelihood.append(cbv.opt_result.fun)
n_cbvs = [len(list(list_of_cbvs[i])) for i in range(len(list_of_cbvs))]
plt.plot(n_cbvs, neg_log_likelihood, 'o-.')
plt.xlabel('Number of cbvs')
plt.ylabel('Negative Log Likelihood (Laplacian pdf)')
plt.title("CBV correction Tabby's Star Quarter 8")
plt.show()
Maybe this is going to be helpful to include in this tutorial?
cc @barentsen @christinahedges
Thanks for working on this! My main comments are:
-
Let's add a bunch more content and figures to explain what CBVs are. We can literally copy most of this from the "demystifying Kepler data" paper, which did an excellent job. It is fine to use content from that paper and make it more easily accessible by putting it in the sphinx docs.
-
I don't think Tabby's star is a good example to demo the CBV-based correction. The figures and appendices in the demystiying Kepler paper show much better examples, let's use/adapt/reproduce those!
-
I see there is both a
ipynband arstfile. Is one generated from the other? I think we should only have one source file or we'll end up editing the wrong one?
Yep, let's just use the .ipynb file. Sphinx automagically converts it into .rst for the doc page.
Also, perhaps would be more useful to use the recently added KeplerCBVCorrector class instead of the kepcotrend function?
-
Oh ok, let's remove the
rstfile from this PR in that case! (Though it's easier to give feedback on, so perhaps it is not a terrible idea to have therstfile in a PR during review and only remove it before merging!) -
Mixing command-line tools and Python code is going to be confusing for beginners. My proposal is to use only command-line tools in the tutorials, but end every tutorial with a section that says
"If you wanted to do the above in a Python script, here is the code:". Thoughts?