Le 21 déc. 2014 13:23, "Jason Furtney" <jkfu...@gmail.com> a écrit :
>
> Dear Geordie McBain,
>
> Thank you for your enthusiasm for this module and for your recent pull
> request. Sorry for my delay in getting back to you.
>
> I added the feature of allowing the grid spacing to be different in
> different directions as an after-thought when I first wrote this
> module. I agree this is confusing and if you have a proposal to
> improve it or to clarify the documentation go ahead. I need to spend
> some more time looking to answer your question properly. The original
> intention was when dx is an array-like it represent the grid spacing
> in the x, y and z directions. Why the x and y are flipped in the
> meshgrid call was confusing when I was first looking at it.
Hello. I looked into this a bit more on Friday and did a few experiments on anisotropic two-dimensional grids. I realized that the intention of sfkmm is obvious (elements of dx correspond to dimensions), that its behaviour is correct, and that it's the default behaviour of numpy.meshgrid (doubtless under the unfortunate influence of the MATLAB function of the same name) that's confusing. At least numpy.meshgrid offers indexing='xy' as an option. Provided I used that, skfmm worked perfectly.
Thus I don't think that the source code needs any modification (except for the future generalization that you mention to nonuniform as opposed to merely anisotropic spacing). I propose to modify the examples in the documentation to use indexing='ij' where necessary, and possibly also using a nonsquare array, e.g. ones((4, 3)) instead of ones ((3, 3)), to emphasize that the elements of phi should be indexed by geometrical dimension rather than as if it were a linear-algebraic matrix.
I think that these considerations also mean that the output of distance should be transposed (and maybe flipped?) for printing if it is to be correctly oriented. Of course the first example should still be kept as simple as possible; skfmm's clean simple interface is a real plus.