[yt-dev] summing over phase plot and total quantity discrepancies

Geoffrey So gsiisg at gmail.com
Wed Mar 6 18:08:25 PST 2013


The issue is resolved.

It turns out that PlotCollection uses the min/max values of the x,y axes as
bin edges so the edge values may sometimes not get included correctly.

By using BinnedProfile2D and add_field with weight=None, I can get
consistent answers as compared to using TotalQuantity by either:

1) expanding the min/max by a tiny fraction
2) switch end_collect=True (which places values outside the bins to the
edges)

Thanks Matt, mystery solved.

From
G.S.

On Wed, Mar 6, 2013 at 4:41 PM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Geoffrey
>
> On Wed, Mar 6, 2013 at 4:38 PM, Geoffrey So <gsiisg at gmail.com> wrote:
> > I'm trying to use add_phase_object to get a 2D distribution and summing
> over
> > the y axis to see the total quantity in each x bins.  I am using the old
> > plot collection to do the phase distribution because it is parallelized,
> the
> > binned2D is serial I believe.
>
> If you specify lazy_reader = True it will be run in parallel.
>
> >
> > I'm checking the numbers by using TotalQuantity which sums all the cells
> in
> > the simulation, and I should get the same number when I sum over the
> color
> > axis of the phase plot (I'm assuming this is true, can someone also
> verify
> > the logic?), but I am getting slightly different number.  More curious,
> is
> > when the y axis is the same as the color axis, I get different numbers as
> > when the axis names are different.  I first saw the discrepancy using
> other
> > fields, but in this script I am demonstrating with fields that everyone
> > should have access to in an Enzo simulation.
> >
> > http://paste.yt-project.org/show/3222/
> >
> > Can someone run the script very quick and verify that they get different
> > numbers printed on screen?
>
> I can't right now, but what if you specify a dtype in the call to
> sum() ?  For instance:
>
> .sum(dtype="float64")
>
> -Matt
>
> >
> > Is there an easier way to do what I'm trying to do in parallel?
> >
> > From
> > G.S.
> >
> > PS: This issue is in both dev-yt I have on my laptop and on Gordon
> >
> > my laptop uses:
> > changeset:   6566:6794b2798b5a
> > branch:      yt
> > tag:         tip
> > user:        Matthew Turk <matthewturk at gmail.com>
> > date:        Wed Oct 24 15:58:34 2012 -0400
> > summary:     Swap out get_smallest_dx for 8192.  Should fix the buildbot.
> > Gordon I have:
> > changeset:   7124:4151cc9ff9b2
> > branch:      yt
> > tag:         tip
> > user:        Kacper Kowalik <xarthisius.kk at gmail.com>
> > date:        Sat Feb 02 11:03:07 2013 +0100
> > files:       yt/utilities/logger.py
> > description:
> > Add `NullHandler` to `ytLogger` when stream logging is suppresed. Fixes
> #492
> >
> > _______________________________________________
> > yt-dev mailing list
> > yt-dev at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
> >
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20130306/16f63e96/attachment.html>


More information about the yt-dev mailing list