Sorts mass and intensities arrays in descending intensity order,
        then removes low-intensity peaks from the spectrum.

        :param n_peaks: number of peaks to keep

def trim(self, n_peaks):
        """
        Sorts mass and intensities arrays in descending intensity order,
        then removes low-intensity peaks from the spectrum.

        :param n_peaks: number of peaks to keep
        """
        self.sortByIntensity()
        ims.spectrum_trim(self.ptr, n_peaks)