10 from collections
import namedtuple
11 from .
import keplerian_for_cartesian
22 cx = cy = cz = cvx = cvy = cvz = cmass = 0
23 for ((x,y,z),(vx,vy,vz),mass)
in bodies:
24 cx += x; cy += y; cz += z;
25 cvx += vx; cvy += vy; cvz += vz;
28 return ((cx/cmass,cy/cmass,cz/cmass),(cvx/cmass,cvy/cmass,cvz/cmass),cmass)
32 return zip(range(starting_index,starting_index+len(list)),list)
76 Body = namedtuple(
'Body', [
'position',
'velocity',
'mass'])
92 return LogRecord.Body((0,0,0),(0,0,0),self.
bodies[0].mass)
128 (msgid, length) = unpack(
'ii',s[0:8])
132 (time,sys,state,nbod) = unpack(
'diii',s[8:28])
134 for b
in range(1,nbod+1):
135 (x,y,z,vx,vy,vz,mass,body_id) = \
136 unpack(
'dddddddi4x',s[(32+(b-1)*64):(32+(b)*64)])
137 bodies.append(LogRecord.Body((x,y,z),(vx,vy,vz) ,mass))
147 return {
'time':self.
time,
'sys':self.
sys,