[Numpy-discussion] Grid indexing

Davide davide.lasagna@polito...
Tue Mar 1 01:23:57 CST 2011

I had a similar problem some time ago,
which i solved by building my own class containing
an n-d array and an n-d interpolator. Then i overrided the __getitem__ 
special method
so that i could use a fancy notation like the one you want. Inside the 
method i used
n-d dimensional interpolation of the nd.array to get function evaluation 
at the point/s specified.

Maybe this can help,

>>> I have a n dimensional grid. The grids axes are linear but not
>>> intergers. Let's say I want the value in gridcell [3.2,-5.6,0.01]. Is
>>> there an easy way to transform the index? Do I have to write my own
>>> class to accomplish this. Is there an easy way in numpy to accomplish
>>> this. Can I give functions to transform the index somehow to the numpy
>>> array?

More information about the NumPy-Discussion mailing list