Skyfield: HomeTable of ContentsChangelogAPI Reference

API Reference — Vector Functions

The Skyfield API is build atop vector functions that take time as input and produce a position vector. You can create vector functions for the Earth, Moon, Sun, planets, and Earth satellites, and can combine them using addition and subtraction.

class skyfield.vectorlib.VectorFunction

Given a time, computes a corresponding position.

center

The Solar System object from which this vector is measured. Often this is an integer code like 399 for the Earth, 3 for the center of gravity of the Earth-Moon system, or 0 for the very center of the Solar System itself, though it might also be a specific object like a GeographicPosition on the Earth’s surface or an EarthSatellite in orbit around it.

target

Using the same set of possible values as the center, this attribute names the target to which the vector is pointing. The vector, then, is the three-dimensional difference between the position of the center and that of the target.

vf1 + vf2

Return a new vector function whose at(t), when called, computes the sum of the original vectors vf1 and vf2. This will raise an error unless the target where one of the two vectors ends is the same as the center from which the other vector starts.

vf1 - vf2

Return a new vector function whose at(t), when called, computes where the target of vf1 will be positioned relative to the target of the subtracted vf2. Note that this will be an instantaneous vector, uncorrected for the amount of time light takes to travel from one target to the other. This raises an error unless the two vectors share the same center.

at(t)

At time t, compute the target’s position relative to the center.

If t is an array of times, then the returned position object will specify as many positions as there were times. The kind of position returned depends on the value of the center attribute: