[yt-users] Creating 1-D Radial Profile

Nathan Goldbaum nathan12343 at gmail.com
Sat Dec 13 22:22:07 PST 2014


On Sat, Dec 13, 2014 at 9:59 PM, Lu, Yinghe <ylv4 at illinois.edu> wrote:
>
>  Hi everyone,
>
>         I have a question using the create_profile routine. I am currently
> using yt for analyzing FLASH data (creating 1D radial density profile
> namely). Now I am encountering trouble where after creating the profile,
> the field value is outputting a lot of zeros around the domain centre.
>
> ds = yt.load(filename)
> sphere = ds.sphere(ds.domain_center, (300.0, "kpc"))
> print sphere["density"][1:50].value
>

Here you're printing out the result of the selecting on a data object.
You're not getting any zeros back because your data on-disk doesn't have
any zeros.


> profile = yt.create_profile(sphere, "radius", "density",
>                                    weight_field = "cell_volume",units =
> {'radius': 'kpc'})
> print profile["density"][1:50].value
>
>
Here you're printing out the result of the profiling operation.  A yt
profile is at its heart a 2D histogram - a binned sum of cell field values,
with bins spaced regularly in either linear space or log space.  For both
radius and density, the default is log space.

What's happening in your case is there some of the radial histogram bins
(the ones that show zero densities), aren't selecting any data.  A cell
falls into a radial bin based on the position of its center; yt profiles do
not do not split cells between profile bins, a cell either falls completely
in one bin or another.  This choice not to do sub-sampling is a core design
decision in yt.

Often this happens with radial profiles if your radial bins are evenly
spaced in log space rather than linear space, and you are working with data
that doesn't have a huge amount of spatial dynamic range.

I bet it will look a lot nicer if you do:

profile = yt.create_profile(sphere, "radius", "density",
                                   weight_field = "cell_volume",
                                   units = {'radius': 'kpc'},
logs={'radius':False})


>     After creating the sphere, the field value has no zeros; they only
> start to occur after creating the profile. I have used other methods to
> check my simulation and there are no zero densities involved. So I was
> wondering if there is something in the create_profile routine (maybe the
> weighting or binning) is causing this, and how could I get rid of the them?
>
>
>       Thanks all,
>       Yinghe
>
>
> _______________________________________________
> 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/20141214/2d5ba65a/attachment.htm>


More information about the yt-users mailing list