Documentation for LightDelay.To

What is LightDelay.To?

LightDelay.To is a service that uses orbital elements and ephemerides from a variety of sources to provide accurate distance calculations between a wide range of solar bodies.

Who is LightDelay.To?

I'm just a hacker who knows how to use Python and who decided to read a lot of documentation on astrometrics libraries. This service is independent and non-profit. The code is available on GitHub (link at the top of every page) and pull requests are welcomed and greatly appreciated!

Why is LightDelay.To?

During the InSight Mars mission landing, I was watching the stream and wondering how significant the communications delay was, how long ago the events we were watching had actually occurred. While it's easy to find average speed-of-light delays, I couldn't find anywhere that listed the current communications delay to Mars without pulling out an astrometrics package and calculating it myself. So I decided to put this together.

API Format

The LightDelay.To API is very simple. Issue a GET request to a URL of the form "https://lightdelay.to/location1/location2/time/". You can leave off any parameters you don't need, and you can list the parameters in any order. We will do our best to return the result you're looking for.

If you give a single location, we will return the distance from Earth to that solar system object. If you give two locations, we will return the distance between those two objects. If you give a time, we will calculate the distance as of that time. If you don't, we'll use the current time. See? Pretty straightforward.

Times

You can input a time in any format that Python's dateutil.parser understands. Advertised as supporting "most known formats", you should find this parser to be pretty flexible and very DWIMmy. Here are a few examples:

Locations

You can select a location by name. Currently support is limited to only a few categories of object, but I'm working on adding more.

Planets

Planets, the Sun, and Earth's Moon are calculated using the solar system ephemerides built in to the AstroPy library. Data should be accurate for the range from 1950 to 2050, and may still be relatively accurate outside that window. Examples:

Minor Planets

Anything classified as an asteroid by the Minor Planet Center is available as well. This includes dwarf planets as well as asteroids of all sizes, including:

Comets

Comets are also available from the Minor Planet Center database, however, they aren't yet fully supported here. One issue is that comets are named using names like "9P/Tempel", but the / character is also the HTML path separator. "Tempel" doesn't work because that's also an asteroid, and "Tempel 1" doesn't work because the MPC API doesn't support it. "9P" alone does work in a pinch, though!

Other Moons

Earth-Orbiting Satellites

Locations on Earth

Accuracy

There are some important caveats. I'm a coder, not an astrometrist, so I'm not an expert on the accuracy of these data sources or the validity of this data either into the past or into the future. I have it on good authority that orbital dynamics are actually rather complicated. Here's what should work: