Find hard peaks and soft peaks in a signal, defined as follows:

    - Hard peak: a peak that is either /\ or \/
    - Soft peak: a peak that is either /-*\ or \-*/
      In this case we define the middle as the peak

    Parameters
    ----------
    sig : np array
        The 1d signal array

    Returns
    -------
    hard_peaks : numpy array
        Array containing the indices of the hard peaks:
    soft_peaks : numpy array
        Array containing the indices of the soft peaks

def find_peaks(sig):
    """
    Find hard peaks and soft peaks in a signal, defined as follows:

    - Hard peak: a peak that is either /\ or \/
    - Soft peak: a peak that is either /-*\ or \-*/
      In this case we define the middle as the peak

    Parameters
    ----------
    sig : np array
        The 1d signal array

    Returns
    -------
    hard_peaks : numpy array
        Array containing the indices of the hard peaks:
    soft_peaks : numpy array
        Array containing the indices of the soft peaks

    """
    if len(sig) == 0:
        return np.empty([0]), np.empty([0])

    tmp = sig[1:]
    tmp = np.append(tmp, [sig[-1]])
    tmp = sig - tmp
    tmp[np.where(tmp>0)] = 1
    tmp[np.where(tmp==0)] = 0
    tmp[np.where(tmp<0)] = -1
    tmp2 = tmp[1:]
    tmp2 = np.append(tmp2, [0])
    tmp = tmp-tmp2

    hard_peaks = np.where(np.logical_or(tmp==-2, tmp==+2))[0] + 1
    soft_peaks = []

    for iv in np.where(np.logical_or(tmp==-1,tmp==+1))[0]:
        t = tmp[iv]
        i = iv+1
        while True:
            if i==len(tmp) or tmp[i] == -t or tmp[i] == -2 or tmp[i] == 2:
                break
            if tmp[i] == t:
                soft_peaks.append(int(iv + (i - iv)/2))
                break
            i += 1
    soft_peaks = np.array(soft_peaks, dtype='int') + 1

    return hard_peaks, soft_peaks