[yt-users] Star Projections

Munier Azzam Salem msalem at astro.columbia.edu
Wed Nov 28 14:03:32 PST 2012


Thanks Matt,

      Manually creating the buffer seems to work (though John's approach of
setting colormap values seems like it might be cleaner). The commands I
ended up using are below. Thanks again!

    Munier

*from yt.mods import **
*import matplotlib.pyplot as plt*
*from numpy import log10 as log*
*
*
*fName = "DD0006/test_sim_0006"*
*var   = "star_density"*
*axis  = 0*
*
*
*pf = load(fName)*
*pf.h*
*proj = pf.h.proj(axis,var)*
*
*
*res    = [ 1000 , 1000 ]*
*c = 0.5*
*hw = .02*
*
*
*frb = FixedResolutionBuffer(proj,(c-hw,c+hw,c-hw,c+hw),res,antialias=False)
*
*plt.imshow( log(frb['star_density'] + 1E-5 ) )*
*plt.savefig('tmp')*



On Wed, Nov 28, 2012 at 4:23 PM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Munier,
>
> Ah, my mistake -- to_frb was added in the development branch since our
> last release, which was in September.  You can either update to the
> development branch (hg up -C yt ; python2.7 setup.py develop ) or used
> a FixedResolutioBuffer manually (super easy to do).
>
> -Matt
>
> On Wed, Nov 28, 2012 at 4:18 PM, Munier Azzam Salem
> <msalem at astro.columbia.edu> wrote:
> > Hi Matt,
> >
> >       The command (on ranger, btw) gives
> >
> > yt module located at:
> >     /share/home/01686/msalem/yt-x86_64/src/yt-hg
> >
> > The current version of the code is:
> >
> > ---
> > 6f3c1cf6960d (stable)
> > ---
> >
> > This installation CAN be automatically updated.
> > Updated successfully.
> >
> >
> >
> > On Wed, Nov 28, 2012 at 3:30 PM, Matthew Turk <matthewturk at gmail.com>
> wrote:
> >>
> >> Hi Munier,
> >>
> >> That's weird, it should be in there.  What's the output of "yt
> >> instinfo", particularly the hash?
> >>
> >> -Matt
> >>
> >> On Wed, Nov 28, 2012 at 3:29 PM, Munier Azzam Salem
> >> <msalem at astro.columbia.edu> wrote:
> >> > Hi Nathan,
> >> >
> >> >       Thanks for the tips. I think the fixed-resolution buffer is
> >> > exactly
> >> > what I need here. Unfortunately, when I run the command:
> >> >
> >> > frb = proj.to_frb(width, res, center=c)
> >> >
> >> >
> >> >      I get the error
> >> >
> >> > Traceback (most recent call last):
> >> >   File "smllPlt.py", line 16, in <module>
> >> >     frb = proj.to_frb(width,res)
> >> > AttributeError: 'AMRQuadTreeProj' object has no attribute 'to_frb'
> >> >
> >> >       I tried updating my version of yt and deleting any .yt files,
> but
> >> > the
> >> > error stuck.
> >> >
> >> >            best,
> >> >              Munier
> >> >
> >> >
> >> >
> >> > On Wed, Nov 28, 2012 at 2:34 PM, Nathan Goldbaum <
> nathan12343 at gmail.com>
> >> > wrote:
> >> >>
> >> >> Hi Munier,
> >> >>
> >> >> I suspect that the projection of the particle field is zero in the
> >> >> locations that are colored white in your image.  This causes these
> >> >> regions
> >> >> to 'fall off' the bottom end of the logarithmic color bar.
> >> >>
> >> >> I think you have two options.  One would be to use a linear colorbar.
> >> >> You
> >> >> can do this following the instructions here:
> >> >>
> >> >>
> http://yt-project.org/doc/faq/index.html#how-do-i-modify-whether-or-not-yt-takes-the-log-of-a-particular-field
> >> >>
> >> >> Another option would be to make the plot by hand using a
> >> >> FixedResolutionBuffer.  In this case you would make the projection
> >> >> object by
> >> >> hand, extract the raw image buffer using an FRB, and then make the
> plot
> >> >> manually using matplotlib.  There's an example in the yt docs that
> >> >> covers
> >> >> how to do this:
> >> >>
> >> >>
> http://yt-project.org/doc/visualizing/manual_plotting.html?highlight=manual%20plotting
> >> >>
> >> >> In the latter case if you want the areas that project to zero to
> appear
> >> >> with a logarithmic colorbar, you'll need to manually set the regions
> in
> >> >> the
> >> >> FRB that are equal to zero to some small number.
> >> >>
> >> >> Cheers,
> >> >>
> >> >> Nathan
> >> >>
> >> >> On Nov 28, 2012, at 9:29 AM, Munier Azzam Salem wrote:
> >> >>
> >> >> Hi yt gurus,
> >> >>
> >> >>       I've been making projections of star_density from enzo output
> >> >> files
> >> >> and they seem to be working out fine. However, wherever particles do
> >> >> not
> >> >> exist the background remains white instead of following my chosen
> >> >> colormap.
> >> >> Is there a way to paint these areas to follow the colormap?
> >> >>
> >> >>        thanks!
> >> >>            Munier
> >> >>
> >> >> I've attached an image of what gets plotted, and the relevant bits of
> >> >> my
> >> >> script are:
> >> >>
> >> >> from yt.mods import *
> >> >>
> >> >> fName = "DD0006/test_sim_0006"
> >> >> var   = "star_density"
> >> >> axis  = 0
> >> >>
> >> >> pf = load(fName)
> >> >> pf.h
> >> >>
> >> >> pc = PlotCollection(pf)
> >> >> p = pc.add_projection(var,axis)
> >> >> #p.modify["particles"](1.0)
> >> >>
> >> >> radius = .02;
> >> >>
> >> >> pc.set_xlim(.5-radius,.5+radius)
> >> >> pc.set_ylim(.5-radius,.5+radius)
> >> >>
> >> >> pc.save(fName)
> >> >>
> >> >>
> >> >> --
> >> >> Munier A. Salem // 845.489.6450
> >> >>
> >> >>
> >> >>
> <test_sim_0006_Projection_x_star_density.png>_______________________________________________
> >> >> yt-users mailing list
> >> >> yt-users at lists.spacepope.org
> >> >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >> >>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> yt-users mailing list
> >> >> yt-users at lists.spacepope.org
> >> >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Munier A. Salem // 845.489.6450
> >> >
> >> > _______________________________________________
> >> > yt-users mailing list
> >> > yt-users at lists.spacepope.org
> >> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >> >
> >> _______________________________________________
> >> yt-users mailing list
> >> yt-users at lists.spacepope.org
> >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >>
> >
> >
> >
> > --
> > Munier A. Salem // 845.489.6450
> >
> > _______________________________________________
> > yt-users mailing list
> > yt-users at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Munier A. Salem // 845.489.6450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121128/473e36d6/attachment.html>


More information about the yt-users mailing list