[Numpy-discussion] how to name "contagious" keyword in np.ma.convolve

Allan Haldane allanhaldane at gmail.com
Tue Oct 18 19:18:18 EDT 2016

On 10/17/2016 01:01 PM, Pierre Haessig wrote:
> Le 16/10/2016 à 11:52, Hanno Klemm a écrit :
>> When I have similar situations, I usually interpolate between the valid values. I assume there are a lot of use cases for convolutions but I have difficulties imagining that ignoring a missing value and, for the purpose of the computation, treating it as zero is useful in many of them. 
> When estimating the autocorrelation of a signal, it make sense to drop
> missing pairs of values. Only in this use case, it opens the question of
> correcting or not correcting for the number of missing elements  when
> computing the mean. I don't remember what R function "acf" is doing.
> Also, coming back to the initial question, I feel that it is necessary
> that the name "mask" (or "na" or similar) appears in the parameter name.
> Otherwise, people will wonder : "what on earth is contagious/being
> propagated...."

Based on feedback so far, I think "propagate_mask" sounds like the best
word to use. Let's go with that.

As for whether it should default to "True" or "False", the arguments I
see are:

 * False, because that is the way most functions like `np.ma.sum`
   already work, as well as matlab and octave's similar "nanconv".

 * True, because its effects are more visible and might lead to less
   surprises. The "False" case seems like it is often not what the user
   intended. Eg, it affects the overall normalization of normalized
   kernels, and the choice of 0 seems arbitrary.

If no one says anything, I'd probably go with True.


More information about the NumPy-Discussion mailing list