[yt-users] Inverted image

Sam Skillman samskillman at gmail.com
Wed May 16 09:47:45 PDT 2012


Hi Massimo,

This is due to how bitmaps of an image are written.  Right now it makes the
upper left corner of the image the (0,0) origin of the data.  There are two
ways to deal with this.  You can either flip the image vertically, using
something like na.flipud(na.log10(frb1["Temperature"])) or do your plotting
directly through matplotlib.  Something like:

import matplotlib.pylab as pl
pl.imshow(na.log10(frb1["Temperature"]), origin='lower')

I'm not completely sure, but I'm guessing the origin='lower' keyword does
something similar to na.flipud.  As a side note, this behavior has come up
in a few other places recently, and we're trying to determine a nice way to
handle the behavior.

Hope that helps,
Sam

On Wed, May 16, 2012 at 10:40 AM, Massimo Gaspari <gaspmax at hotmail.com>wrote:

>  Here it is:
>
>
> from yt.mods import *
>
>
> axis = 0
>
> xCenter = 0.55548e24
>
> yCenter = 0.55548e24
>
> zCenter = 0.
>
>
> res   = [2048, 4096]
>
>
> fn = "chk_0000"
>
> pf = load(fn)
>
> proj = pf.h.proj(axis, "Temperature", None)
>
> frb1 = FixedResolutionBuffer(proj, (0., xCenter*2., 0., xCenter), res)
>
> write_image(na.log10(frb1["Temperature"]), "output.png")
>
>
>
> I am in the stable branch:
>
>
> c23cb264f04c+ (stable)
>
>
>
> Thanks,
>
>
>
>    Max
>
>
>
>
>
> ------------------------------
> From: gaspmax at hotmail.com
> To: yt-users at lists.spacepope.org
> Subject: Inverted image
> Date: Wed, 16 May 2012 18:13:39 +0200
>
>
>  Hi guys,
>
>
> After a projection and a FixedResolutionBuffer like this:
>
>
> proj  = pf.h.proj(axis, "Temperature", None)
> frb1  = FixedResolutionBuffer(proj, (xmin,xmax,ymin,ymax), res)
> write_image(na.log10(frb1["Temperature"]), "output.png")
>
>
> I see an inverted image (my computational box is half a cube, z>0 only):
> http://i.imgur.com/AqWKD.png
>
>
> Is the problem in write_image? Or inside the projection/FRB?
> How to fix this (without transpose)?
>
>
> Thanks,
>
>
>   Max
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20120516/9fce211b/attachment.html>


More information about the yt-users mailing list