def peaks(spectra, frequency, number=3, thresh=0.01):
    """ Return the peaks from the Fourier transform
            Variables:
            number:     integer. number of peaks to print.
            thresh:     float. Threshhold intensity for printing.

            Returns: Energy (eV), Intensity (depends on type of spectra)
        """

    from scipy.signal import argrelextrema as pks
    # find all peak indices [idx], and remove those below thresh [jdx]
    idx = pks(np.abs(spectra), np.greater, order=3)
    jdx = np.where((np.abs(spectra[idx]) >= thresh))
    kdx = idx[0][jdx[0]]  # indices of peaks matching criteria
    if number > len(kdx):
        number = len(kdx)
    print("First " + str(number) + " peaks (eV) found: ")
    for i in xrange(number):
        print("{0:.4f}".format(frequency[kdx][i] * 27.2114),
              "{0:.4f}".format(spectra[kdx][i]))
    def peaks(self,number=3,thresh=0.01):
        """ Return the peaks from the Fourier transform
            Variables:
            number:     integer. number of peaks to print.
            thresh:     float. Threshhold intensity for printing.

            Returns: Energy (eV), Intensity (depends on type of spectra)
        """
    
        from scipy.signal import argrelextrema as pks
        # find all peak indices [idx], and remove those below thresh [jdx]
        idx = pks(self.spectra,np.greater,order=5)
        jdx = np.where((np.abs(self.spectra[idx]) >= thresh))
        kdx = idx[0][jdx[0]] # indices of peaks matching criteria
        if number > len(kdx):
            number = len(kdx)
        print "First "+str(number)+" peaks (eV) found: "
        for i in xrange(number): 
            print "{0:.2f}".format(self.frequency[kdx][i]*27.2114),\
                  "{0:.2f}".format(self.spectra[kdx][i])