Fix test errors with numpy master

Also some cleanup in ndimage tests.