1
0

minor modification + system clas update comshift

This commit is contained in:
Alex_Hubert
2021-11-19 15:41:30 +01:00
parent 66afb18885
commit 80a7c363e7

View File

@@ -30,8 +30,10 @@ class Body:
class System(Body):
def __init__(self, bodylist, blackstyle=True):
def __init__(self, bodylist, main = False, blackstyle=True):
self.blackstyle = blackstyle #for dark mode in plot
if main == True :
self.COMShift()
self.bodylist = np.array(bodylist)
self.time = 0 #lifetime of system
self.m = self.M
@@ -127,17 +129,18 @@ class System(Body):
return mu
@property
def ex(self): #exentricity of system (if composed of 2 bodies)
if len(self.bodylist) != 2 :
return np.nan
else:
k = (2.*self.E*(np.linalg.norm(self.L)**2))/((G**2)*(self.M**2)*(self.mu**3)) + 1.
return k
def ecc(self): #exentricity of sub system of
if len(self.bodylist) == 2 :
ecc = (2.*self.E*(np.linalg.norm(self.L)**2))/((G**2)*(self.M**2)*(self.mu**3)) + 1.
else :
ecc = np.nan
return ecc
@property
def sma(self): #semi major axis of system (if composed of 2 bodies)
if len(self.bodylist) != 2 :
return np.nan
else:
if len(self.bodylist) == 2 :
sma = -G*self.M*self.mu/(2.*self.E)
return sma
else :
sma = np.nan
return sma