NAME
     LP - NMRPipe Complex Linear Prediction

SYNOPSIS
     nmrPipe -fn LP [-pred predPts] [-x1 dataStart] [-xn dataEnd]
     [-ord  order]  [-f  | -b | -fb] [-before | -after] [-nofix |
     -fix] [-fixMode fm] [-ps90-180 | -ps0-0]

EXPERIMENTAL OPTIONS
     nmrPipe -fn LP [-pca] [-extra xOrd] [-sig sigCount]  [-auto]
     [-min  nmin] [-max nmax] [-nw nw] [-dw dw] [-nf nf] [-sf sf]
     [-fr hf]

SPECIAL NOTE
     The  current  implementation  of  Linear   Prediction   (LP)
     replaces both previous functions LP and LPC.

DESCRIPTION
     LP is an implementation of  Linear  Prediction  for  complex
     data  which  has  been  designed  for  high stability.  As a
     result, it may  be  slower  than  other  implementations  of
     Linear Prediction, but perhaps more robust.  LP is used pri-
     marily to extend time-domain data.  By extending  the  data,
     Fourier  truncation  artifacts  become less severe, and line
     broadening due to use of window functions on short data vec-
     tors  will  be  less  pronounced.   LP  can  also be used to
     replacing missing or distorted points at  the  beginning  or
     interior  of time-domain data.  LP is usually most effective
     when used on time-domain data vectors which are not  decayed
     substantially,  relatively short (~8-256 complex points) and
     with a small number of  signals  (~0-8  peaks  per  vector).
     However,  LP  can  still  be  useful  in cases with a larger
     number of signals, since it can often reduce the  truncation
     artifacts of the largest peaks which might otherwise obscure
     smaller peaks.

     Linear Prediction makes a model  of  a  given  complex  data
     region;  this  model  can  then  be  used  to predict points
     immediately after the data region (points in the future)  or
     to predict points immediately before the data region (points
     in the past).  In the model, a set of coefficients is  found
     such  that  linear combination of a group of points predicts
     the next point in the series.  A single set of  coefficients
     is  determined  by  considering  each successive overlapping
     group of points in the data region.  The number  of  coeffi-
     cients  extracted  is  called  the  linear prediction order,
     which determines how many NMR signals (damped sinusoids) can
     be predicted by the model.

     There are three ways of doing the modeling to establish  the
     LP  coefficients.   In  one  method,  the points immediately
     after each group  are  predicted;  this  is  called  forward
     linear prediction.  In the second method, the points immedi-
     ately before each group are predicted; this is called  back-
     ward   linear  prediction.   In  the  third  method,  called
     forward-backward  linear  prediction,   the   results   from
     separate  forward-  and  backward-linear prediction calcula-
     tions are combined.  Forward-backward linear  prediction  is
     more time-consuming because it requires two LP calculations,
     but it often gives  better  results.   Regardless  of  which
     modeling  method is used, the coefficients can still be used
     (either directly or in modified form)  to  predict  past  or
     future points.

     Once the model is created, it can be applied  to  predict  a
     new synthetic point by using a group of existing points from
     the original data.  The new point can  then  be  used  along
     with  a  group from the original data to predict yet another
     new point.  This process can be continued indefinitely,  but
     in  practice  it  becomes more unstable as additional points
     are predicted from previous synthetic ones.   Therefore,  LP
     is usually limited to extending data to about twice its ori-
     ginal size.

     Most LP applications  will  involve  setting  the  following
     parameters, or using their default values:

           1. Linear prediction order.
              (-ord lpOrder)
              Default: order 8.

           2. Use of forward, backward, or forward-backward LP.
              (-f -b or -fb)
              Default: forward.

           3. Location and size of data region.
              (-x1 firstPoint and -xn lastPoint)
              Default: all points 1 to SIZE.

           4. Number of points to predict.
              (-pred predPointCount)
              Default: size of original data.

           5. Whether to predict past or future data.
              (-before or -after)
              Default: future.


     In addition, some data may allow use of Mirror Image LP;  in
     this  case,  there are two possible modes, described in more
     detail later:

           1. Mirror Image for data with no acquisition delay.
              (-ps0-0)

           2. Mirror Image for data with a 1/2 dwell delay.
              (-ps90-180)

LP ORDER
     The linear prediction order defines the number of points  in
     each  successive  group  used  to build the LP model.  Since
     several successive groups must be analyzed to build a  reli-
     able  model,  the  LP order is usually much smaller than the
     size of the modeled region, and  no  larger  than  half  the
     modeled  region.   But,  the  number of signals which can be
     extracted by LP is limited by  the  LP  order  itself.   So,
     there  is  a trade-off; the LP order must be as large as the
     number of signals to extract, but smaller than half the ori-
     ginal  data  size.  Therefore, cases of very small data size
     cause a problem, but in some situations this can  be  solved
     by Mirror Image LP (see below).

PARAMETERS FOR PREDICTION AFTER
     By default, LP is set up to work  like  zero  filling;  this
     means that it will double the size of the data by predicting
     future points using all of the original data in  the  model.
     For  example,  starting  with  data of 64 complex points, LP
     with no arguments:

        nmrPipe -fn LP

     is equivalent to:

        nmrPipe -fn LP -x1 1 -xn 64 -ord 8 -f -pred 64 -after

     which means "use data region of points 1->64 and an  order=8
     forward  linear prediction to predict 64 more points immedi-
     ately after the data region". Another way would  be  to  use
     forward-backward LP instead:

        nmrPipe -fn LP -fb

     which is the same as:

        nmrPipe -fn LP -x1 1 -xn 64 -ord 8 -fb -pred 64 -after


PARAMETERS FOR PREDICTION BEFORE
     When LP is used with the "-before" argument, it will work by
     replacing  points  before  the  selected data region, but it
     will not increase the size  of  the  data  (Note:  this  may
     change  in  later  implementations).  Therefore, in order to
     extend the data vectors by adding points at  the  beginning,
     the data size must first be adjusted "manually" by zero fil-
     ling and right-shifting. For example, if we start  with  100
     data  points,  and want to create 6 additional points before
     them:
        | nmrPipe -fn ZF -pad 6                           \
        | nmrPipe -fn RS -rs 6 -sw                        \
        | nmrPipe -fn LP -before -x1 7 -xn 106 -pred 6    \


     When the -before option is used, the default value  for  the
     -x1  parameter  is  set  to 1 plus the -pred value.  So, the
     following LP scheme is equivalent to the one above:


        | nmrPipe -fn ZF  -pad 6                 \
        | nmrPipe -fn RS  -rs 6 -sw              \
        | nmrPipe -fn LP  -before -pred 6        \


     these each mean "make room for 6 new points, move the origi-
     nal  data  over by 6 points, predict 6 new points before the
     original data which is now at points 7->106".

MIRROR IMAGE LP
     In order for LP to analyze NMR data correctly, the data must
     have  uniform  sampling, i.e. the time increment must be the
     same between  all  points.   Furthermore,  the  signals  are
     assumed  to  be  exponentially damped or undamped sinusoids,
     with uniform noise.

     In the case of  constant-time  data,  the  signals  have  no
     exponential  dampening.   So,  we can sometimes artificially
     extend this data temporarily by  adding  the  data's  mirror
     image  complex  conjugate  (imaginary is negated) before LP,
     then discarding the mirror image after LP.  By extending the
     data this way, we can use larger than usual LP order parame-
     ters, and thus have an opportunity to reconstruct more  sig-
     nals.   Furthermore, since the original data points are used
     in both forward and reverse order, mirror image LP  provides
     the stability advantage of forward-backward LP.

     Note that mirror-image LP will usually only be an  advantage
     when  there  are  a small number of original data points; in
     cases  with  larger  number  of  data  points   (>   32-64),
     forward-backward  LP  may  be  just  as good, and it has the
     added advantage of no special restrictions on delay-time  or
     decay.   So,  before using mirror-image LP, be sure that the
     circumstances are appropriate, as described below.

     When we create a mirror image for LP use, we have to be sure
     that  the  extended  data still has a uniform time increment
     between each point.  In the case of data with no delay,  the
     original  points are (t=0 t=1 t=2 ... t=n), and they are the
     same as hypothetical points at  "negative  time"  (t=0  t=-1
     t=-2 ... t=-n) since cos(t) = cos(-t).

     We can append the mirror image as:


                           mirror
                           image
                           plane
                             |
         t=-n . . t=-2 t=-1 t=0 t=1 t=2 . . t=n
                             |


     and we still have uniform increments between all points; the
     new  data  has  N-1 reflected points, followed by N original
     points.

     If the data have a half-point delay, we  can  still  make  a
     mirror image, but we have to do it a little differently.  We
     start with the original data, which are (t=0.5  t=1.5  t=2.5
     ...  t=n+0.5).   They are the same as the negative time data
     (t=-0.5 t=-1.5 t=-2.5 ...) so the mirror image is:


                                    mirror
                                    image
                                    plane
                                      |
         t=-(n+0.5) ... t=-1.5 t=-0.5 | t=0.5 t=1.5 ... t=(n+0.5)
                                      |


     and again, there are uniform  time  increments  between  all
     points;  this time, the new data has N reflected points fol-
     lowed by N original points.

     These two cases can be selected by using the options  -ps0-0
     or  -ps90-180.   This  will  automatically  build the mirror
     image, do the LP, and discard  the  mirror  image  automati-
     cally.   By  default,  both  cases will double the number of
     original data points, as with ordinary LP. For example:

        nmrPipe -fn LP -ps0-0 -ord 12

     means "build the mirror image  suitable  for  data  with  no
     acquisition delay, extend it LP using a 12-point order, then
     discard the mirror image part".

     However, if the data have more than one  point  delay,  then
     appending  the  mirror image will result in data that have a
     "gap" -- that is the two points on either side of the mirror
     image  plane  will  not  be separated by one time increment.
     For instance, if there is a two-point delay, there will be a
     three-point gap:
                          mirror
                          image
                          plane
                            |
         t=-n . . t=-2 ----gap---- t=2 . . t=n
                            |



     Therefore, data with a 1 or more  than  1-point  acquisition
     delay  can  not  be  used  directly  for  mirror  image  LP.
     Instead, the missing first points must  be  replaced  before
     using mirror image LP.  It may be possible in these cases to
     use LP with  the  -before  option  to  replace  the  missing
     points,  then later use LP with the -ps0-0 option to do mir-
     ror image as usual.

     For example, if there are 30 original points  with  a  three
     point delay:


        | nmrPipe -fn ZF  -pad 3               \
        | nmrPipe -fn RS  -rs 3 -sw            \
        | nmrPipe -fn LP  -before -pred 3      \
        | nmrPipe -fn LP  -ps0-0               \



     means "make room for the three  missing  points,  shift  the
     data by three points, create the three missing points by LP,
     use mirror-image  LP  to  create  33  additional  points  by
     extending the data.

DATA WITH 1-DWELL DELAY
     Data acquired with a 1-point delay  can  be  thought  if  as
     zero-delay  data  which have been left-shifted by one point.
     We try to compensate for this  shift  by  phase  correction;
     each  one-point  shift adds a 360 degree first order correc-
     tion (P1=360).

     However,  a  P1=360  in  the   frequency-domain   does   not
     correspond  to  exactly  to  a simple one-point shift in the
     time-domain; rather, it is equivalent to a circular shift in
     the time-domain.  So, it is as if the missing first point of
     the FID is replaced by the last original point  of  the  FID
     (or by zero if the data has been zero filled).

     Fourier theory tells us that  the  amplitude  of  the  first
     point  in  the  FID  is  the  integral  of all points in the
     frequency-domain; therefore,  if  the  value  of  the  first
     time-domain  point  is  incorrect,  there  will be an offset
     error (constant baseline distortion)  in  the  corresponding
     spectrum.   Clearly,  the last point in an FID is not a good
     substitute for the missing point; so as a result, data  pro-
     cessed with P1=360 will have baseline problems.

     If we want to avoid baseline problems in this case, we  must
     find  a  way  to replace the missing first point accurately.
     LP can be used for this task, but it is time  consuming  and
     sometimes unstable.

     A faster and more stable approach  takes  advantage  of  the
     fact   that   adjustment  of  the  first  time-domain  point
     corresponds to adding a constant in the frequency-domain, as
     mentioned  above.  So, we can do the equivalent of replacing
     the first time-domain point by performing a zero-order base-
     line  correction  in the frequency domain.  In cases with 64
     or more data points and spectra which are not  too  crowded,
     automated  zero-order  baseline correction can be faster and
     more stable than LP.   Therefore,  the  baseline  correction
     approach is often a better one.

     In a small test-case, the first plane of an 15N-NOE  experi-
     ment  (F3=HN  F1=H plane, 512* by 128* points) was processed
     using different approaches for the F1 dimension,  which  was
     acquired with a 1-dwell delay:


        oooooooooooooooooooo   ooooooooooooooo
        Method                 Time (Sparc 10)
        oooooooooooooooooooo   ooooooooooooooo

        Ordinary FT/Phase      14 Sec
        Automated Baseline     18 Sec
        Linear Prediction      58 Sec


     The baseline correction method was not only faster,  but  it
     gave  a  much better result in this case than LP.  The three
     processing macros used are given  in  the  EXAMPLES  section
     below.   In both the LP and baseline correction schemes, the
     F1  data  is  first   zero-filled   by   one   point,   then
     right-shifted  by one point; this is done to "make room" for
     the missing point which will be predicted.

     Both of these procedures increase the number of  time-domain
     points  by 1. This can be potentially awkward for subsequent
     zero-filling and FT steps, since data which start out with a
     power-of-two  size  will  no longer have a power-of-two size
     (e.g.  64  versus  65  points).   As  an  alternative,   the
     one-point  zero  fill  can  be omitted; this will retain the
     original size of the data at the expense of losing the  last
     point in each vector.

STRATEGIES FOR USE OF LP
     LP will work best when the  time-domain  vectors  to  extend
     have the fewest possible signals.  In order to achieve this,
     all of the  other  dimensions  of  the  spectrum  should  be
     Fourier  Transformed  first; this will localize the spectral
     signals in  the  transformed  dimensions  and  simplify  the
     remaining  time-domain  dimension.   This means that inverse
     processing schemes will be required for cases where LP  will
     be used in two of the spectral dimensions.  Inverse process-
     ing will usually involve the following  steps  to  retore  a
     spectrum to its original time-domain form:

        If the imaginary data was deleted previously, reconstruct
        it using the Hilbert Transform (HT).

        Remove the phase correction which was applied previously,
        using  the  negative  of the original phase values P0 and
        P1.

        Apply an inverse Fourier Transform to restore the data to
        the time domain.

        Remove the zeros which were  appended  by  previous  zero
        filling.

        Divide the data by the window and first point scale  used
        previously during forward processing.

     When creating  inverse  processing  schemes,  the  following
     should be considered:

        Zero Filling: in  order  to  reconstruct  imaginary  data
        correctly  using the Hilbert Transform (HT), the original
        data must have been zero-filled to  at  least  twice  its
        original size.

        Acquisition Delay: the Hilbert Transform will  only  pro-
        duce ideal reconstruction of imaginary data in two cases:
        an ordinary HT can be used for data with  no  acquisition
        delay (P1=0); a mirror-image HT can be used for data with
        a half-dwell delay (P1=180).  In all other cases, the  HT
        may  introduce  distortions at the edges of the spectrum,
        but these may only be serious in  cases  where  the  data
        size  is  small  or  where signals of interest lie at the
        edges of the spectrum.

        Window Function: inverse processing will require dividing
        the  data  by  the  original window function.  This means
        that the original window function  should  be  chosen  so
        that  none  of the window values are close to or equal to
        zero.

OPTIONS
     The LP command-line options are detailed below; use the com-
     mand  nmrPipe  -fn  LP  -help to generate a complete list of
     options and their default values.


     -pred predPts
          Specifies the number of complex points to  predict.  In
          the -after mode (default), the predicted points will be
          placed after the selected data  region,  replacing  any
          existing  points,  and  extending  the size of the data
          automatically if needed.  When the -after mode is used,
          the  default  number of points to predict is set to the
          original size of the data, so that the data  size  will
          be doubled by prediction.  If the -before mode is used,
          the given number of predicted  points  will  be  placed
          before  the  selected  data region, however the size of
          the data will not be adjusted. When the -before mode is
          selected,  the default number of predicted points is 1,
          so that the first point of the FID will be replaced.

     -x1 dataStart
          Specifies the first  complex  point  in  the  range  of
          points  from  the  original  data which will be used to
          generate the LP model.  In the -after  mode  (default),
          the  default value is 1, which means the region of data
          to model will start at the first point of the FID.   In
          the  -before  mode,  the default value is set to 1 plus
          the number of points to predict (-pred predPts),  which
          means  the  first points of the FID will be replaced by
          LP.

     -xn dataEnd
          Specifies the last complex point in the range of points
          from  the  original data which will be used to generate
          the LP model.  The default value is set to the original
          size,  which means that the region to model will extend
          to the last point of the original data.

     -ord order
          Specifies the LP order, the number of  complex  coeffi-
          cients which will be extracted by the LP model.  The LP
          order can be no larger than half the number  of  points
          in  the data region to model.  The LP order also deter-
          mines  the  maximum  number  of  NMR  signals   (damped
          sinusoids) which can be represented by the model.

     -f   When  this  flag  is  used,  LP  coefficients  will  be
          extracted using forward-mode equations (default).

     -b   When  this  flag  is  used,  LP  coefficients  will  be
          extracted using backward-mode equations.

     -fb  When  this  flag  is  used,  LP  coefficients  will  be
          extracted  using  both forward- and backward-mode equa-
          tions, and the two sets of coefficients are then  aver-
          aged for enhanced stability.

     -before
          When this flag is used, the LP predicted points will be
          placed before the modeled data region.

     -after
          When this flag is used, the LP predicted points will be
          placed after the modeled data region (default).

     -nofix
          This flag turns off the LP root  reflection  procedure.
          This  procedure adjusts the LP coefficients to suppress
          creation of signals  which  do  not  have  the  desired
          exponential envelope.

     -fix This flag enables the  LP  root  reflection  procedure.
          This  procedure adjusts the LP coefficients to suppress
          creation of signals  which  do  not  have  the  desired
          exponential envelope.

     -fixMode fm
          Specifies the type  of  root  reflection  to  use.  The
          options are:
            -1  Suppress  Decreasing  Exponentials  (default  for
          -before)
             0 No Adjustment
             1  Suppress  Increasing  Exponentials  (default  for
          -after)

     -ps90-180
          This flag performs mirror-image  LP  for  data  with  a
          half-dwell delay (i.e., data that require P0=-90,P1=180
          phasing).  It is intended for use with data having lit-
          tle or no dampening.

     -ps0-0
          This flag performs mirror-image LP  for  data  with  no
          acquisition  delay  (i.e.,  data that require P0=0,P1=0
          phasing).  It is intended for use with data having lit-
          tle or no dampening.

EXPERIMENTAL OPTIONS
     The following are options under development, and thus should
     not be relied on; the descriptions are included for develop-
     ment purposes. Facilities under consideration include 2D  LP
     using  Principal  Component  Analysis,  and automatic signal
     count estimation.

     -pca Sets the LP order to the Y-Axis size; this assumes that
          the  data set is actually a matrix decomposition result
          created by the Principal Component Analysis (PCA)  pro-
          gram pcaNMR(1).

     -extra xOrd
          The LP order established by PCA will  be  increased  by
          the value given here.  This is used to insure a minimum
          reasonable LP order.

     -sig sigCount
          Specifies the number of signals to reconstruct, in case
          this should be less than the LP order.

     -auto
          This flag enables automatic  signal  count  estimation,
          which  will  adjust  the LP order on a vector-by-vector
          basis.

     -min nmin
          The minimum allowable number of signals  for  automatic
          signal count estimation.

     -max nmax
          The minimum allowable number of signals  for  automatic
          signal count estimation.

     -nw nw
          Specifies the cell size in points for noise  determina-
          tion.

     -dw dw
          Specifies the +/- width in points for signal detection.

     -nf nf
          Specifies the noise threshold factor for signal  detec-
          tion.

     -sf sf
          Specifies the signal count factor.

     -fr hf
          Specifies the minimum fraction of  data  considered  to
          belong to baseline.

EXAMPLES
     The following example shows  conventional  processing  of  a
     data  plane  with a 1-dwell delay in the indirect dimension.
     This requires a phase  correction  of  P0=-180,P1=360  which
     leads  to  baseline distortions.  Compare this scheme to the
     following two alternative schemes.

      #!/bin/csh

      nmrPipe -in fid/test001.fid                            \
      | nmrPipe -fn SOL                                      \
      | nmrPipe -fn SP -off 0.35 -end 0.99 -pow 2 -c 0.5     \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \
      | nmrPipe -fn PS -p0 0.0 -p1 0.0 -di                   \
      | nmrPipe -fn EXT -x1 5ppm -xn 10.5ppm -sw -verb       \
      | nmrPipe -fn TP                                       \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \
      | nmrPipe -fn PS -p0 -180 -p1 360 -di                  \
        -out test.ps.ft2 -ov -verb


     In the following scheme, the data above are processed with a
     one-point shift followed by Linear Prediction to replace the
     missing first  point  caused  by  the  1-dwell  delay.   The
     right-shift also removes the need for a phase-correction.


      #!/bin/csh

      nmrPipe -in fid/test001.fid                            \
      | nmrPipe -fn SOL                                      \
      | nmrPipe -fn SP -off 0.35 -end 0.99 -pow 2 -c 0.5     \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \
      | nmrPipe -fn PS -p0 0.0 -p1 0.0 -di                   \
      | nmrPipe -fn EXT -x1 5ppm -xn 10.5ppm -sw -verb       \
      | nmrPipe -fn TP                                       \
      | nmrPipe -fn ZF -pad 1                                \
      | nmrPipe -fn RS -rs 1 -sw                             \
      | nmrPipe -fn LP -before -pred 1                       \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \
      | nmrPipe -fn PS -p0 0.0 -p1 0.0 -di                   \
         -out test.lp.ft2 -ov -verb


     In the following scheme, the data above are processed with a
     one-point  shift  and  automated zero-order baseline correc-
     tion. This has the same  effect  as  replacing  the  missing
     first  point  caused  by the 1-dwell delay.  As noted previ-
     ously, this method is often faster and  more  reliable  than
     the LP method given above.

      #!/bin/csh

      nmrPipe -in fid/test001.fid                            \
      | nmrPipe -fn SOL                                      \
      | nmrPipe -fn SP -off 0.35 -end 0.99 -pow 2 -c 0.5     \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \
      | nmrPipe -fn PS -p0 0.0 -p1 0.0 -di                   \
      | nmrPipe -fn EXT -x1 5ppm -xn 10.5ppm -sw -verb       \
      | nmrPipe -fn TP                                       \
      | nmrPipe -fn ZF -pad 1                                \
      | nmrPipe -fn RS -rs  1 -sw                            \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \
      | nmrPipe -fn PS -p0 0.0 -p1 0.0 -di                   \
      | nmrPipe -fn POLY -auto -ord 0                        \
         -out test.poly.ft2 -ov -verb


     Both of the above two schemes increase  the time-domain size
     by  one  point.   This  can sometimes be awkward; on the one
     hand, it is desirable to double the data size by  zero  fil-
     ling;  if  this  is  done, an HT can be used later to recon-
     struct imaginary data if needed.  In addition,  it  is  also
     desirable to zero fill to yield a data size which is a power
     of two, so that the following FT  steps  will  operate  most
     quickly, since FT of other data sizes can be extremely slow.
     There are several possible compromises,  which  follow.  The
     examples  are  based  on  an original time-domain size of 32
     complex points.  In the first example, the time-domain  size
     is  increased  by  1  point  to 33 points, and the zero fill
     options double the size then round  it  up  to  the  nearest
     power  of two, yielding a spectrum of 128 points.  Since the
     data size was more than doubled by ZF, this  scheme  permits
     accurate  reconstruction  of imaginary data later if needed.
     But, since the data size is rounded up to a power of two, in
     some  cases  this  scheme may make the result inconveniently
     large:


      | nmrPipe -fn ZF -pad 1                                \
      | nmrPipe -fn RS -rs 1 -sw                             \
      | nmrPipe -fn LP -before -pred 1                       \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \


     In the example, the time-domain size is not increased by one
     point;  instead, the last point of the original data is lost
     during the right-shift.


      | nmrPipe -fn RS -rs 1 -sw                             \
      | nmrPipe -fn LP -before -pred 1                       \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF -auto                                 \
      | nmrPipe -fn FT                                       \


     In this example, the data size is increased by one point  to
     33  points,  then  doubled by zero fill but not rounded to a
     power of two, so that the final size is  66  points.   Since
     the  data  size was doubled by ZF, this scheme permits accu-
     rate reconstruction of imaginary data later if needed.   But
     the FT time may be inconveniently slow.


      | nmrPipe -fn ZF -pad 1                                \
      | nmrPipe -fn RS -rs 1 -sw                             \
      | nmrPipe -fn LP -before -pred 1                       \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF                                       \
      | nmrPipe -fn FT                                       \


     In this example, the data size is increased by one point  to
     33  points,  but  zero filled only to 64 points.  Since this
     scheme does not double the data size by ZF,  imaginary  data
     cannot be reconstructed perfectly later if needed.  But, the
     final size has the advantage of being relatively small,  and
     also a power of two.


      | nmrPipe -fn ZF -pad 1                                \
      | nmrPipe -fn RS -rs 1 -sw                             \
      | nmrPipe -fn LP -before -pred 1                       \
      | nmrPipe -fn SP -off 0.45 -end 0.95 -pow 1            \
      | nmrPipe -fn ZF -size 64                              \
      | nmrPipe -fn FT                                       \



     The following script demonstrates an  LP  scheme  which  was
     used  to repair bad 1D vectors in a 2D States-Mode FID.  The
     defects occurred in 1D vectors 9-12 in the raw  data,  which
     contained  128 total 1D vectors (64 complex points in the Y-
     Axis).  The defects were found by  graphical  inspection  of
     the  FID using the nmrDraw program.  Since the 1D vectors in
     the FID represent interleaved real and imaginary points, the
     bad  vectors  correspond to complex points 5 and 6 in the Y-
     Axis.  Since the bad points lie near the  beginning  of  the
     FID,  LP is used in the -before mode, to predict the two bad
     points before the good points 7-64.  Note: to find the  com-
     plex  point  corresponding  to  interleaved point N, use the
     formula int[(N-1)/2] + 1.


      #!/bin/csh

      nmrPipe -in hcabgco2d.fid \
      | nmrPipe -fn GM -g1 10 -g2 30 -c 0.5               \
      | nmrPipe -fn ZF -size 1024                         \
      | nmrPipe -fn FT                                    \
      | nmrPipe -fn PS -p0 206.4 -p1 0.0                  \
      | nmrPipe -fn EXT -x1 1.0ppm -xn 6.0ppm -sw -verb   \
      | nmrPipe -fn PS -p0 0 -p1 0  -di                   \
      | nmrPipe -fn TP                                    \
      | nmrPipe -fn LP -before -x1 7 -pred 2 -ord 16      \
      | nmrPipe -fn GM -g1 10 -g2 30                      \
      | nmrPipe -fn ZF -size 512                          \
      | nmrPipe -fn FT                                    \
      | nmrPipe -fn PS -p0 217 -p1 159 -di                \
      | nmrPipe -fn TP                                    \
      | nmrPipe -fn POLY -auto                            \
        -out hcabgco2d.ft2 -verb -ov


     The following scheme demonstrates LP used to repair bad data
     planes  within a 3D spectrum. In this example, planes 58 and
     59 in the original FID were  corrupted  during  acquisition.
     The  complete  FID  consisted  of  64 planes.  Since the FID
     planes represent alternating real and  imaginary  points  in
     the  Z-Axis,  plane  58 corresponds to the imaginary part of
     complex point 29, and plane 59 corresponds to the real  part
     of  complex  point  30.  Therefore, points 29 and 30 must be
     replaced in the Z-Axis.  In this case, since the bad data is
     towards  the  end  of the FID, LP is used in the -after mode
     (default), to replace the two bad points after points  1-28.
     Note that the LP is not applied until after the other dimen-
     sions have been transformed.

      #!/bin/csh

      xyz2pipe -in fid/test%03d.fid -x -verb \
      | nmrPipe  -fn SP -off .35 -end .95 -pow 2 -c 0.5     \
      | nmrPipe  -fn ZF -auto                               \
      | nmrPipe  -fn FT                                     \
      | nmrPipe  -fn PS -p0 -112.0  -p1 0.0  -di            \
      | nmrPipe  -fn TP                                     \
      | nmrPipe  -fn SP -off .35 -end 1.0 -pow 1   -c 1.0   \
      | nmrPipe  -fn ZF -auto                               \
      | nmrPipe  -fn FT                                     \
      | nmrPipe  -fn PS -p0 -90.0 -p1 180.0 -di             \
      | nmrPipe  -fn TP                                     \
      | nmrPipe  -fn POLY -auto                             \
      | pipe2xyz -out ft/test%03d.ft2 -x -ov
      xyz2pipe -in ft/test%03d.ft2 -z -verb                 \
      | nmrPipe  -fn LP -xn 28 -pred 2 -ord 12              \
      | nmrPipe  -fn SP -off .35 -end 1.0 -pow 1 -c 1.0     \
      | nmrPipe  -fn ZF -auto                               \
      | nmrPipe  -fn FT                                     \
      | nmrPipe  -fn PS -p0 -90.0 -p1 180.0  -di            \
      | pipe2xyz -out ft/test%03d.ft3 -z  -ov


     The following scheme illustrates LP used in the two indirect
     dimensions  of  a  constant-time  3D CBCANH experiment.  The
     scheme is arranged so that the 1D time-domain vectors to  be
     extended  by  LP  are  as  simple as possible (i.e. have the
     fewest possible signals).  To achieve this, LP is only  used
     on  a given dimension when all the remaining dimensions have
     been processed.  This localizes the spectral signals as much
     as  possible,  since  in the time-domain, a given signal can
     extend  significantly  across  the  spectrum,  but  in   the
     frequency-domain  the  signal  will be "concentrated" into a
     peak.

     In this example, the HN and N  dimensions  are  transformed,
     then  the  CACB  dimension  is  Linear  Predicted  and  then
     transformed.   Finally,   the   N   dimension   is   inverse
     transformed,  Linear  Predicted,  then re-transformed.  Note
     the use of "-inv" to  undo  the  effects  of  not  only  the
     Fourier  Transform,  but also the phasing (if any), the zero
     filling, and  the  window  function.   Note  also  that  the
     forward-backward  LP option -fb could be used as an alterna-
     tive to the mirror-image options -ps0-0 and -ps90-180:

      #!/bin/csh

      xyz2pipe -in fid/test%03d.fid -x  -verb             \
      | nmrPipe  -fn SOL                                  \
      | nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 2 -c 0.5  \
      | nmrPipe  -fn ZF -auto                             \
      | nmrPipe  -fn FT                                   \
      | nmrPipe  -fn PS -p0 43  -p1 0.0 -di               \
      | nmrPipe  -fn EXT -left -sw                        \
      | pipe2xyz -out lp/test%03d.ft3 -x

      xyz2pipe -in lp/test%03d.ft3 -z -verb               \
      | nmrPipe  -fn SP -off 0.5 -end 0.95 -pow 1 -c 0.5  \
      | nmrPipe  -fn ZF -auto                             \
      | nmrPipe  -fn FT                                   \
      | nmrPipe  -fn PS -p0 0.0 -p1 0.0 -di               \
      | pipe2xyz -out lp/test%03d.ft3 -z -inPlace

      xyz2pipe -in lp/test%03d.ft3 -y -verb               \
      | nmrPipe  -fn LP -ps90-180 -ord 10                 \
      | nmrPipe  -fn SP -off 0.5 -end 0.98 -pow 1 -c 1.0  \
      | nmrPipe  -fn ZF -auto                             \
      | nmrPipe  -fn FT                                   \
      | nmrPipe  -fn PS -p0 -90 -p1 180 -di               \
      | pipe2xyz -out lp/test%03d.ft3 -y -inPlace

      xyz2pipe -in lp/test%03d.ft3 -z -verb               \
      | nmrPipe  -fn HT  -auto                            \
      | nmrPipe  -fn PS  -inv -hdr                        \
      | nmrPipe  -fn FT  -inv                             \
      | nmrPipe  -fn ZF  -inv                             \
      | nmrPipe  -fn SP  -inv -hdr                        \
      | nmrPipe  -fn LP  -ps0-0                           \
      | nmrPipe  -fn SP  -hdr                             \
      | nmrPipe  -fn ZF  -auto                            \
      | nmrPipe  -fn FT                                   \
      | nmrPipe  -fn PS  -hdr -di                         \
      | pipe2xyz -out lp/test%03d.ft3 -z -inPlace


SEE ALSO
     nmrPipe(1), xyz2pipe(1), fdatap(1), HT(1),  POLY(1),  RS(1),
     SP(1), ZF(1)

HEADER VALUES
     LP  updates  the  recorded  time-domain  sizes  (NDAPOD  and
     NDTDSIZE),  so  that  window  functions  applied  after data
     extension via LP will automatically extend  to  the  correct
     number  of  points  to  cover both the original data and the
     predicted points.

     LP also updates some chemical shift calibration  information
     (NDCENTER and NDORIG) to accommodate the new position of the
     zero-frequency  point   which   is   anticipated   for   the
     corresponding spectrum.

BUGS
     LP used in the -before mode will not increase the data  size
     automatically.  This may change in future implementations.

     Using LP to back-predicting missing or distorted  points  at
     the start of an FID is often unreliable.

     LP is often not effective on data with  many  signals,  data
     with  high  dynamic  range,  data  with  low signal-to-noise
     ratios, or heavily damped data.