1. Home
  2. BASELINE procedure

BASELINE procedure

Estimates a baseline for a series of numbers whose minimum value is drifting. (D.B. Baird).

Options

PLOT = string token Whether to plot the series and the fitted baseline (baseline); default * i.e. no plot
BANDWIDTH = scalar Bandwidth for the moving minimum; default 50
WINDOW = scalar Window number for the plot; default 1
KEYWINDOW = scalar Window for the key (zero for no key); default 2

Parameters

Y = variates Series whose baseline is to be estimated
NEWY = variates Saves the y-values corrected to a zero baseline
BASELINE = variates Saves the estimated baseline
TITLE = text Title for the plot

Description

BASELINE is useful in the situation where you have a series of observations that are assumed to be fluctuating above and then back down to a baseline. Often the baseline may be drifting, and this will need to be corrected if, for example, you want to identify peaks and their heights.

The series is supplied, in a variate, by the Y parameter. The corrected values can be saved using the NEWY parameter, and the estimated baseline can be saved using the BASELINE parameter (both in variates). The baseline is estimated by taking the maximum of a moving minimum over a bandwidth specified by the BANDWIDTH option (default 50). If you want to detect peaks, the bandwidth should be greater than their anticipated width.

You can set option PLOT=baseline to plot the series and the estimated baseline. The WINDOW option specifies the window to use for the plot (default 1), and the KEYWINDOW option specifies the window for the key (default 2). You can supply a title for the plot using the TITLE parameter; the default title is “Moving minimum (b) baseline fitted to y” where b is the bandwidth, and y is the identifier of the Y variate.

Options: PLOT, BANDWIDTH, TITLE, WINDOW, KEYWINDOW.

Parameters: Y, NEWY, BASELINE.

Action with RESTRICT

Any restrictions on the Y variate are ignored.

See also

Procedures: ALIGNCURVE, PEAKFINDER.

Commands for: Calculations and manipulation.

Example

CAPTION   'BASELINE example'; STYLE=meta
" generate artificial data "
SCALAR    N,NP,W,A,B; VALUE=1000,10,30,*,*
VARIATE   [VALUES=1...N] X
CALCULATE [SEED=49438] A,B = GRUNIFORM(1; -1; 1)
&         [SEED=0] Peak = GRUNIFORM(NP;0;N)
&         P[1...NP] = EXP(-((X-#Peak)**2)/W**2)
&         Y = A*(X/1000) + B*COS(X/200) + VSUM(P) + GRUNIFORM(N;0;0.2)
BASELINE  [PLOT=baseline;BANDWIDTH=100] Y; NEWY=Ycorrected; BASELINE=Baseline
PRINT     Y,Ycorrected,Baseline
PEN       1; METHOD=line; SYMBOL=0
DGRAPH    [TITLE='Corrected data'] Y=Ycorrected; X=X
Updated on March 8, 2019

Was this article helpful?