Swarm-NG  1.1
swarmng.logrecord.LogRecord Class Reference

Data structure equivalent of the logrecord defined in Swarm-NG C++ library This class does not use any C++ code, intead it uses pack/unpack to directly parse the binary format into Python variables. More...

Public Member Functions

def star
 Return the star of a planetary system helper function for bodies_in_keplerian.
 
def barycenter
 Barycenter, a.k.a center of mass, of the planetary system helper function for bodies_in_keplerian.
 
def origin
 The origin with the mass of the star helper function for bodies_in_keplerian.
 
def bodies_in_keplerian
 Convert logrecord to keplerian coordinates, this method converts the bodies one-by-one. More...
 
def bodies_in_keplerian_jacobi
 Iterator for planets properties. More...
 
def __repr__
 String representation of the planetary system the representation is shown like a Hash. More...
 

Static Public Member Functions

def from_binary
 Parse a binary string representing a C++ logrecord struct and return a LogRecord object. More...
 

Static Public Attributes

tuple Body = namedtuple('Body', ['position', 'velocity', 'mass'])
 Data structure for properties of a body (planet or star) in a system. More...
 

Properties

 bodies = property
 List of bodies (planets and star) each element is of type Body.
 
 time = property
 Time of the snapshot in AU (floating point)
 
 sys = property
 Integer identifier of the system.
 
 state = property
 The current state of system, different codes may be used by any software that writes the logrecord. More...
 

Detailed Description

Data structure equivalent of the logrecord defined in Swarm-NG C++ library This class does not use any C++ code, intead it uses pack/unpack to directly parse the binary format into Python variables.

Currently, the data structure stores a snapshot of the state of a planetary system.

The constructor of this class does not do anything. Static method from_binary should be used to parse binary strings and create instances of this class

: make the constructor private

Definition at line 50 of file logrecord.py.

Member Function Documentation

def swarmng.logrecord.LogRecord.__repr__ (   self)

String representation of the planetary system the representation is shown like a Hash.

Definition at line 152 of file logrecord.py.

References swarmng.logrecord.LogRecord.as_map().

def swarmng.logrecord.LogRecord.bodies_in_keplerian (   self,
  center 
)

Convert logrecord to keplerian coordinates, this method converts the bodies one-by-one.

The coordinates are calculated with respect to a center. The possible options for a center are l.star(), l.barycenter() and l.origin() The results can be used in a for loop. This returns triplets as

  • Ordinal number of the planet (first planet has number 1)
  • Cartesian coordinates of the planet as an object that has properties position, velocity and mass
  • Keplerian coordinates of the planet as an object with properties a, e, i, O, w, M
     

Definition at line 105 of file logrecord.py.

References swarmng.logrecord.LogRecord.bodies, swarm::query::sysinfo.bodies, swarmng.keplerian_for_cartesian(), and swarmng.logrecord.with_index().

def swarmng.logrecord.LogRecord.bodies_in_keplerian_jacobi (   self)

Iterator for planets properties.

For each planet, a triple of index,carteisan coordinates, keplerian coordinates is returned. The keplerian coordinates are computed with Jacobi semantics, meaning that center for every planet is the center of mass of the interior planetory system (star and all interior planets)

Definition at line 116 of file logrecord.py.

References swarmng.logrecord.LogRecord.bodies, swarm::query::sysinfo.bodies, swarmng.logrecord.center_of_mass(), swarmng.keplerian_for_cartesian(), and swarmng.logrecord.with_index().

def swarmng.logrecord.LogRecord.from_binary (   s)
static

Parse a binary string representing a C++ logrecord struct and return a LogRecord object.

Only snapshot logrecords (where event_id = 1) are supported at the moment

Definition at line 127 of file logrecord.py.

References swarmng.logrecord.LogRecord.bodies, swarm::query::sysinfo.bodies, swarmng.logrecord.LogRecord.state, swarmng.System.state, swarm::snapshot::sys.state, swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::Sys::@3.state, swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::Sys.state, swarm::gpu::bppt::GravitationAcc< T >.sys, swarm::gpu::bppt::GravitationAcc_GR< T >.sys, swarmng.logrecord.LogRecord.sys, swarm::gpu::bppt::VerletPropagator< T, Gravitation >.sys, swarm::gpu::bppt::EulerPropagator< T, Gravitation >.sys, swarm::gpu::bppt::MVSPropagator< T, Gravitation >.sys, swarm::gpu::bppt::HermitePropagator< T, Gravitation >.sys, swarm::gpu::bppt::MidpointPropagator< T, Gravitation >.sys, swarm::gpu::bppt::GravitationAccJerk< T >.sys, swarm::log::body_set< N >.sys, swarm::gpu::bppt::GravitationLargeN< T >.sys, swarm::gpu::bppt::GravitationMediumN< T >.sys, TutorialPropagator< T, Gravitation >.sys, swarm::query::swarmdb::index_entry.sys, swarm::query::swarmdb::result.sys, swarm::query::sysinfo.sys, swarmng.logdb.PKey.time, swarm::log::event_record< NumData >.time, logdb_primary_key.time, swarmng.logrecord.LogRecord.time, swarm::log::pkey_t.time, swarm::log::event_record<-1 >.time, swarmng.System.time, swarm::log::event_record< 0 >.time, and swarm::snapshot::sys.time.

Member Data Documentation

tuple swarmng.logrecord.LogRecord.Body = namedtuple('Body', ['position', 'velocity', 'mass'])
static

Data structure for properties of a body (planet or star) in a system.

It has following properties:

  • position : a list of 3 floating point values for x, y and z
  • velocity : a list of 3 floating point values for vx, vy and vz
  • mass : a floating point value for the mass (relative to the star) it can be treated as a tuple, and destructed

Definition at line 76 of file logrecord.py.

Property Documentation

swarmng.logrecord.LogRecord.state = property
static

The current state of system, different codes may be used by any software that writes the logrecord.

Regular values:

  • 0 : active : currently integrating, this wouldn't happen in a log file
  • 1 : inactive : not currently integrating, but will be
  • -1: disabled system : is ignored by integrators.

Definition at line 65 of file logrecord.py.

Referenced by swarmng.logrecord.LogRecord.from_binary().


The documentation for this class was generated from the following file: