[yt-users] error on volume rendering on zoom-in simulation

mohammad safarzadeh mtsafarzadeh at gmail.com
Wed Sep 4 10:39:01 PDT 2013


I tried this, but I still get a blank black figure:

import numpy as np
from yt.mods import *
from yt.analysis_modules.halo_finding.api import *
Npixels=512
L=[1,1,1]
c_x =np.array( [ 0.5696202374 , 0.5330663554 , 0.4554251862 ])
c_X =np.array( [ 0.5657944233 , 0.524785043 , 0.4587818409 ])
for i in range(42,41,-1):
        t1="RD00%s"%i
        t2="RedshiftOutput00%s"%i
        pf=load(t1+'/'+t2)

W=1/pf["Mpc"]
c=(c_x+c_X)/2.
le=c-np.array(3*[2])/pf['Mpc']
re=c+np.array(3*[2])/pf['Mpc']

region=pf.h.region(c, le,re)

region=pf.h.region(c, le,re,fields="particle_density" )
mi,ma=region.quantities["Extrema"]("particle_density")[0]
mi=-24
ma=np.log10(ma)
tf = ColorTransferFunction((mi,ma))
tf.add_layers(5, w=0.02, colormap="spectral")
cam=region.pf.h.camera(c, L, W, Npixels,
tf,fields=["particle_density"],log_fields=True)
cam.snapshot("%s_volume_rendered.png" % pf, clip_ratio=8.0)

-Mohammad


On Wed, Sep 4, 2013 at 1:13 PM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Mohammad,
>
> You have to tell the transfer function that you want some levels to
> correspond to various colors.  An easy way to do that is with
> tf.add_layers().  Otherwise, the transfer function is blank, and it
> won't update the image as the rays traverse the domain.
>
> -Matt
>
> On Wed, Sep 4, 2013 at 1:04 PM, mohammad safarzadeh
> <mtsafarzadeh at gmail.com> wrote:
> > Hi,
> > I am trying to do VR on a halo in my zoom-in region which is a dark
> matter
> > only sim, but I get a black image when I try this:
> >
> > L=[1,1,1]
> >
> > W=1/pf["Mpc"]
> >
> > n [16]: mi,ma=region.quantities["Extrema"]("particle_density")[0]
> >
> >
> > In [17]: mi
> >
> > Out[17]: 0.0
> >
> >
> > In [18]: ma
> >
> > Out[18]: 4.5282895435060503e-24
> >
> >
> > In [21]: np.log10(ma)
> >
> > Out[21]: -23.344065811694637
> >
> >
> > mi=-24
> >
> > ma=np.log10(ma)
> >
> > tf = ColorTransferFunction((mi,ma))
> >
> > cam=region.pf.h.camera(c, L, W, Npixels,
> > tf,fields=["particle_density"],log_fields=True)
> >
> >
> > ImageArray([[[ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         ...,
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.]],
> >
> >
> >        [[ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         ...,
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.],
> >
> >         [ 0.,  0.,  0.,  1.]],….
> >
> >
> > what is the mistake that I am doing?
> >
> >
> > -Regards,
> >
> > Mohammad
> >
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130904/0c66a848/attachment.htm>


More information about the yt-users mailing list