[yt-users] Problem about using yt to visualize simulation data

Mu-Hung Chang mu-hung.chang at stonybrook.edu
Tue Jan 31 14:32:43 PST 2017


Hi, I've encountered a problem when I tried to use yt to visualize simple
1D detonation simulation data generated by Castro. The figure I expected to
get is a simple step function just as attachment
"1d_detonation_expected.png". However, if I don't set a customized axis
limit by hand, it will produce something weird at the origin, which can be
seen in the attachment "1d_detonation_weird.png". Following is my simple
script to make plots. I wonder where I did wrong thus make this happened.
Thank you for answering.

import sys

import yt

import yt.units as u


def doit(plotfile):

    ds = yt.load(plotfile)

    ds.periodicity = (False, False, False)

    ad = ds.all_data()

    plot = yt.ProfilePlot(ad, "x", "temperature")

    plot.set_unit("temperature", "K")

    plot.set_unit("x", "m")

    plot.set_log('x', False)

    plot.set_xlim(1e-20, 450.0)

    pid = plotfile.split("plt")[1]

    plot.save("1d_detonation_{}.png".format(pid))


if __name__ == "__main__":


    # Choose a field



    plotfile = ""

    try:

        plotfile = sys.argv[1]

    except:

        sys.exit("ERROR: no plotfile specified")

    for plt in sys.argv[1:]:

        plotfile = plt

        doit(plotfile)

Best,
Mu-Hung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170131/4cf04324/attachment.htm>


More information about the yt-users mailing list