From 31d9c3d8eb5ed0ff43343bca2febf66ac000ee8d Mon Sep 17 00:00:00 2001 From: LM Date: Tue, 24 Sep 2024 21:05:43 +0200 Subject: [PATCH] docs(kepler-problem): adjust kepler demo time interval and animation speed #82 --- docs/tutorials/kepler_problem.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/kepler_problem.py b/docs/tutorials/kepler_problem.py index 902396d..2ba56a1 100644 --- a/docs/tutorials/kepler_problem.py +++ b/docs/tutorials/kepler_problem.py @@ -55,7 +55,8 @@ # 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) +# t = np.linspace(-20, 20, 401) +t = np.arange(-20, 20, 0.125) # %% [markdown] # Orbit time series data is generated by calling the object `k2d`, as the data generation is done in the `__call__` method. @@ -80,7 +81,6 @@ def visualize_orbit(dataframe: pd.DataFrame) -> go.Figure: r="r", theta="phi_degree", hover_data=["t", "r", "phi"], - text="t", start_angle=0, animation_frame="t", color_discrete_sequence=["red"], @@ -106,6 +106,9 @@ def visualize_orbit(dataframe: pd.DataFrame) -> go.Figure: fig.add_traces(trajectory_traces) + fig.layout.updatemenus[0].buttons[0].args[1]["frame"]["duration"] = 50 + fig.layout.updatemenus[0].buttons[0].args[1]["transition"]["duration"] = 50 + return fig @@ -149,7 +152,7 @@ def visualize_orbit(dataframe: pd.DataFrame) -> go.Figure: "ecc": 2, "parameter": 1.0, }, - )(t=np.linspace(-5, 5, 101)), + )(t=np.arange(-5, 5, 0.125)), ).show() # %% [markdown]