nodes: 0, module; 1, function_definition; 2, function_name:centroids; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:window_size; 15, integer:5; 16, comment:"""
          Detects peaks in raw data.
  
          :param mzs: sorted array of m/z values
          :param intensities: array of corresponding intensities
          :param window_size: size of m/z averaging window
  
          :returns: isotope pattern containing the centroids
          :rtype: CentroidedSpectrum
          """; 17, call; 18, assignment; 19, assignment; 20, assignment; 21, assignment; 22, call; 23, attribute; 24, argument_list; 25, identifier:mzs; 26, call; 27, identifier:intensities; 28, call; 29, identifier:n; 30, attribute; 31, identifier:p; 32, call; 33, identifier:_new_spectrum; 34, argument_list; 35, identifier:self; 36, identifier:sortByMass; 37, identifier:_cffi_buffer; 38, argument_list; 39, identifier:_cffi_buffer; 40, argument_list; 41, identifier:self; 42, identifier:size; 43, attribute; 44, argument_list; 45, identifier:CentroidedSpectrum; 46, identifier:p; 47, attribute; 48, string; 49, attribute; 50, string; 51, identifier:ims; 52, identifier:spectrum_new_from_raw; 53, identifier:n; 54, attribute; 55, attribute; 56, call; 57, identifier:self; 58, identifier:masses; 59, string_content:d; 60, identifier:self; 61, identifier:intensities; 62, string_content:f; 63, identifier:mzs; 64, identifier:ptr; 65, identifier:intensities; 66, identifier:ptr; 67, identifier:int; 68, argument_list; 69, identifier:window_size
code: def centroids(self, window_size=5):
          """
          Detects peaks in raw data.
  
          :param mzs: sorted array of m/z values
          :param intensities: array of corresponding intensities
          :param window_size: size of m/z averaging window
  
          :returns: isotope pattern containing the centroids
          :rtype: CentroidedSpectrum
          """
          self.sortByMass()
          mzs = _cffi_buffer(self.masses, 'd')
          intensities = _cffi_buffer(self.intensities, 'f')
          n = self.size
          p = ims.spectrum_new_from_raw(n, mzs.ptr, intensities.ptr, int(window_size))
          return _new_spectrum(CentroidedSpectrum, p)