Iteratively fit peaks for whole spectra
list of spectrum objects read by read_nmrpipe
.
numeric vector of noise levels associated with each spectrum. If NULL
, it is calculated with noise_estimate
.
numeric value multiplied by noise_sigma
to determine cutoffs for each spectrum. Peak fitting will terminate if the maximum residuals for all spectra fall below these cutoffs.
numeric value giving a F-test p-value threshold above which a peak will not be accepted.
integer maximum number of iterations to apply.
numeric vector giving the window size (ppm plus or minus the starting omega0
values) around which to use points from the spectra for fitting.
numeric vector giving the starting r2
value(s) for the fit (in Hz).
numeric vector of length two giving the lower and upper bounds for r2
.
numeric vector giving the starting scalar coupling values for doublets. It should be the same length as the number of dimensions in the spectrum. Set the value to NA
for a given dimension to make it a singlet.
numeric vector of length two giving the lower and upper bounds for scalar couplings.
list of previous fits to which the new fits should be appended.
logical indicating whether produce a fit cluster plot for each iteration.
logical indicating whether to plot each stage of fitting within the iterations.
function called after each iteration with two arguments: iter
and iter_max
List of fit objects returned by fit_peak_cluster
, one for each iteration. They are appended to fit_list
if supplied.
This function uses an iterative algorithm to fit all the peaks in a given list of spectra, assuming identical peak positions and shapes across the spectra. Each iteration starts by identifying the maximum value across all spectra, using that position to fit a cluster of overlapping peaks with the fit_peak_cluster
function. After the cluster of peaks is fit, the modeled intensity is subtracted from all spectra and another iteration is performed. Iterations are terminated if max_iter
is reached or the residual intensity in all spectra falls below noise_sigma*noise_cutoff
.
This function currently only supports fitting of 2D spectra, but will be generalized to work with spectra of any dimensionality in the near future. To reduce the number of false positives/negatives, the most important parameters to adjust are noise_cutoff
, f_alpha
, and iter_max
. If iter_max
is reached before all peaks have been identified, then you can call this function again, setting the fit_list
parameter to the return value of the previous invocation. In that case, iter_max
new iterations will be performed and appended to fit_list
.
For visualizing the iterative algorithm as it progresses, you can enable either the plot_fit
or plot_fit_stages
parameters.