MAINT: numpy 1.5.x compat: remove usage of np.count_nonzero
MAINT: numpy 1.5.x compat: work around usage of `casting` kw in np.can_cast.
MAINT: numpy 1.5.x compat: avoid assigning a complex number to real array.
MAINT: numpy 1.5.x compat: work around changed behavior of casting functions.

In 1.5.x the result of the last line gives a problem::

    >>> datsp.dtype == np.dtype('int32')
    True
    >>> np.issubdtype(np.dtype('int32'), np.int_)
    True
    >>> np.issubdtype(datsp.dtype, np.int_)
    False

Also, in 1.5.x this happens:

    >>> np.find_common_type([np.bool, np.bool], [])
    dtype('int8')

Result from 1.6.x is dtype('bool').
Merge pull request #2678 from rgommers/numpy-151-compat

Fix incompatibilities with numpy 1.5.x.  Closes gh-2677.