[yt-users] Ray casting in simple volume rendering

Matthew Turk matthewturk at gmail.com
Wed Mar 31 09:58:26 PDT 2010


Hi Nick,

Are you using 3D data?

-Matt

On Wed, Mar 31, 2010 at 9:55 AM, Nicholas Earl <earlnich at msu.edu> wrote:
> This all sounds exciting, and I'm definitely making headway in terms of
> progress on the screen, but I keep getting hung up at a ValueError: shape
> mismatch: objects cannot be broadcast to a single shape after this line:
>
>     vcd = grid.get_vertex_centered_data(field).astype('float64')
>   File "/Users/earln/yt-i386/src/yt-trunk-svn/yt/lagos/BaseGridType.py",
> line 445, in get_vertex_centered_data
>     na.add(new_field, cf[1: ,1: ,1: ], new_field)
>
> Not quite sure wherein this would lie. Any possible ideas?
>
> Thanks!
> Nick
>
> On Tue, Mar 30, 2010 at 2:20 PM, Matthew Turk <matthewturk at gmail.com> wrote:
>>
>> Hi Nicholas,
>>
>> Yup, the cookbook applies to 1.6, but we've changed things a bit in
>> the trunk so as to enable parallel volume rendering -- and to make
>> some things nicer.  For instance, you can now sample colormaps,
>> automatically add layers, etc etc.  We're also just about ready to
>> roll out multivariate volume rendering, including planck functions and
>> scattering.
>>
>> Anyway, I'm sorry that it's not working right now for you!  To use the
>> script, we just need to get rid of direct_ray_cast, which we can
>> replace with:
>>
>> vp = pf.h.volume_rendering(L, W, c, Nvec, tf)
>> vp.ray_cast()
>>
>> At this point, we can get the image as vp.image:
>>
>> to_plot = na.clip(vp.image, vp.image.min(), 0.8 * vp.image.max())
>> to_plot = (to_plot - to_plot.min()) / (to_plot.max() - to_plot.min())
>>
>> (we still have to normalize, unfortunately -- we're working on that
>> for the future.)
>>
>> And we now also provide a saving function:
>>
>> vr.plot_rgb(to_plot, "%s" % pf)
>>
>> I've uploaded a new version of the cookbook recipe here:
>>
>> http://paste.enzotools.org/show/404/
>>
>> which you can download with "yt_lodgeit.py --download=404".  One thing
>> you might consider is that sometimes it's easier to just
>> "add_layers(N)" on the transfer function, optionally supplying the
>> name of a colormap (defaults to gist_stern) so that yt will add onion
>> layers to your image at even intervals.  I've uploaded an example of
>> that here:
>>
>> http://paste.enzotools.org/show/405/
>>
>> Anyway, sorry for the trouble, but I hope that the annoyance is worth
>> the new advantages!
>>
>> -Matt
>>
>> On Tue, Mar 30, 2010 at 11:07 AM, Nicholas M. Earl <earlnich at msu.edu>
>> wrote:
>> > Hey again YT community,
>> >
>> > I was hoping to get some heading on using the simple volume rending
>> > script
>> > that is written up in the YT cookbook, but it seems that
>> > direct_ray_casting
>> > isn't a part of yt extensions anymore? Is there something to substitute
>> > this? I see that in the software sample script, there is a referencing
>> > of
>> > VolumeRendering, can I use this?
>> >
>> > Thanks for your time and effort!
>> > Nicholas Earl
>> > _______________________________________________
>> > 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
>>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>



More information about the yt-users mailing list