[yt-dev] field interpolater question

Britton Smith brittonsmith at gmail.com
Wed May 8 05:17:05 PDT 2013


Thanks, I just wanted to make sure there wasn't a downside I was missing.
I'll to this and add some tests, too.
Thanks!


On Wed, May 8, 2013 at 7:54 AM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Britton,
>
> On Tue, May 7, 2013 at 5:48 PM, Britton Smith <brittonsmith at gmail.com>
> wrote:
> > Hi all,
> >
> > I'm working on some analysis that requires interpolating from some data
> > tables.  Normally, I would use the Unilinear, Bilinear, and
> > TrilinearFieldInterpolators in yt, but they only accept evenly spaced
> bins,
> > which I don't have.  It actually looks like the cython function which
> does
> > the calculation accepts the bins as arrays, which the python function
> > creates from the given bounds.
>
> That's right, the Python code assumes evenly spaced bins.  Reading
> over the Cython, my initial thought was that it wouldn't allow for
> this, but it totally does:
>
> dx_inv = 1.0 / (x_bins[x_i+1] - x_bins[x_i])
>
> So yeah, I agree, it can handle it.  As long as the bins are correctly
> identified (which it does using digitize) it should be fine.
>
> >
> > I'd like to change this behavior to allow me to give the bins to the
> python
> > function.  Currently, the call to create the interpolator looks like
> this:
> > BilinearInterpolator(table, boundaries, field_names)
> >
> > where boundaries is (x_0, x_n, y_0, y_n) or the min/max of the x and y
> bins.
> > Would it be ok if I changed this so that boundaries can also be a pair of
> > arrays?  I would just have the function check and still maintain the old
> way
> > as well.  By doing it this way, it shouldn't break backward compatibility
> > either.  Would this be an ok solution?
>
> Yup, this would be nice -- thanks.  Can you update the tests to
> reflect this, too?  The interpolators are tested somewhat extensively
> with random values.
>
> -Matt
>
> >
> > Britton
> >
> > _______________________________________________
> > 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/20130508/33c9bed6/attachment.htm>


More information about the yt-dev mailing list