Пример #1
0
######################################
xsun = 8.5
ysun = 0.0
zsun = 0.0
vxsun = 0.0
vysun = 200.0
vzsun = 0.0
sol_m = 1e5 * 1.98892e30
G = 6.67428 * 10**(-11)
#sol_m=2.325e9*1.989e30

###################################################
# Reading data from tipsy file and making arrays  #
###################################################
h = TipsyHeader()  # creates a location for the header and all the rest
inp = ifTipsy(filename, "standard")  # opens the file
inp.read(h)  # reads the header

n_s = h.h_nStar
n_d = h.h_nDark
n_b = h.h_nBodies
print 'n_d=', n_d
print 'n_s=', n_s
print 'n_b=', n_b

d = TipsyDarkParticle()
s = TipsyStarParticle()
m_d_list = []
m_s_list = []
x_d_list = []
x_s_list = []
Пример #2
0
    print "    tdump in.std d100000-+10",
    print "Dump dark particles 100,000 to 100,010"


if __name__ == "__main__":

    bHelp = False  #!< Help was requested on the command line
    bError = False  #!< An error occurred on the command line
    bSplit = True  #!< Split lines
    iPrecision = 5
    ftype = "standard"
    filename = None
    markname = None
    tipsyname = None

    inp = ifTipsy()
    out = ofTipsy()
    worklist = []

    args = []
    rest = []

    long_options = ["help", "single", "standard", "std", "native", "nat", "markfile=", "tipsyout=", "precision="]

    args, rest = gnu_getopt(sys.argv[1:], "h1p:", long_options)
    for option, value in args:
        if option in ["-h", "--help"]:
            bHelp = True
        elif option in ["-1", "--single"]:
            bSplit = False
        elif option in ["--standard", "--std"]:
Пример #3
0
#  This example program will convert a native format tipsy file
#  into a standard format file.
#

import sys
from pytipsy import ifTipsy, ofTipsy

inp = ifTipsy()      # The input file
out = ofTipsy()      # The output file

# Make sure we have two parameters, a native and a standard file.
if len(sys.argv) != 3:
    print >>sys.stderr, "Usage: %s <native> <standard>" % sys.argv[0]
    sys.exit(1)

# Open the native file and abort if there is an error.
inp.open(sys.argv[1],"native")
if not inp.is_open():
    print >>sys.stderr, "Unable to open Native binary %s" % argv[1]
    sys.exit(2)

# Open the output file.
out.open(sys.argv[2],"standard")
if not out.is_open():
    print >>sys.stderr, "Unable to create Standard binary %s" % sys.argv[2]
    sys.exit(2)

# Read the from the input and write it to the output.
for i in inp: out.write(i)

# Close the files.