[Numpy-discussion] how to name "contagious" keyword in np.ma.convolve
allanhaldane at gmail.com
Sat Oct 15 21:21:13 EDT 2016
On 10/14/2016 07:49 PM, Juan Nunez-Iglesias wrote:
> +1 for propagate_mask. That is the only proposal that immediately makes
> sense to me. "contagious" may be cute but I think approximately 0% of
> users would guess its purpose on first use.
> Can you elaborate on what happens with the masks exactly? I didn't quite
> get why propagate_mask=False was unintuitive. My expectation is that any
> mask present in the input will not be set in the output, but the mask
> will be "respected" by the function.
Here's an illustration of how the PR currently works with convolve,
using the name "propagate_mask":
>>> m = np.ma.masked
>>> a = np.ma.array([1,1,1,m,1,1,1,m,m,m,1,1,1])
>>> b = np.ma.array([1,1,1])
>>> print np.ma.convolve(a, b, propagate_mask=True)
[1 2 3 -- -- -- 3 -- -- -- -- -- 3 2 1]
>>> print np.ma.convolve(a, b, propagate_mask=False)
[1 2 3 2 2 2 3 2 1 -- 1 2 3 2 1]
> On 15 Oct. 2016, 5:23 AM +1100, Allan Haldane <allanhaldane at gmail.com>,
>> I think the possibilities that have been mentioned so far (here or in
>> the PR) are:
>> `propogate_mask=False` seemed to imply that the mask would never be set,
>> so Eric also suggested
>> propagate_mask='any' or propagate_mask='all'
>> I would be happy with 'propagated=False' as the name/default. As Eric
>> pointed out, most MaskedArray functions like sum implicitly don't
>> propagate, currently, so maybe we should do likewise here.
More information about the NumPy-Discussion