yt_map /

from yt.mods import *
pf = load("/home/mturk/Research/data/JHK-DD0030/galaxy0030")
#pf = load("/home/mturk/Research/data/DD0250/DD0250")
proj = pf.h.proj(2, "Density")
TS = 256
import tempfile
from yt.visualization.image_writer import apply_colormap
from yt.utilities.amr_utils import write_png_to_file

# We say 256 pixels for each tile, and we have 

import bottle

mi = na.log10(proj["Density"][proj["Density"]>0].min())
ma = na.log10(proj["Density"][proj["Density"]>0].max())

def map(L, x, y):
    dd = TS / (128 * 2.0**int(L))
    relx = int(x) * dd
    rely = int(y) * dd
    DW = (pf.domain_left_edge + pf.domain_right_edge)/2.0
    xp = pf.domain_left_edge[0] + relx * DW[0]
    yp = pf.domain_left_edge[1] + rely * DW[1]
    frb = FixedResolutionBuffer(proj, (xp, xp+dd*DW[0], yp, yp+dd*DW[1]), (256, 256))
    tf = tempfile.TemporaryFile()
    to_plot = apply_colormap(na.log10(frb["Density"]), color_bounds = (mi, ma))
    print "=="
    print 'rel', dd, relx, rely
    print 'x', xp, xp+dd*DW[0]
    print 'y', yp, yp+dd*DW[1]
    print 'mi', mi, frb["Density"].min()
    print 'ma', ma, frb["Density"].max()
    write_png_to_file(to_plot, tf)

def index():
    return bottle.static_file("index.html", root=".")

def static(filename):
    return bottle.static_file(filename, root=".")
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
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.