[yt-users] ProfileND binning

Nathan Goldbaum nathan12343 at gmail.com
Sun Apr 17 19:29:12 PDT 2016


On Sun, Apr 17, 2016 at 5:47 PM, bh11e <bh11e at my.fsu.edu> wrote:

> Hi,
>
> I'm creating 1D profiles with as much bins as the top grid zones along the
> same axis:
>
> ProfilePlot( ds.all_data(), 'z', field_name,
> weight_field=weight_field_name,
>                       x_log=False, y_log={field_name:False},
>                       n_bins=ds.domain_dimensions[2] )
>
> i.e. each bin should include a 1-zone thick slice of the top grid. All
> profiles created this way end up with the first and the last bins equal to
> zero. Am I not doing something wrong? Or is it because the bins' boundaries
> are created to be centered on the grid zones, This way the end grid zones
> fall on a bin boundary and are being filtered by the following lines :
>
> profiles.py:
> class ProfileND:
>     ...
>     def _filter(self, bin_fields):
>         ...
>         for (mi, ma), data in zip(self.bounds, bin_fields):
>             filter &= (data > mi)
>             filter &= (data < ma)
> ...
>
> The rightmost zone seems to be filtered out a second time by the
> np.digitize call in the following code:
>
> profiles.py:
> class Profile1D:
>     ....
>     def _bin_chunk(self, chunk, fields, storage):
>         ...
>         bin_ind = np.digitize(bf_x, self.x_bins) - 1
> ...
>
> Above the 'right' argument to digitize is not being set and defaults to
> False (see:
> http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.digitize.html
> )
>
> My solution was to modify the "mi" and "ma" values (in the first code
> snippet) to match the grid left and right edges but that of course is a
> workaround only for this particular case. Any thoughts?
>
> Thanks,
> --Boyan Hristov
>

Hi Boyan,

Thanks for tracking down in the yt codebase where this is happening. Would
you be interested in submitting a pull request to fix this issue? I'd be
happy to share more information about contributing, but you can also look
at the developer guide:

http://yt-project.org/docs/dev/developing/developing.html#how-to-develop-yt

While this is probably a behavior change, I think it might be a worthwhile
one. Submitting a pull request will at least allow us to see what tests
fail (if any) and evaluate the potential impact.

-Nathan


> _______________________________________________
> 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/20160417/9e12e003/attachment.htm>


More information about the yt-users mailing list