nodes: 0, module; 1, function_definition; 2, function_name:trim; 3, parameters; 4, block; 5, identifier:self; 6, identifier:n_peaks; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:"""
          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
          """; 11, call; 12, call; 13, attribute; 14, argument_list; 15, attribute; 16, argument_list; 17, identifier:self; 18, identifier:sortByIntensity; 19, identifier:ims; 20, identifier:spectrum_trim; 21, attribute; 22, identifier:n_peaks; 23, identifier:self; 24, identifier:ptr
code: 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)