def median(mzs, intensities, w_size=3):
    """
    apply median filter
    :param mzs:  numpy array numpy array of mz values
    :param counts:  numpy array numpy array of values to smooth
    :param w_size:  int window size
    :return: mzs: numpy array
    :return: counts: numpy array
    """
    import scipy.signal as signal
    return mzs, signal.medfilt(intensities, kernel_size=w_size)
