MCPcopy Index your code
hub / github.com/numpy/numpy / _convolve_or_correlate

Function _convolve_or_correlate

numpy/ma/core.py:8352–8368  ·  view source on GitHub ↗

Helper function for ma.correlate and ma.convolve

(f, a, v, mode, propagate_mask)

Source from the content-addressed store, hash-verified

8350
8351
8352def _convolve_or_correlate(f, a, v, mode, propagate_mask):
8353 """
8354 Helper function for ma.correlate and ma.convolve
8355 """
8356 if propagate_mask:
8357 # results which are contributed to by either item in any pair being invalid
8358 mask = (
8359 f(getmaskarray(a), np.ones(np.shape(v), dtype=bool), mode=mode)
8360 | f(np.ones(np.shape(a), dtype=bool), getmaskarray(v), mode=mode)
8361 )
8362 data = f(getdata(a), getdata(v), mode=mode)
8363 else:
8364 # results which are not contributed to by any pair of valid elements
8365 mask = ~f(~getmaskarray(a), ~getmaskarray(v), mode=mode)
8366 data = f(filled(a, 0), filled(v, 0), mode=mode)
8367
8368 return masked_array(data, mask=mask)
8369
8370
8371def correlate(a, v, mode='valid', propagate_mask=True):

Callers 2

correlateFunction · 0.85
convolveFunction · 0.85

Calls 5

getmaskarrayFunction · 0.85
getdataFunction · 0.85
filledFunction · 0.85
fFunction · 0.50
shapeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…