Skip to content

Commit

Permalink
ENH: retune apply_along_axis nanmedian cutoff
Browse files Browse the repository at this point in the history
Old value was erroneously obtained on a sorted array which is a best
case for the median of 3 pivoted introsort.
  • Loading branch information
juliantaylor committed Dec 17, 2016
1 parent 2a1e5a6 commit 7434633
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numpy/lib/nanfunctions.py
Expand Up @@ -869,7 +869,8 @@ def _nanmedian(a, axis=None, out=None, overwrite_input=False):
else:
# for small medians use sort + indexing which is still faster than
# apply_along_axis
if a.shape[axis] < 1000:
# benchmarked with shuffled (50, 50, x) containing a few NaN
if a.shape[axis] < 600:
return _nanmedian_small(a, axis, out, overwrite_input)
result = np.apply_along_axis(_nanmedian1d, axis, a, overwrite_input)
if out is not None:
Expand Down

0 comments on commit 7434633

Please sign in to comment.