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

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Oct 18 13:49:13 EDT 2016

On Tue, Oct 18, 2016 at 1:30 PM,  <josef.pktd at gmail.com> wrote:
> On Tue, Oct 18, 2016 at 1:25 PM,  <josef.pktd at gmail.com> wrote:
>> On Mon, Oct 17, 2016 at 1:01 PM, Pierre Haessig
>> <pierre.haessig at crans.org> wrote:
>>> Hi,
>>> 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.
> as aside: statsmodels has now an option for acf and similar
>     missing : str
>         A string in ['none', 'raise', 'conservative', 'drop']
> specifying how the NaNs
>         are to be treated.

aside to the aside: statsmodels was just catching up in this

The original for masked array acf including correct counting of "valid" terms is


(which I looked at way before statsmodels had any acf)


> Josef
>>> 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...."
>>> just thinking of yet another keyword name  : ignore_masked (or drop_masked)
>>> If I remember well, in R it is dropna. It would be nice if the boolean
>>> switch followed the same logic.
>>> Now of course the convolution function is more general than just
>>> autocorrelation...
>> I think "drop" or "ignore" is too generic, for correlation it would be
>> for example ignore pairs versus ignore cases.
>> To me propagate sounds ok to me, but something with `valid` might be
>> more explicit for convolution or `correlate`, however `valid` also
>> refers to the end points, so maybe valid_na or valid_masked=True
>> Josef
>>> best,
>>> Pierre
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> https://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list