yt.geometry_tests / compare_data_objects.py

# ( ppbr yt-refactor ; python2.7 compare_data_objects.py  ; ((python2.7
# compare_data_objects.py 2>&1) | tee ytrf.out) ) ; ( ppbr yt ; python2.7
# compare_data_objects.py  ; ((python2.7 compare_data_objects.py 2>&1) | tee
# ytnrf.out) ) ;
from yt.mods import *
import time
import cProfile

pf = load("DD0039/output_0039")
v, c = pf.h.find_max("Density")
#c = [0.5, 0.5, 0.5]

import sys
PROF_NAME="yt"
for p in sys.path:
    if "yt-refactor" in p:
        PROF_NAME="ytrf"
        break

def cprof(obj):
    fn = "%s-%s.cprof" % (PROF_NAME, obj._type_name)
    prof = cProfile.Profile()
    for g in obj.pf.h.grids: g.clear_data()
    obj.field_data.clear()
    obj._grids = None
    t1 = time.time()
    prof.enable()
    dd = obj["Density"]
    prof.disable()
    t2 = time.time()
    print "STATS: %s took %0.3e with %s, %s" % (
        obj._type_name, t2-t1, dd.sum(dtype="float64"), dd.shape)
    prof.dump_stats(fn)

cprof(pf.h.ortho_ray(0, (c[x_dict[0]], c[y_dict[0]])))
cprof(pf.h.slice(0, c[0]))
cprof(pf.h.sphere([0.5,0.5,0.5], 0.10))
cprof(pf.h.all_data())
cprof(pf.h.disk([0.5,0.5,0.5], [0.1, 0.3, 0.6], 0.1, 0.03))
cprof(pf.h.cutting([0.1, 0.3, 0.6], [0.5,0.5,0.5]))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.