def _icfmedian(i, stack, weight=None, cfwidth=None): ufilt = 3 # set this to help with extreme over/under corrections return ndi.median_filter( ndi.uniform_filter(stack, (ufilt, 1)), (cfwidth, 1))