Commit 36bb77b4 authored by Max Capelle's avatar Max Capelle

add function to find eccentricity

parent a45c410b
......@@ -236,6 +236,19 @@ def ellipse_angle_of_rotation(a):
return np.pi/2 + np.arctan(2*b/(a-c))/2
def eccentricity(axes):
# determine semi-minor and semi-major axis
semi_minor_axis = np.min(axes)
semi_major_axis = np.max(axes)
# calculate eccentricity
e = np.sqrt(1-semi_minor_axis**2/semi_major_axis**2)
if e > 1:
raise ValueError('Eccentricity =',e,' but should be smaller than 1.')
return semi_minor_axis, semi_major_axis, e
def rot_x(r, theta):
Function to rotate coordinates parallel to x axis
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment