Creating 1-D Radial Profile
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 profile = yt.create_profile(sphere, "radius", "density", weight_field = "cell_volume",units = {'radius': 'kpc'}) print profile["density"][1:50].value 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
On Sat, Dec 13, 2014 at 9:59 PM, Lu, Yinghe
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Thanks a lot Nathan! Looks like it's working now.
Yinghe
________________________________
From: Nathan Goldbaummailto:nathan12343@gmail.com
Sent: 12/14/2014 0:22
To: Discussion of the yt analysis packagemailto:yt-users@lists.spacepope.org
Subject: Re: [yt-users] Creating 1-D Radial Profile
On Sat, Dec 13, 2014 at 9:59 PM, Lu, Yinghe
participants (2)
-
Lu, Yinghe
-
Nathan Goldbaum