(quickstart)= # Quickstart ## Defining the orbit: {{ Orbit }} objects The core of boinor are the {{ Orbit }} objects inside the {py:class}`boinor.twobody` module. They store all the required information to define an orbit: - The body acting as the central body of the orbit, for example the Earth. - The position and velocity vectors or the orbital elements. - The time at which the orbit is defined. First of all, you have to import the relevant modules and classes: ```python from astropy import units as u from boinor.bodies import Earth, Mars, Sun from boinor.twobody import Orbit ``` ## From position and velocity There are several methods available to create {{ Orbit }} objects. For example, if you have the position and velocity vectors you can use {py:meth}`~boinor.twobody.orbit.scalar.Orbit.from_vectors`: ```python # Data from Curtis (2013), example 4.3 r = [-6045, -3490, 2500] << u.km v = [-3.457, 6.618, 2.533] << u.km / u.s orb = Orbit.from_vectors(Earth, r, v) ``` And that's it! Notice a couple of things: - Defining vectorial physical quantities using Astropy units is very easy. The list is automatically converted to a {py:mod}`astropy.units.Quantity`, which is actually a subclass of NumPy arrays. - If you display the orbit you just created, you get a string with the radius of pericenter, radius of apocenter, inclination, reference frame and attractor: ```python >>> orb 7283 x 10293 km x 153.2 deg (GCRS) orbit around Earth (♁) at epoch J2000.000 (TT) ``` - If no time is specified, then a default value is assigned: ```python >>> orb.epoch