7.1 Io functions

Nbody( [p_name=None], [pos=None], [vel=None], [mass=None], [num=None], [npart=None], [ftype=None], [status='old'], [byteorder=sys.byteorder], [pio='no'], [log=None])

This instance is the constructor for the pNbody object. Optional arguments are:

If status = 'old', the constructor automatically call the function read wich will read the content of the file(s) in the p_name. If status = 'new', defaut values are given to the variables. One the constructor has been called, all optional varables are are initialized. The following variables are also initialized :

Other variables may be initialized, depending on the type of the file read.

>>> from pNbody import *
>>> nb = Nbody('disk.gad',ftype='gadget')
>>> nb.pos[0:10]
array([[  4.89041433e-02,   2.52863064e+01,  -7.45196819e+00],
       [  5.82345047e+01,  -5.67267685e+01,   1.64647083e+01],
       [  1.17894821e+01,  -5.01083970e-01,   3.68080497e+00],
       [ -2.43042755e+01,  -2.24240952e+01,   5.40977783e+01],
       [ -1.03210754e+01,   8.96411300e-01,  -5.02210388e+01],
       [ -1.38344803e+01,  -2.56113482e+00,  -1.29380960e+01],
       [  1.84468384e+01,  -3.16423264e+01,   2.17839069e+01],
       [  6.11360121e+00,   1.42906122e+01,   3.05427265e+01],
       [ -7.02638292e+00,   2.44790745e+01,   9.55757523e+00],
       [  8.33313751e+00,  -5.49589968e+00,  -4.00754318e+01]], type=float32)
>>> nb.mass_tot
2.3262434005737305
>>> nb.npart
array([   0, 2001, 1000,    0,    0,    0])

See About this document... for information on suggesting changes.