nmrglue.analysis.linesh.fit_spectrum(spectrum, lineshapes, params, amps, bounds, ampbounds, centers, rIDs, box_width, error_flag, verb=True, **kw)[source]

Fit a NMR spectrum by regions which contain one or more peaks.

Parameters :

spectrum : array_like

NMR data. ndarray or emulated type, must be slicable.

lineshape :list :

List of lineshapes by label (str) or a lineshape class. See fit_NDregion() for details.

params : list

P-length list (P is the number of peaks in region) of N-length lists of tuples where each each tuple is the optimiztion starting parameters for a given peak and dimension lineshape.

amps : list

P-length list of amplitudes.

bounds : list

List of bounds for parameter of same shape as params. If none of the parameters in a given dimension have limits None can be used, otherwise each dimension should have a list or tuple of (min,max) or None for each parameter. min or max may be None when there is no bounds in a given direction.

ampbounds : list

P-length list of bounds for the amplitude with format similar to bounds.

centers : list

List of N-tuples indicating peak centers.

rIDs : list

P-length list of region numbers. Peak with the same region number are fit together.

box_width : tuple

Tuple of length N indicating box width to add and subtract from peak centers to form regions around peak to fit.

error_flag : bool

True to estimate errors for each lineshape parameter and amplitude.

verb : bool, optional

True to print a summary of each region fit, False (the default) supresses all printing.

**kw : optional

Additional keywords passed to the scipy.optimize.leastsq function.

Returns :

params_best : list

Optimal values for lineshape parameters with same format as params input parameter.

amp_best : list

List of optimal peak amplitudes.

param_err : list, only returned when error_flag is True

Estimated lineshape parameter errors with same format as params.

amp_err : list, only returned when error_flag is True

Estimated peak amplitude errors.

iers : list

List of interger flag from scipy.optimize.leastsq indicating if the solution was found for a given peak. 1,2,3,4 indicates that a solution was found. Other indicate an error.

Previous topic


Next topic


This Page