tonight
What this tool does
tonight builds a ranked observing plan for one night at one site. For each target in a CSV it computes the window where airmass is under 2, the minimum airmass and when it occurs, and the Moon separation at that moment; targets that never get observable are listed separately with a plain reason. It plans — it does not control a telescope.
Install
pip install git+https://github.com/RakTikoo/tonight
This provides the tonight command.
Run
tonight plan targets.csv --site "-31.2733,-70.7033,2300" --date 2026-12-15 --out plan.csv
targets.csvhas columnsname,ra,decplus an optionalpriority. RA/Dec may be plain degrees or sexagesimal (RA in hours, Dec in degrees).--siteis"lat,lon,height_m"— degrees (south/west negative), height in metres. Coordinates only; site names are never looked up.--dateisYYYY-MM-DD(default: today), anchored in UTC: the plan covers the first astronomical night (Sun 18° down) beginning after 12:00 UTC that day.--outis optional; a summary is always printed.
Reading the results
Exit code 0 means a plan was built. The printed summary gives the
night's span, the Moon illumination, then "Observe in this order" — each
target with its window in UTC, its length, best airmass and time, and
Moon separation — then an "Unobservable tonight" list with a reason per
target (for example "never rises above airmass 2 at this site"). A
target being unobservable is a result, not an error. Ranking is by
priority first (higher first), then longer observable window, then
lower minimum airmass; if a target has two separate windows in one
night, every window is reported, but the ranking uses the longest
single one. The --out CSV carries the same facts per target,
including window_count and total_window_hours.
All times are UTC, plus a local solar time derived from longitude. tonight has no time-zone database: the local column is mean solar time and can differ from clock time at the site by an hour or more. Use the UTC values for anything that must be exact.
Exit code 2 means the request itself was wrong — an unreadable
targets file, unparseable coordinates, a malformed site. The error is
printed as one clean line and no plan was produced.
Limits
- Planning-grade accuracy: airmass uses the plane-parallel approximation on a 5-minute grid; window edges are good to a few minutes, not a substitute for mount software at the telescope.
- IERS-B, not IERS-A: Earth-rotation finals need a download, so the bundled IERS-B predictions are used (difference well under a second).
- Moon positions come from Astropy's built-in ephemeris (arcminute-level), not the JPL tables.
- Ideal horizon: windows assume a flat horizon at altitude 0°, no weather, no twilight observing, no telescope limits.
- One night, one site, target list only — no multi-night trips, no site-name lookup, no equipment or exposure planning.
- Polar continuous night is reported, not planned: where the Sun stays over 18° down all day, the date is reported as a continuous night with all targets unobservable. Supported dates: years 1900–2100.
