This commit is contained in:
Yael-II
2025-01-02 22:48:54 +01:00
commit 34371f3532
57 changed files with 6076 additions and 0 deletions

56
Source/test_potentials.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python
"""
Test: Potential
Draw the Kepler potential and the Hénon--Heils potential
@ Author: Moussouni, Yaël (MSc student) & Bhat, Junaid Ramzan (MSc student)
@ Institution: Université de Strasbourg, CNRS, Observatoire astronomique
de Strasbourg, UMR 7550, F-67000 Strasbourg, France
@ Date: 2024-11-29
"""
import numpy as np
import matplotlib.pyplot as plt
import potentials as pot
import initial_conditions as init
if "YII_1" in plt.style.available: plt.style.use("YII_1")
# Loading matplotlib style...
W = init.mesh_grid(300)
def kepler(W):
"""Plots the Kepler potential"""
X = W[0]
Y = W[1]
POT = pot.kepler_potential(W, position_only=True)
fig, ax = plt.subplots(1)
ax.set_title("Kepler potential")
pcm = ax.pcolormesh(X, Y, POT)
fig.colorbar(pcm, label="potential")
ax.set_aspect("equal")
ax.set_xlabel("$x$")
ax.set_ylabel("$y$")
return 0
def hh(W):
"""Plots the Hénon--Heils potential"""
X = W[0]
Y = W[1]
POT = pot.hh_potential(W, position_only=True)
fig, ax = plt.subplots(1)
ax.set_title("HénonHeils potential")
pcm = ax.pcolormesh(X, Y, POT)
fig.colorbar(pcm, label="potential")
ax.set_aspect("equal")
ax.set_xlabel("$x$")
ax.set_ylabel("$y$")
return 0
if __name__ == "__main__":
kepler(W)
hh(W)
plt.show(block=True)