NMRPipe Processing Functions
ADD: Add a Constant to Data.

ADD adds a constant to the real or imaginary part of each vector in the data stream, or to a range of points within each vector. It is possible to specify separate constants to add to the real and imaginary parts of the data, however the imaginary constant will only be used if the current dimension of the input data has an imaginary part.
OPTIONS
c cC
Specifies the same constant to add to both the real part of the data,
and also to the imaginary part if it exists.
r cR
Specifies the constant to add to the real part of the data.
i cI
Specifies the constant to add to the imaginary part of the data.
This has no effect if the input data has no imaginary part.
ri
If this flag is used, the imaginary part of the data will be
added to the real part, and flags r realC
i imagC
and c riC
will be ignored. The ri
flag
is ignored if the input data has no imaginary part.
x1 pnt1
Specifies the location of the first point in range of points to adjust,
with default units in points. The default value is 1, the first point
in the data vector. The valid unit labels are: Pts Hz ppm %.
When specifying a location with a unit label, there should be no spaces
between the numerical value and the label.
xn pntN
Specifies the location of the last point in range of points to adjust,
with default units in points. The default value is the last point
in the data vector. The valid unit labels are: Pts Hz ppm %.
When specifying a location with a unit label, there should be no spaces
between the numerical value and the label.
EXAMPLES
The following example adds the constant 1.0 to all points:
nmrPipe fn ADD c 1.0
The following example adds the constant 1.0 to all real points, and 1.0 to all imaginary points, if any:
nmrPipe fn ADD r 1.0 i 1.0
The following example adds the constant "100.0" to the range of points from 5.5ppm to 4.5ppm:
nmrPipe fn ADD c 100.0 x1 5.5ppm xn 4.5ppm
The following Cshell script uses the program scale2D to extract the minimum and maximum values in a given spectrum. A processing scheme with the ADD function is used to add a suitable constant to the spectrum so that there will be no negative values in the result. The script uses the commands MATH and IMATH to evaluate floatingpoint arithmetic.
#!/bin/csh set sInfo = (`scale2D test.ft2`) set minVal = $sInfo[3] echo Minimum is $minVal if (`IMATH "$minVal < 0.0"`) then set c = (`MATH "1.0 + 1.0*$minVal"`) echo Minimum is less than zero, adding $c nmrPipe in test.ft2 fn ADD c $c out test.ft2 inPlace endif
SEE ALSO
The ADD function has corresponding functions
SET and MULT.