From d8756902d46e53ae150c4b9bbe4415c680973bd3 Mon Sep 17 00:00:00 2001 From: Henrik Finsberg Date: Sun, 8 Sep 2024 20:46:57 +0200 Subject: [PATCH] Add docs --- _toc.yml | 1 + examples/bestel.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 examples/bestel.py diff --git a/_toc.yml b/_toc.yml index 6a90ed5..eadbac1 100644 --- a/_toc.yml +++ b/_toc.yml @@ -7,6 +7,7 @@ parts: - file: "examples/regazzoni.py" - file: "examples/zenker.py" - file: "examples/regazzoni_bleeding.py" + - file: "examples/bestel.py" - caption: Python API chapters: - file: "docs/api" diff --git a/examples/bestel.py b/examples/bestel.py new file mode 100644 index 0000000..4eb8e04 --- /dev/null +++ b/examples/bestel.py @@ -0,0 +1,56 @@ +# # Bestel model + +# In this example we will show the both the pressure and activation model from Bestel et al. {cite}`bestel2001biomechanical`. + +import matplotlib.pyplot as plt +import numpy as np +from scipy.integrate import solve_ivp + +from circulation import bestel + +# First let us define a time array + +t_eval = np.linspace(0, 1, 200) + +# Now we will solve the activation model + +activation = bestel.BestelActivation() +result_activation = solve_ivp( + activation, + [0, 1], + [0.0], + t_eval=t_eval, + method="Radau", + ) + +# and plot the results + +fig, ax = plt.subplots() +ax.plot(result_activation.t, result_activation.y[0]) +ax.set_xlabel("Time [s]") +ax.set_ylabel("Active tension [Pa]") +plt.show() + +# Now we will solve the pressure model + +pressure = bestel.BestelPressure() +result_pressure = solve_ivp( + pressure, + [0, 1], + [0.0], + t_eval=t_eval, + method="Radau", + ) + +# and plot the results + +fig, ax = plt.subplots() +ax.plot(result_pressure.t, result_pressure.y[0]) +ax.set_xlabel("Time [s]") +ax.set_ylabel("Pressure [Pa]") +plt.show() + +# # References +# ```{bibliography} +# :filter: docname in docnames +# ```