[Numpy-discussion] Removing scipy.stsci was [Re: [SciPy-dev] Deprecate chararray [was Plea for help]]
Vincent Schut
schut at sarvision.nl
Mon Aug 24 09:09:23 EDT 2009
Stéfan van der Walt wrote:
> Hi Vincent
>
> 2009/8/21 Vincent Schut <schut at sarvision.nl>:
>> I know it probably will be a pretty involved task, as ndimage comes from
>> numarray and seems to be largely implemented in C. But I really wanted
>> to raise the issue now the image processing subject turns up once again,
>> and hope some folks with more/better programming skills than me might
>> like the idea...
>
> What would you like the behaviour to be? For example, how should
> ndimage.zoom handle these missing values?
Good question :-)
I see 2 possibilities, both of them can be usefull in their own
situations. Note that I am really not into splines mathematically, so my
suggestions and terminology might not apply at all...
1. for any output cell that depends on a missing value in the input,
return a missing/masked/NaN value, but (and I think this differs from
the current implementation), for any output cell which could be
calculated, return a proper output. Currently any array that contains
one or more NaNs will give an output array full of NaNs (except for
order=0, which shows this exact behaviour already). But maybe that's
inherent to splines interpolation?
This would at least allow input arrays with missing values (or masked
arrays) to be used; this behaviour could be extended to many of the
ndimage functions, like the kernel based stuff. FFT based convolutions
could be another story altogether...
2. In case of zoom&co: only use the non-missing values to calculate the
splines, thus effectively inter/extrapolating missing/masked values in
the process. This probably raises a lot of new questions about the
implementation. It would however be highly usefull for me... I don't
know if a irregular grid based splines interpolation implementation exists?
What I currently do in a case like this (zooming an array with missing
values) is first fill the missing values by using ndimage.generic_filter
with a kernel function that averages the non-missing values in the
moving window. This works as long as there are not too many missing
values next to each other, however it is very slow...
I think that, if an effort like this is to be made, a thorough
discussion on the possible behaviours of ndimage functions with missing
values should take place on one of the numpy/scipy related mailing
lists. I'm sure I'm not the only one with ideas and/or use cases for
this, and I'm certainly not someone with a lot of theoretical knowledge
in this area.
Regards,
Vincent.
>
> Regards
> Stéfan
More information about the NumPy-Discussion
mailing list