From ce7cd4463aa37b04a74868ce35b6424e925d55c4 Mon Sep 17 00:00:00 2001 From: LM Date: Sun, 22 Sep 2024 12:57:00 +0200 Subject: [PATCH] docs(kepler-problem): fix typing of kepler problem tutorial #82 --- docs/tutorials/kepler_problem.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/kepler_problem.py b/docs/tutorials/kepler_problem.py index d617f4c..7c96c7b 100644 --- a/docs/tutorials/kepler_problem.py +++ b/docs/tutorials/kepler_problem.py @@ -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 @@ -51,13 +52,13 @@ ) # %% [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) @@ -65,7 +66,11 @@ # %% -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,