def crossings_nonzero_pos2neg(data):
    """
        Find `indices of zero crossings from positive to negative values <http://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python>`_.

        :param data: numpy array of floats
        :type data: numpy array of floats
        :return crossings: crossing indices to data
        :rtype crossings: numpy array of integers

        :Examples:

        >>> import numpy as np
        >>> from mhealthx.signals import crossings_nonzero_pos2neg
        >>> data = np.random.random(100)
        >>> crossings = crossings_nonzero_pos2neg(data)

    """
    import numpy as np
    if isinstance(data, np.ndarray):
        pass
    elif isinstance(data, list):
        data = np.asarray(data)
    else:
        raise IOError('data should be a numpy array')
    pos = data > 0
    crossings = (pos[:-1] & ~pos[1:]).nonzero()[0]
    return crossings
