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