Okay, makes sense. Thank you.<br><br>Nathan<br><br><div class="gmail_quote">On Thu, Jun 14, 2012 at 1:57 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nathan,<br>
<div class="im"><br>
On Thu, Jun 14, 2012 at 1:55 PM, Nathan Butcher <<a href="mailto:butchernate@gmail.com">butchernate@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
</div><div class="im">> The images are the same as before. I will try to create a simpler test case<br>
> to check this field and see if it behaves properly. Thank you for all of the<br>
> help.<br>
<br>
</div>Okay, I figured out what is going on.<br>
<br>
Without spatial validation, this sequence:<br>
<br>
new_field = na.zeros(data['PotentialField'].shape)<br>
new_field[1:-1] = data["PotentialField"][sl_right]/ds<br>
new_field[1:-1] -= data["PotentialField"][sl_left]/ds<br>
<br>
is operating on 1D, mostly unsorted arrays.  The points next to each<br>
other are probably not in x-order, so this doesn't do much.  When you<br>
do validate spatial, it oeprates on a grid-by-grid basis, and adjacent<br>
points are adjacent spatially.<br>
<br>
So this is okay, and the correct result is the one with the<br>
ValidateSpatial call.<br>
<br>
-Matt<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Nathan<br>
><br>
><br>
> On Thu, Jun 14, 2012 at 1:44 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br>
>><br>
>> Hi Nathan,<br>
>><br>
>> How are you centering the slice?  This looks somewhat like a<br>
>> difference in the centering.  Can you try something like:<br>
>><br>
>> pc = PlotCollection(pf, 'c')<br>
>> pc.add_slice("GravGradient", "x")<br>
>> pc.save()<br>
>><br>
>> for both the old and new, and see if they look similar?<br>
>><br>
>> -Matt<br>
>><br>
>> On Thu, Jun 14, 2012 at 1:41 PM, Nathan Butcher <<a href="mailto:butchernate@gmail.com">butchernate@gmail.com</a>><br>
>> wrote:<br>
>> > The colorbar scaling is similar, and the values have changed. It could<br>
>> > be a<br>
>> > large shift. It is hard for me to tell from the plot. I have attached<br>
>> > the<br>
>> > updated plot.<br>
>> ><br>
>> > Nathan<br>
>> ><br>
>> ><br>
>> > On Thu, Jun 14, 2012 at 1:32 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> On Thu, Jun 14, 2012 at 1:31 PM, Nathan Butcher <<a href="mailto:butchernate@gmail.com">butchernate@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Hello Matt,<br>
>> >> ><br>
>> >> > Thanks, that seems to have done fixed the issue. I am seeing that the<br>
>> >> > graph<br>
>> >> > looks very different now compared to before. Would forgetting the<br>
>> >> > extra<br>
>> >> > zone<br>
>> >> > change the appearance of the overall plot beyond edge effects?<br>
>> >><br>
>> >> It should shift the derivative considerably, but the only other<br>
>> >> differences should be at the edges.  Are the actual values different,<br>
>> >> or is the colorbar scaling differently now?<br>
>> >><br>
>> >> ><br>
>> >> > Thank you,<br>
>> >> > Nathan Butcher<br>
>> >> ><br>
>> >> ><br>
>> >> > On Thu, Jun 14, 2012 at 1:21 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >><br>
>> >> >> Hi Nathan,<br>
>> >> >><br>
>> >> >> Yup, I agree with your assessment -- there's an edge effect.  You<br>
>> >> >> need<br>
>> >> >> one more thing to get the derivative field working; you need to tell<br>
>> >> >> yt to give you an extra zone in each direction.  You can do that by<br>
>> >> >> changing your decorator for the derived field to:<br>
>> >> >><br>
>> >> >> @derived_field(name = "GravGradientX", validators =<br>
>> >> >> [ValidateSpatial(1)])<br>
>> >> >><br>
>> >> >> I don't believe you need any additional changes inside the source<br>
>> >> >> code.  Let us know if that fixes it!<br>
>> >> >><br>
>> >> >> -Matt<br>
>> >> >><br>
>> >> >> On Thu, Jun 14, 2012 at 1:14 PM, Nathan Butcher<br>
>> >> >> <<a href="mailto:butchernate@gmail.com">butchernate@gmail.com</a>><br>
>> >> >> wrote:<br>
>> >> >> > Hello,<br>
>> >> >> ><br>
>> >> >> > Using an Enzo dataset, I have written a function to find the<br>
>> >> >> > derivative<br>
>> >> >> > in<br>
>> >> >> > the x-direction of a field. When I try to plot the derivative, I<br>
>> >> >> > see<br>
>> >> >> > lines<br>
>> >> >> > that throughout the plot that I'm guessing are due to the edges of<br>
>> >> >> > cells.<br>
>> >> >> > The attached plot is a slice of the x-direction derivative of the<br>
>> >> >> > PotentialField viewed down the x-axis, but this error appears in<br>
>> >> >> > plots<br>
>> >> >> > for<br>
>> >> >> > density and pressure as well. I am new to using yt, and I am not<br>
>> >> >> > sure<br>
>> >> >> > what<br>
>> >> >> > is causing this.<br>
>> >> >> ><br>
>> >> >> > Thank you,<br>
>> >> >> > Nathan Butcher<br>
>> >> >> ><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>
>> >> >> _______________________________________________<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>
>> >> ><br>
>> >> ><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>
>> >> _______________________________________________<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>
>> ><br>
>> ><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>
>> _______________________________________________<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>
><br>
><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>
_______________________________________________<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>
</div></div></blockquote></div><br>