Skip to content

Commit

Permalink
docs(kepler-problem): fix typing of kepler problem tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
emptymalei committed Sep 22, 2024
1 parent 32d1482 commit ce7cd44
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docs/tutorials/kepler_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go

from hamilflow.models.kepler_problem import Kepler2D

Expand All @@ -51,21 +52,25 @@
)

# %% [markdown]
# We define the time steps for a Kepler system. In this example, we create 101 time steps.
# We define the time steps for a Kepler system. In this example, we create 401 time steps, also with some some negative timestamps for a more symmetric trajectory.

# %%
t = np.linspace(-20, 20, 401)

# %% [markdown]
# Orbit time series data is generated by calling the object `k2d`
# Orbit time series data is generated by calling the object `k2d`, as the data generation is done in the `__call__` method.

# %%
df_p_1 = k2d(t=t)
df_p_1 # noqa: B018


# %%
def visualize_orbit(dataframe: pd.DataFrame): # noqa: D103, ANN201
def visualize_orbit(dataframe: pd.DataFrame) -> go.Figure:
"""Plot out the trajectory in a polar coordinate.
:param dataframe: dataframe containing the trajectory data
"""
fig = px.line_polar(
dataframe.assign(
phi_degree=dataframe.phi / (2 * np.pi) * 360,
Expand Down

0 comments on commit ce7cd44

Please sign in to comment.