<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
</head>
<body>
<div>
<div style="font-family:Calibri,sans-serif; font-size:11pt">Thanks a lot Nathan! Looks like it's working now.<br>
<br>
Yinghe</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">From:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:nathan12343@gmail.com">Nathan Goldbaum</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Sent:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">ý12/ý14/ý2014 0:22</span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">To:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:yt-users@lists.spacepope.org">Discussion of the yt analysis package</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Subject:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">Re: [yt-users] Creating 1-D Radial Profile</span><br>
<br>
</div>
<div>
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Dec 13, 2014 at 9:59 PM, Lu, Yinghe <span dir="ltr">
<<a href="mailto:ylv4@illinois.edu" target="_blank">ylv4@illinois.edu</a>></span> wrote:
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-color:rgb(204,204,204); border-left-style:solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
Hi everyone,<br>
<br>
        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.<br>
<br>
ds = yt.load(filename)<br>
sphere = ds.sphere(ds.domain_center, (300.0, "kpc")) <br>
print sphere["density"][1:50].value<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>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.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-color:rgb(204,204,204); border-left-style:solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
profile = yt.create_profile(sphere, "radius", "density",<br>
                                   weight_field = "cell_volume",units = {'radius': 'kpc'})<br>
print profile["density"][1:50].value<br>
<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>I bet it will look a lot nicer if you do:</div>
<div><br>
</div>
<div><span style="color:rgb(0,0,0); font-family:Tahoma; font-size:13px">profile = yt.create_profile(sphere, "radius", "density",</span><br style="color:rgb(0,0,0); font-family:Tahoma; font-size:13px">
<span style="color:rgb(0,0,0); font-family:Tahoma; font-size:13px">                              </span><span style="color:rgb(0,0,0); font-family:Tahoma; font-size:13px">     weight_field = "cell_volume",</span></div>
<div><span style="color:rgb(0,0,0); font-family:Tahoma; font-size:13px">                                   units = {'radius': 'kpc'}, logs={'radius':False})</span><br>
</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-color:rgb(204,204,204); border-left-style:solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
<br>
    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?<br>
<br>
<br>
      Thanks all,<br>
      Yinghe<br>
    <br>
</div>
</div>
<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>