nmrglue.analysis.integration.integrate

nmrglue.analysis.integration.integrate(data, unit_conv, limits, unit='ppm', noise_limits=None, norm_to_range=None, calibrate=1.0)[source]

Integrate one 1D data array within limits given in units. Data points must be equally spaced.

Functional form of integration is:

\[value = \sum_a^b s(x_{i}) dx\]

Where: s is the signal, a and b are the limits of integration and dx is the width of each bin.

The integration error due to baseline noise is calculated as:

\[error = \sigma_{vol} = \sigma \sqrt{n}\]

if the noise_limits are set.

Where:

\[n = \frac{|b-a|}{dx}+1\]

sigma is the standard deviation of the baseline noise. n is the number of bins in the integration range.

Parameters
data: array like

1d array of intensity

unit_conv: `fileiobase.unit_conversion` object

unit_conversion object associated with data

limits: array like

With shape (2,) or (P, 2). Array with lower and upper integration limit. Or array with P rows of lower and upper integration limits.

noise_limits: Optional[array like]

With shape(2, ). Array with lower and upper limits to section of data with only noise. A larger range will likely yield a more accurate estimate. It is unwise to use the very end of the spectrum for the noise range.

norm_to_range: Optional[int]

If given, all values are normalized to the value determined within the range given by limits[norm_to_range, :]

calibrate: Optional[float]

If norm_to_range is given, the values are re-normalized so that the integral within limits[norm_to_range, :] equals some number.

Returns
array

[value, …] integration values

if noise_limits is given:
array

[[value, error], …] where error a one sigma estimate of the error only from the spectrum noise