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

Matthew Turk matthewturk at gmail.com
Wed Sep 4 13:39:41 PDT 2013


Hi Mohammad,

On Wed, Sep 4, 2013 at 4:34 PM, mohammad safarzadeh
<mtsafarzadeh at gmail.com> wrote:
> the off-axis plot is like this:
> http://i.imgur.com/7fDuNTA.png
> so no one has done volume rendering on DM only sims?

No, probably not in the way you're describing.  You might try creating
a new field that floors to 1e-30 or something.  That should be a
hotfix for now; you could do something like:

@derived_field(name = "SomethingMeaningful")
def my_field(field, data):
    tr = data["particle_density"].copy()
    np.maximum(tr, 1e-30, tr)
    return tr

and then render that field instead.  But one issue that comes up often
is that the results of applying a continuous transfer function to a
discontinuous field (and one that is actually a realization of a
discrete distribution!) is pretty tricky, and more advanced than what
we usually do.  In the future we hope to provide flexible mechanisms
for smoothing kernels (which aren't even necessarily the best way to
do this), but as it stands rendering particle_density will probably
produce not very good looking results.

> how can I provide a 3d view of the zoom in box ( if there are alternative
> ways)?

When you say 3d, I think you mean that you want something that shows
the structure both behind and in front, in a way of showing the
structure inside.  The onion-peel approach does this, but you may be
able to communicate the information you're looking for just using
OffAxisProjection itself.

-Matt

> Regards,
>
> -Mohammad
>
>
> On Wed, Sep 4, 2013 at 3:09 PM, Sam Skillman <samskillman at gmail.com> wrote:
>>
>> Hi Mohammad,
>>
>> I just filed an issue for this, as it has to do with taking the log of a
>> field that has zeros/negatives.  There may not be a quick turnaround on
>> fixing this issue, but I've assigned it to me. I have some thoughts on how
>> to address this but it needs some more thinking.
>>
>>
>> https://bitbucket.org/yt_analysis/yt/issue/647/volume-rendering-log-fields-zeros
>>
>> Best,
>> Sam
>>
>>
>> On Wed, Sep 4, 2013 at 10:53 AM, Matthew Turk <matthewturk at gmail.com>
>> wrote:
>>>
>>> Hi Mohammad,
>>>
>>> I'm not really sure.  Try using an OffAxisProjectionPlot to see if it
>>> looks like anything.  You should just be able to specify the
>>> orientation and field, and it should give back a column density.
>>>
>>> -Matt
>>>
>>> On Wed, Sep 4, 2013 at 1:39 PM, mohammad safarzadeh
>>> <mtsafarzadeh at gmail.com> wrote:
>>> > 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
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > 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
>>
>
>
> _______________________________________________
> 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