Loading ...
Sorry, an error occurred while loading the content.

Re: [nmrpipe] exchanging EXT and PS

Expand Messages
  • delaglio@nmrscience.com
    First order phase correction is a phase correction which changes linearly from the first point in the spectrum to the last point. A code example is below. The
    Message 1 of 4 , Nov 25, 2012
    • 0 Attachment
      First order phase correction is a phase correction which changes linearly
      from the first point in the spectrum to the last point. A code example is
      below.

      The nmrPipe phase correction function PS is set via two values,
      P0 (-p0 argument) and P1 (-p1 argument).

      In the nmrPipe PS function, the phase applied at the first point of the
      given data is PO, and the phase applied at the last point is P0 + P1.

      So, if you change the the range of points via EXT, you change the meaning
      of first-order phase correction. For example, lets say that the full
      spectral window of your data is 12ppm to -1.0ppm. In this example, the
      phase applied at 12ppm would be 152.0 and the phase applied at
      -1.0ppm would be (152.0 + 62.8):

      | nmrPipe -fn PS -p0 152.0 -p1 62.8 -di -verb \
      | nmrPipe -fn EXT -x1 10.5ppm -xn 6.0ppm -sw -verb \

      but in this example, the phase applied at 10.5ppm would be 152.0
      and the phase applied at 6.0ppm would be (152.0 + 62.8):

      | nmrPipe -fn EXT -x1 10.5ppm -xn 6.0ppm -sw -verb \
      | nmrPipe -fn PS -p0 152.0 -p1 62.8 -di -verb \

      As to baseline correction: a brief description of the auto-correction
      mechanism of the POLY function is given in the NMRPipe paper.
      Those who build auto-phasing schemes often find that baseline
      correction steps need to be combined with phase correction,
      because statistics used to judge good phasing are usually
      sensitive to baseline distortion.

      Correspondingly, auto baseline correction will usually required
      well-phased data in order to work well. So, one strategy for
      automated phase correction is to include more than one round of
      auto phase correction and auto baseline correction. Here's an example
      which uses multiple rounds of zero-order auto phase, baseline correction,
      and combined zero and first order auto phase:

      nmrPipe -in test.fid \
      | nmrPipe -fn EM -lb 1.0 -c 1.0 \
      | nmrPipe -fn ZF -zf 1 -auto \
      | nmrPipe -fn FT \
      | nmrPipe -fn MAC -macro $NMRTXT/aph1D.M -all \
      -reg -str psX1 9.0ppm psX2 6.0ppm -var xP1 0 \
      | nmrPipe -fn POLY -auto \
      | nmrPipe -fn MAC -macro $NMRTXT/aph1D.M -all \
      -reg -str psX1 9.0ppm psX2 6.0ppm -var xP1 0 \
      | nmrPipe -fn MAC -macro $NMRTXT/aphP1_1D.M -all -str \
      p0X1 9.0ppm p0X2 6.0ppm p1X1 3.0ppm p1X2 -0.1ppm \
      | nmrPipe -fn POLY -auto \
      | nmrPipe -fn MAC -macro $NMRTXT/aph1D.M -all \
      -reg -str psX1 9.0ppm psX2 6.0ppm -var xP1 0 \
      | nmrPipe -fn POLY -auto \
      | nmrPipe -fn MAC -macro $NMRTXT/aphP1_1D.M -all -str \
      p0X1 9.0ppm p0X2 6.0ppm p1X1 3.0ppm p1X2 -0.1ppm \
      | nmrPipe -fn PS -p0 0.0 -p1 0.0 -di \
      -out test.ft1 -ov

      /***/
      /* phaseRI: Phase a range ix1 to ix3 of separated real/imaginary data.
      /* Only points within the range are adjusted.
      /*
      /* Phase is specified according to first and last points of
      /* the full data vectors rdata/idata:
      /*
      /* phase at rdata[0] is p0
      /* phase at rdata[length-1] is p0 + p1
      /***/

      int phaseRI( rdata, idata, /* Real and imaginary parts to phase. */
      ix1, ix3, /* Region limits, first point = 1. */
      length, /* Size of rdata and idata. */
      p0, p1 ) /* Effective phase values, degrees. */

      int ix1, ix3, length;
      float *rdata, *idata, p0, p1;
      {
      float phi, tR, tI, tCOS, tSIN;
      int i;

      if (p0 == 0.0 && p1 == 0.0) return( 0 );

      ix1--;
      ix3--;

      rdata += ix1;
      idata += ix1;

      p0 = 2.0*PI*p0/360.0;
      p1 = 2.0*PI*p1/360.0;

      for( i = ix1; i < ix3; i++ )
      {
      phi = p0 + p1*i/length;

      tCOS = cos( (double) phi );
      tSIN = sin( (double) phi );

      tR = *rdata;
      tI = *idata;

      *rdata++ = tCOS*tR - tSIN*tI;
      *idata++ = tCOS*tI + tSIN*tR;
      }

      return( 0 );
      }

      Quoting "s.jure9" <s.jure9@...>:

      > hi,
      >
      > why
      > | nmrPipe -fn PS -p0 152.0 -p1 62.8 -di -verb \
      > | nmrPipe -fn EXT -x1 6.0ppm -xn 10.5ppm -sw -verb \
      >
      > produces different result as
      >
      > | nmrPipe -fn EXT -x1 6.0ppm -xn 10.5ppm -sw -verb \
      > | nmrPipe -fn PS -p0 152.0 -p1 62.8 -di -verb \
      >
      > I'm trying to develop 'ideal phase finder'. I want to apply PS as
      > late as possible. Currently only EXT and POLY are blocking my way to
      > the end.
      >
      > I would appreciate link to source codes for POLY and EXT functions
      > too. I can't find them.
      >
      > thank you,
      > Jure
      >
      >
    • s.jure9
      Oh I have completely forgotten the pivot. Thanks for reminder. To share my further experience: multiple POLY functions blur my data, so I just use one POLY to
      Message 2 of 4 , Dec 1, 2012
      • 0 Attachment
        Oh I have completely forgotten the pivot. Thanks for reminder.

        To share my further experience:

        multiple POLY functions blur my data, so I just use one POLY to get 'reference data' which I use for acquiring p0 and p1 parameters. Then those are applied to data before POLY (and then it can be repeated).
        For p0 the ideal parameter is straight forward: p0=arctan(-sum(idata)/sum(rdata))
        Before that I filter out points with absolute value lower than threshold.
        For P1 parameter 'for' loop is necessary.

        I have trouble finding right evaluating function.
        so, What do you think is good criteria for determination ideal phase parameters?
      Your message has been successfully submitted and would be delivered to recipients shortly.