correct_drift.m
SYNTAX: corrected_d = correct_drift(old_data, old_tvec, nsamples, sampleloc)
PURPOSE: Correct measured shot data for integrator drift.
INPUT:
old_data = data vector to correct for drift
old_tvec = time vector corresponding to old_data
nsamples = optional number of samples to use to calculate
average offset at beginning and end (default 25)
sampleloc= optional location of "end" (1st, last) set of samples for
defining the average offset at "end" (default is last sample
of vector) if not specified, or specified as a number <0,
default=data length
OUTPUT:
corrected_d = data corrected for drift
RESTRICTIONS:
(1) Assumes approximately linear drift over duration of shot.
(2) MUST HAVE >=28 samples both at beginning and end of shot from which
to calculate beginning and end offsets (UNLESS nsamples < 25).
METHOD: Samples are averaged at beginning and end of data to define beginning
and end offsets. Beginning offset is subtracted out. A linear drift
defined by the 2 offsets is assumed and corrected for in remainder of data.
SEE ALSO: correct_drift_intvals
Dependencies