Skip to content

Instantly share code, notes, and snippets.

@bmorris3
Created August 11, 2014 23:12
Show Gist options
  • Save bmorris3/159e8e51f45aceb975a2 to your computer and use it in GitHub Desktop.
Save bmorris3/159e8e51f45aceb975a2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:e9fceeb8a60907cd3f2531962cb760ca3b433c977e979498e589c92e905391d8"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Eclipses of KIC 9652632\n",
"\n",
"Using the mid-eclipse time and period from the [Villanova Eclipsing Binary Catalog](http://keplerebs.villanova.edu/), we compute all eclipses in the range Aug 25 - Sept 8 UT."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"from astropy.time import Time\n",
"\n",
"villa_t0 = 2454955.175512\n",
"period = 4.977624\n",
"\n",
"# Convert UT times to JD\n",
"startdate = Time('2014-08-25 00:00:00', format='iso', scale='utc').jd\n",
"enddate = Time('2014-09-08 00:00:00', format='iso', scale='utc').jd\n",
"\n",
"# Calculate times of eclipses\n",
"primaryeclipses = villa_t0 + period*np.arange(1000)\n",
"secondaryeclipses = villa_t0 + period*np.arange(1000) + 0.5*period\n",
"\n",
"print 'Propogated forward enough?', enddate < max(primaryeclipses), enddate < max(secondaryeclipses)\n",
"\n",
"primariesinrange = (primaryeclipses < enddate)*(primaryeclipses > startdate)\n",
"secondariesinrange = (secondaryeclipses < enddate)*(secondaryeclipses > startdate)\n",
"\n",
"print '\\nPrimaries in date range: ',sum(primariesinrange)\n",
"print 'Primary eclipse times (UT):\\n', '\\n'.join([Time(eclipse, format='jd',scale='utc').iso for \\\n",
" eclipse in primaryeclipses[primariesinrange]])\n",
"\n",
"\n",
"print '\\nSecondaries in date range: ',sum(secondariesinrange)\n",
"print 'Secondary eclipse times (UT):\\n', '\\n'.join([Time(eclipse, format='jd',scale='utc').iso for \\\n",
" eclipse in secondaryeclipses[secondariesinrange]])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Propogated forward enough? True True\n",
"\n",
"Primaries in date range: 3\n",
"Primary eclipse times (UT):\n",
"2014-08-26 22:46:22.541\n",
"2014-08-31 22:14:09.254\n",
"2014-09-05 21:41:55.968\n",
"\n",
"Secondaries in date range: 2\n",
"Secondary eclipse times (UT):\n",
"2014-08-29 10:30:15.898\n",
"2014-09-03 09:58:02.611\n"
]
}
],
"prompt_number": 26
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment