<jupyter_start><jupyter_text>τ and Time of PeriastronHere, we will discuss what exactly is τ, the parameter `orbitize!` uses to parametrize the epoch of periastron, and how it is related to other quantities of the epoch of periastron in the literuatre.  Time of Periastron and Motivation for τThe time (or epoch) of periastron is an important quantity for describing an orbit. It defines when the two orbiting bodies are closest to one another (i.e., when a planet is closest to its star). In many papers in the literature, the epoch of periastron is described by $t_p$, which is literally a date at which periastron occurs. This is a very important date because we use this date to anchor our orbit in time. The value of $t_p$ is well constrained when we know we observed periastron, which is often the case for radial velociy or transiting exoplanets when the orbital periods are short and our data covers a full orbital period. In those cases, we know approximately when $t_p$ should be in time, so it is easy to define prior bounds for it. However, in the case of direct imaging, many of our companions have orbital periods that are orders of magnitude larger than the current orbital coverage of the data where we do not really know if the next periastron is in years, decades, centuries, or even millennia. This is the motivation for τ.  Definition of ττ is a dimentionless quantity between 0 and 1 defined with respect to a reference epoch $t_{ref}$. For a planet that has a $t_p$ and an orbital period (P), then we define τ as:$$\tau = \frac{t_p - t_{ref}}{P}.$$Because τ is always between 0 and 1, it is easy to figure out the bounds of τ whereas if the orbital period is highly uncertain, it may be difficult to put bounds on $t_p$ that would encompass all allowable bound orbits.  Relation to $t_p$As seen in the above equation, it is relatively straightforward to covert between orbital parameter sets that use τ and $t_p$. You just need to know the orbital period and reference epoch. In `orbitize!`, both the `System` class and the `Results` class has the attribute `tau_ref_epoch` which stores $t_{ref}$, so there should always be a convenient way to grab this number. By default, we use $t_{ref} = 58849$ MJD. One thing to note that is a given orbit has only a single valid τ, but that an orbit can be defined by many $t_p$, since the orbit is periodic. Thus, $t_p + P$ is another valid time of periastron. We also provide some helper functions to covert between $t_p$ and τ<jupyter_code>import numpy as np
import orbitize.basis

# How to get orbital period in the orbitize! standard basis
sma = 9 # au, semi-major axis
mtot = 1.2 # Solar masses, total mass
period = np.sqrt(sma**3/mtot) # years, period

tau = 0.2
tau_ref_epoch = 58849

# convert tau to tp
tp = orbitize.basis.tau_to_tp(tau, tau_ref_epoch, period)

print(tp)

# convert tp back to tau
tau2 = orbitize.basis.tp_to_tau(tp, tau_ref_epoch, period)

print(tau2)

# convert tau to tp, but pick the first tp after MJD = 0
tp_new = orbitize.basis.tau_to_tp(tau, tau_ref_epoch, period, after_date=0)

print(tp_new)<jupyter_output>60649.50097715886
0.2000000000000002
6634.471662393138<jupyter_text>Relation to Mean AnomalyThe mean anomaly (M) of an orbit describes the current orbital phase of a planet. M goes from 0 to 2π, and M = 0 means the planet is at periastron. Unlike $t_p$ and τ which describe the epoch of periastron, M describes the current position of the planet in its orbit. To compute M of a planet at some time t, we have provided the following helper function:<jupyter_code># Use the orbit defined in the previous example

t = 60000 # time in MJD when we want to know the M of the particle

M = orbitize.basis.tau_to_manom(t, sma, mtot, tau, tau_ref_epoch)

print(M)

# now compute M for periastron
M_peri = orbitize.basis.tau_to_manom(tp, sma, mtot, tau, tau_ref_epoch)

print(M_peri)<jupyter_output>5.829874251150844
1.3951473992034527e-15
{'fraction_non_alphanumeric': 0.057447890188103715, 'fraction_numerical': 0.029486527707168277, 'mean_word_length': 4.565770862800566, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '291029', 'license': 'BSD-3-Clause-Clear', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1151, 'n_words': 617, 'path': 'docs/faq/Time_Of_Periastron.ipynb', 'repo_name': 'sefffal/orbitize', 'size': '3934'}