NAME:
  jitterk
 PURPOSE:   (one line only)
  Convert pointing jitter data into a convolution kernel.
 DESCRIPTION:
  This routine is intended to take time-tagged pointing history data and
     convert this to a convolution kernel that can be used to help model
     imaging data.  The natural units of this routine is "pixels".  The
     kernel is generated at this exact scale if SUBSAMPLE=1 (default).
     The units do NOT change if you set SUBSAMPLE to something other than 1.
     In that case you will get a kernel with higher spatial resoltion.  Note
     that the units of dx,dy will be in pixels and will should not change
     with SUBSAMPLE.
  You should be able to take a model image at a matching sub-sampling factor,
     and convolve with the kernel returned from this routine to get a model
     image that matches the jitter history.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  jitterk,dt,dx,dy,exptime,kernel
 INPUTS:
  dt - Vector, time from start of exposure.  If first element is not
         dt=0 then (dt,dx,dy)=0 is assumed for the start.  Units are
         in seconds.
  dx - Vector (same length as dt), pointing offset in pixels.
  dy - Vector (same length as dt), pointing offset in pixels.
  exptime - Exposure time for kernel, in seconds.  The dt,dx,dy vectors
              should include exptime but is not enforced.  Times outside
              dt will be extrapolated.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  EXPCENTER - Flag, if set, the reference for the center of the jitter
                kernel is the mid-time of the exposure.  The default is
                to use the mean dx,dy over the exposure.  For true jitter
                kernels the default is best.  For non-linear smearing
                due to parallax (with HST) it is better to set this flag.
  DTSAMPLE  - time sampling interval (default=0.1 seconds)
  MOVING    - Flag, if set takes out the mean velocity of the dx,dy trend
                with time.  This is rarely used but would be relevant for
                a jitter-ball that is provided that includes jitter AND
                the target motion.  Setting this will take out the mean
                motion and leave just the jitter.
  SUBSAMPLE - sub-sampling factor for kernel.  Default=1
 OUTPUTS:
  kernel - convolution kernel, will be square and will be normalized.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  The values of dx and dy are limited to "reasonable" values.  Anything
    entry greater than 1000 is removed from the input vector.
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 2007/10/23
  2014/09/23, MWB, updated documentation and added EXPCENTER option