def charged(self, charge):
        """
        Adds/subtracts electrons and returns a new object.

        :param charge: number of electrons to add
        :type charge: integer
        :returns: a spectrum with appropriately shifted masses
        :rtype: CentroidedSpectrum

        """
        result = self.copy()
        result.addCharge(charge)
        return result
def charged ( self , charge ) : result = self . copy ( ) result . addCharge ( charge ) return result
Adds/subtracts electrons and returns a new object.

        :param charge: number of electrons to add
        :type charge: integer
        :returns: a spectrum with appropriately shifted masses
        :rtype: CentroidedSpectrum