spectrochempy.autosub
- autosub(dataset, ref, *ranges, dim='x', method='vardiff', return_coefs=False, inplace=False)[source]
- Automatic subtraction of a reference to the dataset. - The subtraction coefficient are adjusted to either minimise the variance of the subtraction (method = ‘vardiff’) which will minimize peaks due to ref or minimize the sum of squares of the subtraction (method = ‘ssdiff’). - Parameters:
- dataset ( - NDDataset) – Dataset to which we want to subtract the reference data.
- ref ( - NDDataset) – 1D reference data, with a size matching the axis to subtract. (axis parameter). # TODO : optionally use title of axis.
- *ranges (pair(s) of values) – Any number of pairs is allowed. Coord range(s) in which the variance is minimized. 
- dim ( - stror- int, optional, default=’x’) – Tells on which dimension to perform the subtraction. If dim is an integer it refers to the axis index.
- method (str, optional, default=’vardiff’) – ‘vardiff’: minimize the difference of the variance. ‘ssdiff’: minimize the sum of squares difference of sum of squares. 
- return_coefs ( - bool, optional, default=`False`) – Returns the table of coefficients.
- inplace ( - bool, optional, default=`False`) – True if the subtraction is done in place. In this case we do not need to catch the function output.
 
- Returns:
 - Examples - >>> path_A = 'irdata/nh4y-activation.spg' >>> A = scp.read(path_A, protocol='omnic') >>> ref = A[0, :] # let's subtrack the first row >>> B = A.autosub(ref, [3900., 3700.], [1600., 1500.], inplace=False) >>> B NDDataset: [float64] a.u. (shape: (y:55, x:5549))