API reference¶
simpthon¶
simpthon.body¶
- simpthon.body.mass(b)[source]¶
mass of a body
- Parameters:
b (class Body) – body.
- Returns:
mass of a body.
- Return type:
float
- simpthon.body.pos(b)[source]¶
position of a body
- Parameters:
b (class Body) – body.
- Returns:
position of a body.
- Return type:
numpy array
- simpthon.body.vel(b)[source]¶
velocity of a body
- Parameters:
b (class Body) – body.
- Returns:
velocity of a body.
- Return type:
numpy array
- simpthon.body.angmom(b)[source]¶
angular momentum per unit mass of body b
\[\mathbf{L} = \mathbf{r \times v}\]- Parameters:
b (class Body) – body.
- Returns:
angular momentum per unit mass of a body.
- Return type:
numpy array
- simpthon.body.kinetic(b)[source]¶
kinetic energy per unit mass of body b
\[K = \frac{1}{2} \mathbf{v} \cdot \mathbf{v}\]- Parameters:
b (class Body) – body.
- Returns:
kinetic energy per unit mass of a body.
- Return type:
float
- simpthon.body.radius(b)[source]¶
radius of position of a body b i.e. \(r=\sqrt{\mathbf{x}\cdot \mathbf{x}}\).
- Args:
b (class Body): body.
- Returns:
radius of position of a body.
- Return type:
float
- simpthon.body.vradial(b)[source]¶
radial velocity
- Parameters:
b (class Body) – body.
- Returns:
radial velocity of a body.
- Return type:
numpy array
- simpthon.body.vtangent(b)[source]¶
tangential velocity
- Parameters:
b (class Body) – body.
- Returns:
radial velocity of a body.
- Return type:
numpy array
- simpthon.body.omega(b)[source]¶
angular frequency of body b
\[\Omega = \frac{v_{\mathrm{tangential}}}{r}\]- Parameters:
b (class Body) – body.
- Returns:
angular frequency of a body.
- Return type:
float
simpthon.integrator¶
- class simpthon.integrator.integrator[source]¶
integrator for solving dynamical sistem:
\[\frac{dv}{dt} = a(x)\]\[\frac{dx}{dt} = v (t)\]
- class simpthon.integrator.leapfrog(pot)[source]¶
Bases:
integratora Kick-Drift-Kick version of leapfrog integrator
- class simpthon.integrator.Euler(pot)[source]¶
Bases:
integratorEuler Method \(w(t+dt) = w(t) + dt f(w(t))\)
for \(w(t) = (x(t),v(t))\).
- class simpthon.integrator.RungeKutta4(pot)[source]¶
Bases:
integratora Runge-Kutta 4th Order integrator
- class simpthon.integrator.Forward4OSymplectic(pot)[source]¶
Bases:
integratora Forward 4th Order Symplectic Integrator (Chin & Chen, 2005)
simpthon.potential¶
- class simpthon.potential.potentials(pots=[])[source]¶
Bases:
potentiallist of potential:
\[\Phi (x) = \Sigma_i \Phi_i (x).\]
- class simpthon.potential.osilator(k, m)[source]¶
Bases:
potentialHarmonik oscilator potential:
\[\Phi (x) = \frac{1}{2} k x^2.\]
- class simpthon.potential.pointmass(GM)[source]¶
Bases:
potentialPoint mass potential:
\[\Phi (x) = -\frac{GM}{r}.\]
- class simpthon.potential.plummer(GM, b)[source]¶
Bases:
potentialPlummer potential :
\[\Phi (x) = -\frac{GM}{\sqrt{r^2 + b^2}},\]with \(b\) scale factor.
- class simpthon.potential.jaffe(GM, b)[source]¶
Bases:
potentialJaffe potential:
\[\Phi (x) = -\frac{GM}{b} \frac{\ln (1+r/b)}{(r/b)^2},\]with \(b\) scale factor.
simpthon.hplot¶
- simpthon.hplot.plot(x, y, label=['x', 'f(x)'], label_fontsize=20, style='-', xlim=[0, 0], ylim=[0, 0], hide_tick=True, hide_tick_label=True, save_fig=' ', dpi=150, plot_xaxis=False, plot_yaxis=False, remove_axis=False, legend_label=' ', legend_loc=-1, tight_layout=True, y2=' ', style2='r-.', legend_label2=' ', y3=' ', style3='g--', legend_label3=' ', texts=[[0, 0, ' ']])[source]¶
plot given data x,y up to 3 graphs
- Parameters:
x (array_like) – data x-axis
y (array_like) – data y-axis
label (list, optional) – label of axes, e.g. [‘x’,f(x)’].
style (str, optional) – style of plot, similar to matplotlib.pyplot.plot style.
xlim (list, optional) – limit of x-axis, list of lower and upper limits
ylim (list) – limit of y axis, list of lower and upper limits
hide_tick (bool, optional) – do you want to hide tick?
hide_tick_label (bool, optional) – do you want to hide tick label
save_fig (str, optional) – filename for saving figure
dpi (int, optional) – number of dots per inch
plot_xaxis (bool, optional) – do you want to plot x-axis (y=0)?
plot_yaxis (bool, optional) – plot y-axis (x=0)?
remove_axis (bool, optional) – remove_axis?
legend_label (str, optional) – label for legend
legend_loc (int, optional) – location of legend
tight_layout (bool, optional) – do you want to tight layout
y2 (array_like, optional) – second data y
style2 (str, optional) – style of 2nd data y
legend_label2 (str, optional) – label for legend 2nd function.
y3 (array_like, optional) – third data y.
style3 (str, optional) – style of 3rd data y.
legend_label3 (str, optional) – label for legend 3rd data y.
texts (list, optional) – list of [x pos text,y pos text,text].
- Returns:
figure – show figure and save it if save_fig given.
- Return type:
matplotlib_object
- simpthon.hplot.plotf(func, label=['x', 'f(x)'], label_fontsize=20, style='-', xlim=[0, 0], ylim=[0, 0], points=100, hide_tick=True, hide_tick_label=True, save_fig=' ', dpi=150, plot_xaxis=False, plot_yaxis=False, remove_axis=False, legend_label=' ', legend_loc=-1, tight_layout=True, func2=' ', style2='r-.', legend_label2=' ', func3=' ', style3='g--', legend_label3=' ', texts=[[0, 0, ' ']])[source]¶
plot given function
- Parameters:
func (function) – function
label (list, optional) – label of axes, e.g. [‘x’,f(x)’].
style (str, optional) – style of plot, similar to matplotlib.pyplot.plot style.
xlim (list, optional) – limit of x-axis, list of lower and upper limits
ylim (list) – limit of y axis, list of lower and upper limits
points (int) – number of datum.
hide_tick (bool, optional) – do you want to hide tick?
hide_tick_label (bool, optional) – do you want to hide tick label
save_fig (str, optional) – filename for saving figure
dpi (int, optional) – number of dots per inch
plot_xaxis (bool, optional) – do you want to plot x-axis (y=0)?
plot_yaxis (bool, optional) – plot y-axis (x=0)?
remove_axis (bool, optional) – remove_axis?
legend_label (str, optional) – label for legend
legend_loc (int, optional) – location of legend
tight_layout (bool, optional) – do you want to tight layout
func2 (function, optional) – second function
style2 (str, optional) – style of 2nd function
legend_label2 (str, optional) – label for legend 2nd function.
func3 (function, optional) – third function y.
style3 (str, optional) – style of 3rd function.
legend_label3 (str, optional) – label for legend 3rd function.
texts (list, optional) – list of [x pos text,y pos text,text].
- Returns:
figure – show figure and save it if save_fig given.
- Return type:
matplotlib_object