# Transit/eclipse prediction charts¶

Contents:

Routines to make a chart of upcoming transit events. The main function to call is transitChart(), which has an example in its documentation. A fully automated chart-maker can be found in makeCharts()

REQUIREMENTS: PyEphem – http://rhodesmill.org/pyephem/ Numpy – http://numpy.org/ Numerical analysis routines – For importing planet-class objects. http://var2.astro.cz/EN/tresca/index.php Print uncertainties in ephemeris when they’re sufficiently large

2010-10-11 23:06 IJC: Updated with La Palma location.

2010-03-23 09:37 IJC: Written by IJC to duplicate Josh Winn’s page @ MIT.

2011-08-09 13:21 IJMC: Copied over jd2gd() and gd2jd().

2011-09-30 11:01 IJMC: Added moon separation.

transittime.gd2jd(datestr)[source]
Convert a string Gregorian date into a Julian date using Pylab.
If no time is given (i.e., only a date), then noon is assumed. Timezones can be given, but UTC is assumed otherwise.
EXAMPLES: ```print gd2jd('Aug 11 2007') #---------------> 2454324.5 print gd2jd('Aug 11 2007, 12:00 PST') #-----> 2454324.29167 print gd2jd('12:00 PM, January 1, 2000') #--> 2451545.0 ``` matplotlib jd2gd()
transittime.getAirmassAndSunAlt(jd, target, obs)[source]

Return airmass and sun altitude at a set of times. INPUTS:

JD – a sequence of times target – an ephem.star-class object obs – an ephem.Observer-class object

Objects w/airmass>9.99 (or below the horizon) are set to 9.99

transittime.getMoonAngle(jd, target, obs)[source]

Returns the angle between a target and the moon (in radians).

INPUTS: jd : float or 1D numpy array Julian Dates of times target : ephem.star target being observed obs : ephem.Observer observatory with latitude, longitude, and elevation set
transittime.getPerimeter(a, ecc)[source]

Compute perimeter of an ellipse given its semimajor axis and eccentricity. This is only accurate to a few percent.

transittime.getTransitDuration(p)[source]

Compute duration of transit, in days. Units of inputs should be:

depth – (none)

a – AU

ecc– (none)

P – days

inc– degrees

transittime.getTransitTimes(planet, *arg, **kw)[source]

If no arguments passes, get info for the next 10 transits. If one (Julian) Date entered, print transits until that date. If two (Julian) Dates entered, print transits between those dates.

If keyword eclipse==True, get the Eclipse times instead.

transittime.isGoodPlanet(planet)[source]

Check if planet object has the necessary fields, and that they are non-empty.

transittime.jd2gd(juldat)[source]
Convert a numerial Julian date into a Gregorian date using Pylab.
Timezone returned will be UTC.
EXAMPLES: ```print jd2gd(2454324.5) #--> 2007-08-12 00:00:00 print jd2gd(2451545) #--> 2000-01-01 12:00:00 ``` gd2jd()
transittime.makeCharts(path='/Users/ianc/temp/', obs=['lick', 'keck', 'cerropachon'], eclipse=[True, False], months=18, clobber=False, kw=None, planet_names=None)[source]

Make transit charts for specified observatories for all planets.

OPTIONS: path : str directory in which to write text output obs : list of str observatories, acceptable to transitChart() eclipse : list of bool whether to compute eclipses (if True) or transits (if False). Note that eclipse predictions assume circular orbits! months : int Number of (31-day) months from present date for computations clobber : bool If true, overwrite file if it already exists. Otherwise, don’t. kw : dict or None dict of keywords to pass to transitChart() planet_names : None or list of planet objects Planets for which table should be constructed. If “none”, do it for all planets in the database. Numerical analysis routines, datetime, os transitChart()
transittime.nextEclipse(planet, jd=None, dt0=0.0)[source]

Return JD of the next eclipse of a planet after a given JD. If jd==None, the current date is used.

Note that this only works for planets on circular orbits – eccentric orbits will be given an incorrect Eclipse time!

transittime.nextTransit(planet, jd=None, dt0=0.0)[source]

Return JD of the next transit of a planet after a given JD. If jd==None, the current date is used.

transittime.transitChart(planets, date1, date2, obs='lick', airmax=2.5, twilight=12, tpad=1, cutoff=3, eclipse=False, delim=' ', chron=False, dt0=0.0)[source]
INPUTS: planets : objects with the following fields: .per (period/days) .tt (transit ephemeris, JD) .t14 (transit duration, days) .ra_string (string; RA of target in hh:mm:ss) .dec_string (string; Dec of target in dd:mm:ss) date1, date2 : str Date strings (e.g., of the form “YYYY-MM-DD”) bracketing the timespan for which transits/eclipses will be calculated. obs : str ‘lick’ or ‘keck’ or ‘lapalma’ or ‘mtgraham’ or ‘mtbigelow’ or ‘andersonmesa’ or ‘kpno’ or ‘ctio’ or ‘cerropachon’ or ‘palomar’ or ‘cerroparanal’ or ‘lasilla’ or ‘calaralto’ or ‘lascampanas’ airmax : float Maximum acceptable airmass twilight : float Minimum acceptable angular distance of sun below horizon, in degrees. tpad : float Number of hours by which ingress and egress should be padded cutoff : int Minimum number of acceptable “observational checkpoints.” Valid values are 0-5, inclusive. A value of “5” will only show fully visible transits (pre-ingress, ingress, mid-transit, egress, post-egress), “0” will show ALL transits (even, e.g., those during daylight), and intermediate values will show fully visible transits and some number of partial transits. eclipse : bool If True, compute times of eclipses, not of transits. Note that eclipse times are all computed assuming circular orbits! delim : str Character(s) used to delimit the output text table chron : bool If True, sort all computed events (for ALL planets considered) by mid-event time. If False, events will be listed separately for each planet. dt0 : float Number of days by which to shift transit center time: a “fudge factor.” A positive value here means that the output text table will show events occuring later than the ‘.tt’ field of the planet object would otherwise indicate. Leave this set to “zero” unless you have a good reason to do otherwise! ```import transittime as tt class planet: # Simplest valid planet class def __init__(self): return p = planet() p.per = 1.58040482 p.tt, p.t14 = 2454980.7487955, 0.03661806 p.ra_string, p.dec_string = '17:15:18.94', '04:57:49.70' p.name = 'GJ 1214 b' text = tt.transitChart(p, '2013-01-01','2013-12-31') ``` ```import analysis as an # requires :doc:`analysis` import transittime as tt from numpy import array planet_names = an.getobj() all_planets = map(an.getobj, planet_names) transit_flag = array([p.transit==1 for p in all_planets]) transiters = array(all_planets)[transit_flag] text = tt.transitChart(transiters, '2013-01-01', '2013-08-01') ``` Always check transit predictions with at least two independent tools! Eclipse times are currently computed assuming circular orbits. Need to fix this...

#### Previous topic

Transit light curve routines

Observing Tools