[yt-users] MultiVariate volume rendering difficulties

Noel Scudder noel.scudder at stonybrook.edu
Tue Jul 30 07:23:15 PDT 2013


Hi all,

I'm attempting to visualize multiple variables in the same volume
rendering. For instance, I'd like to show some density surfaces of a star
and then get temperature overlayed to show hotspots. I found the
MultiVariateTransferFunction, but it is unfortunately not particularly well
documented yet, and I'm being repeatedly thwarted. I'm not sure if I've set
it up correctly, or how to go from the transfer function to an image.
Here's my current script, using just one variable for now:

#----------------------------------
from yt.mods import *
pf = load('plt00100')

#<some constants>

pf.h
pf.field_info['density'].take_log=True

mv = MultiVariateTransferFunction()

tf = TransferFunction((mi-1, ma+1), nbins=1.0e6)
tf.add_gaussian(np.log10(9.0e5), 0.01, 1.0)

mv.add_field_table(tf, 0)
mv.link_channels(0, [0,1,2,3])

c = [5.0e9, 5.0e9, 5.0e9]
L = [0.15, 1.0, 0.40]
W = wi*0.7
Nvec = 1024

cam = pf.h.camera(c, L, W, (Nvec,Nvec), transfer_function = mv,
                             fields=['density'], pf=pf, no_ghost=True)

im = cam.snapshot(num_threads=4)

im.write_png('plt00100.png' )
#----------------------------------

I checked to make sure density is indeed my 0-index field. I get the
following error after ray casting:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "multivol.py", line 153, in <module>
    im = cam.snapshot(num_threads=4)
  File
"/home/noel/shocks/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py",
line 742, in snapshot
    image, sampler),
  File
"/home/noel/shocks/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py",
line 632, in _render
    image = self.finalize_image(image)
  File
"/home/noel/shocks/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py",
line 611, in finalize_image
    if self.transfer_function.grey_opacity is False:
AttributeError: 'MultiVariateTransferFunction' object has no attribute
'grey_opacity'


Can I not use snapshot in this case, or is something else the matter
entirely?

Thanks,
Noel Scudder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130730/ad857f33/attachment.htm>


More information about the yt-users mailing list