[yt-dev] Numpy-like ops YTEP

Matthew Turk matthewturk at gmail.com
Fri Sep 25 16:45:01 PDT 2015


Hi everyone,

Thanks for the feedback -- I've made a bunch of changes and additions.
One thing I wanted to ask was about 3D slicing that includes steps.
For instance, in numpy style:

ds = yt.load(...)
ds.d[ (-5, 'km') : (5, 'km') : 128j, (-10, 'km') : (10, 'km') : 256j,
(-2.5, 'km') : (2.5, 'km'): 64j]

this should return a 128x256x64 3D array.  But, how do we generate that?

The obvious thing would be to do either covering grid or arbitrary
grids.  The former requires alignment with cell boundaries, and the
latter currently only supports particles.  I think "arbitrary_grid"
maps a lot more naturally to the situation, though.  So it would
require implementing mesh fields in the arbitrary_grid object, which
is fine, but it's not clear to me the right *way* to do that.  I think
the choice might be between nearest neighbor and trilinear
interpolation.  So, for the *default* behavior, should we do:

 * Trilinear interpolation (maybe nicer, but also subject to
crazytimes with stuff that isn't a volume quantity, like mass)
 * Nearest neighbor (way, way faster, but also lower quality values in
many cases)?

My inclination is #2, but I wanted a sanity check...

-Matt

On Mon, Sep 21, 2015 at 3:17 PM, Matthew Turk <matthewturk at gmail.com> wrote:
> Hi all,
>
> I'd very much appreciate feedback on this YTEP:
>
> https://bitbucket.org/yt_analysis/ytep/pull-requests/55/ytep-0026-numpy-like-operations/diff
>
> The related PR that starts implementing them is here:
>
> https://bitbucket.org/yt_analysis/yt/pull-requests/1763/wip-proposed-set-of-new-numpy-like-ops/diff
>
> Two things that I think need some bikeshedding -- histogram and the
> step argument to slicing.
>
> -Matt



More information about the yt-dev mailing list