summaryrefslogtreecommitdiffstats
path: root/reduce.py
blob: 171f04d9451e435cf7f48424570a10f20ab4770a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import matplotlib as mpl; mpl.use('agg')
import DiskXYZ
import DiskRTZ
import argparse
import sys

# Parse Arguments
parser = argparse.ArgumentParser()
parser.add_argument("imin", type=int, help='First Output')
parser.add_argument("imax", type=int, help='Last Output')
parser.add_argument("--nsamples", type=int, \
                    help='Number of Sampling Points per Axis')
args = parser.parse_args()

# Sanity Checks
if args.imin > args.imax:
    print("Cannot Work With Imin > Imax. Use -h for help.")
    sys.exit(-1)

# Sampling:
print ""
if args.nsamples:
    print "*** Using %i Sampling Points per Axis." % args.nsamples
else:
    print "*** Using %i Sampling Points per Axis." % 128

# Loop Over Outputs
iouts = range(args.imin, args.imax+1)
for iout in iouts:
    print ""
    print "******************************"
    print "Processing Output %05i (XYZ)." % iout
    print "******************************"
    print ""
    disk = DiskXYZ.Disk(iout)
    if args.nsamples:
        disk.nx = args.nsamples
        disk.ny = args.nsamples
        disk.nz = args.nsamples
    disk.load_ramses()
    disk.reduce_all()
    disk.save_npz()
    print ""
    print "******************************"
    print "Processing Output %05i (RTZ)." % iout
    print "******************************"
    print ""
    disk = DiskRTZ.Disk(iout)
    if args.nsamples:
        disk.nr     = args.nsamples
        disk.ntheta = args.nsamples
        disk.nz     = args.nsamples
    disk.load_ramses()
    disk.reduce_all()
    disk.save_npz()