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

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


Hi, sorry I forgot to attach the figures. Here is it.

On Tue, Jan 31, 2017 at 5:32 PM, Mu-Hung Chang <mu-hung.chang at stonybrook.edu
> wrote:

> 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/efabb587/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1d_detonation_expected.png
Type: image/png
Size: 20639 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170131/efabb587/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1d_detonation_weird.png
Type: image/png
Size: 21189 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170131/efabb587/attachment-0005.png>


More information about the yt-users mailing list