Added tests for the mood function, that check generalization to 2d case and effect of changing parameter order
generalize mood function to 2d case
started generalization of mood's test to n-d case, created function mood_nd
add function mood_nd and tests for it
Optimize the code using np.rollaxis (proposed by josef-pkt)
Start correction according to Josef's and Ralph's comments
pep8 and remove temp array as suggested by Ralf(in the discussion)
delete other_axis, since not needed
MAINT: some cleanup of stats.mood docstring and code.

Also return floats instead of 0-D arrays, for backwards compatibility.
TST: consolidate stats.mood tests
DOC: add a doctest example to stats.mood
Merge branch 'pr/2601' into master.

Reviewed at https://github.com/scipy/scipy/pull/2601
TST: Added cKDTree vs KDTree sparse_distance_matrix consistency check, tweaked radius
BUG: Fixed cKDTree vs KDTree sparse_distance_matrix discrepancy

Fixed improperly set matrix indexes and adjusted distance to be
consistent with KDTree sparse_distance_matrix results
TST: add random seeds and use correct comparisons in spatial.kdtree tests.

Also some PEP8 edits.
BUG: Fixed a few error messages in scipy.spatial.ckdtree

Also reviewed bug-fixes to sparse_distance_matrix by Przemek Porebski
and fixes to tests by Ralf Gommers.
Merge branch 'pr/2602' into master

Reviewed at https://github.com/scipy/scipy/pull/2602