A method of producing a mass spectrum from a time-varying transient signal detected in a mass spectrometer, the method comprising: performing a Fourier transform of the transient signal to produce a first set of complex amplitudes wherein each of the complex amplitudes corresponds to a respective frequency of a first set of frequencies; and generating a second set of complex amplitudes, wherein each of the complex amplitudes corresponds to a respective frequency of a second set of frequencies, wherein the minimum spacing of the second set of frequencies is less than the inverse of the duration of the transient signal, characterized in that the method further comprises: optimizing the second set of complex amplitudes to produce an improved second set of complex amplitudes; and generating a mass spectrum from at least some of the improved second set of complex amplitudes; wherein optimizing the second set of complex amplitudes to produce an improved second set of complex amplitudes comprises: varying at least one of the complex amplitudes of the second set of complex amplitudes based on an objective function, wherein the objective function, for each frequency of the first set of frequencies, is a function of one or more complex amplitudes of the second set of complex amplitudes and the respective complex amplitude thereby relating one or more complex amplitudes of the second set of complex amplitudes to the respective complex amplitude from the first set of complex amplitudes, subject to, for at least some of the complex amplitudes of the second set of complex amplitudes, a constraint on the phase of each complex amplitude relative to a frequency-dependent expected phase. performing a Fourier transform of the transient signal to produce a first set of complex amplitudes wherein each of the complex amplitudes corresponds to a respective frequency of a first set of frequencies; and generating a second set of complex amplitudes, wherein each of the complex amplitudes corresponds to a respective frequency of a second set of frequencies, wherein the minimum spacing of the second set of frequencies is less than the inverse of the duration of the transient signal, characterized in that the method further comprises: optimizing the second set of complex amplitudes to produce an improved second set of complex amplitudes; and generating a mass spectrum from at least some of the improved second set of complex amplitudes; optimizing the second set of complex amplitudes to produce an improved second set of complex amplitudes; and generating a mass spectrum from at least some of the improved second set of complex amplitudes; wherein optimizing the second set of complex amplitudes to produce an improved second set of complex amplitudes comprises: varying at least one of the complex amplitudes of the second set of complex amplitudes based on an objective function, wherein the objective function, for each frequency of the first set of frequencies, is a function of one or more complex amplitudes of the second set of complex amplitudes and the respective complex amplitude thereby relating one or more complex amplitudes of the second set of complex amplitudes to the respective complex amplitude from the first set of complex amplitudes, subject to, for at least some of the complex amplitudes of the second set of complex amplitudes, a constraint on the phase of each complex amplitude relative to a frequency-dependent expected phase. varying at least one of the complex amplitudes of the second set of complex amplitudes based on an objective function, wherein the objective function, for each frequency of the first set of frequencies, is a function of one or more complex amplitudes of the second set of complex amplitudes and the respective complex amplitude thereby relating one or more complex amplitudes of the second set of complex amplitudes to the respective complex amplitude from the first set of complex amplitudes, subject to, for at least some of the complex amplitudes of the second set of complex amplitudes, a constraint on the phase of each complex amplitude relative to a frequency-dependent expected phase.