La lecture en ligne est gratuite
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Partagez cette publication

WAVE-Tutorial for NMR-Applications
Version: 1.0 / November 1995
© Peter Blümler, School of Physical Sciences, University of Kent at Canterbury,
Canterbury, Kent CT2 7NR, United Kingdom .
Tel.: ++44-(0)1227-82-3228 4-(0)1227-82-7558 email: P.Bluemler@ukc.ac.uk
Contents:
1 . Introductio n ...................................................................................................................................... . 2
2 . Philosoph y ....................................................................................................................................... . 4
2.1 WAVE data and plottin g ........................................................................................................... . 4
2.2 NMR routines...............................................................................................................................4
3 . Principles of data handlin g .............................................................................................................. . 5
3.1 Data types and conversio n ........................................................................................................ . 5
3.2 Creation of vectors and array s ................................................................................................... . 6
3.3 Array handling and assignmen t ................................................................................................. . 7
3.4 Operators and mathematical function s .................................................................................... . 10
4 . Compiling the modules and the LIBCOMB Progra m ..................................................................... . 14
4.1 Compilation of single module s ................................................................................................. . 14
4.2 Installation of the program s ..................................................................................................... . 15
4.3 Combining modules to a librar y ............................................................................................... . 16
5. Description of the module s ............................................................................................................. . 18
5.1 Input/Output module s .............................................................................................................. . 18
5.2 Basic NMR module s ..................................................................................................................27
5.3 Imaging module s .......................................................................................................................37
5.4 Radial transformation module s ..................................................................................................41
5.5 Simulation module s ...................................................................................................................42
6. Graphic output and printin g ..............................................................................................................45
6.1 Graphic output: Plotting routine s ...............................................................................................45
6.2 Printing the plot s ........................................................................................................................46
7. Source code of the module s ................................................................................................................
FAX: ++4EM
ZZREAD


WAVE-Tutorial for NMR Applications page: 2
The concept of this tutorial is thought as an introduction for new users, who do not want to get an
„in-depth“ understanding of the programing language, but simply apply some data processing to
their NMR-data. The programms are written for the PV-WAVE PERSONAL EDITION ™ for
Microsoft Windows ™. However, in principle these routines should run in any „WAVE-environment“,
because as far as possible no specific calls of operating systems or displays were used. It should
be mentioned that a special UNIX version exists as well.
The aim of this tutorial is a brief introduction into data handling by WAVE and some of its plotting
routines. Additionally, the programm-libraries written for NMR applications are described and
explained. These libraries contain the following functions and procedures
Procedure
input, output and conversion of data
BRING reading Bruker ASPECT ™ data files
BRUKREAD reading Bruker ASPECT ™ data transferred by
BRUKNET
ESR_DOS reading Bruker OS9 ™ EPR data
reading Bruker UNIX ™ files (
LOAD loading of data written by STORE
MAC_DOS reading of data generated by TECMAG
spectrometers
ORIGIN writing data in ASCII format (for ORIGIN
SFREAD reading data stored in FORTRAN 77 (as used in
the old days of the Spiess-group)
STORE storing of max. 3D data set
reading Bruker ASPECT ™ data transferred by
ZZ-NET
Basic NMR basic NMR modules
exponential multiplication
FT Fast Fourier transform
gaussian multiplication
PHASEN application of phasing parameters to data
PHASIER phasing
PP peak picking
REDFFT FFT of data acquired by the Redfield method
SCALE scaling of data
ZS zeroshifts (left- or right-shifts)
Imaging
BP back projection
IMAGE calculation of magnitude images
MKPRO calculation of BP-like projections from a spin-
density
radial transformationsRadial Transf.
TWOPABEL two point inverse Abel transformation
THREEPABEL three point inverse Abel transformation
ONIONPEEL Inverse Abel transformation by onion peeling
CENTER centering of slices
IAT2D 2D Inverse Abel transformation
IAT3D 3D Inverse Abel transformation
Simulation simulation and fitting
MAKE_FID generation of arbitrary FID
T1FIT fitting exp. growth
T2FIT fitting exp. decay
Z_COIL B-field simulation of single loop coils
NMR imaging library
zero-filling ZF
GM
™)
uxnmr) UXNMR
Input/Output
Explanation Function Library
Introduction 1.P.Bluemler@ukc.ac.uk
WAVE-Tutorial for NMR Applications page: 3
The programms are shareware as long as they are given to non-commercial institutions, like
universities. Others should contact the author.
For further suggestions, comments and recognized mistakes or bugs please contact the author.
The most actual version of all programs and the tutorial as an PostScript-file can be ordered on
floppy from the author for a small handling fee of US$10,-- (please send cash).
If you want a printed manual, please add another US$10,--.
An actual update of all programs, libraries and this tutorial can be found on the following
web-page: (serve yourself, for free!)
All users are welcome to distribute own PV-WAVE-libraries from this server. I would prefer if you
attach them in an email to me (
Have fun,
Peter Blümler, Canterbury 1999
)
!! IMPORTANT !!WAVE-Tutorial for NMR Applications page: 4
2.1 WAVE data and plotting
WAVE is a high level programming language with very powerful plotting routines. The big
advantages are:
o interactive handling of variables which allows easy data processing for non-routine
applications,
o all routines exist in an easy access default mode, but can be controlled by additional
o the whole session is documented and can easily be converted into makros, functions or
procedures
o setting of the environment, generates a suitable output on printers
2.2 NMR routines
The NMR library is a collection of procedures and functions, which can be applied to the data by
typing in the process. This may appear somewhat inconvenient, but allows interactive controll and
analysis of the corresponding step in data processing. The construction of one „big program“ can
be done, but would restrict the flexibility in usage and increase the possibility of bugs.
Functions are preferred, because they can be incorporated into bigger command strings, while
holding the data temporary.
variables
Philosophy 2.text= ‘Hallo !’
res=BYTE (
res=STRING (
var= 2.43e2
res=COMPLEX ( real [, imaginary])
expr)
temp=2.

res=BYTSCL ( array)
var= 243D
var=255b
res=DOUBLE (
info
expr)
expr)
res=LONG (
res=FIX (
expr)
var = 243
var = 243L
expr)
expr n )

expr 1 , ... ,
res=FLOAT (
WAVE-Tutorial for NMR Applications page: 5
WAVE keeps all the defines variables, vectors and arrays stored in memory. The list of defined
data, their type and length can be listed by typing . A single variable (scalar) can be created
by a statement like . This defines the variable temp as a floating point with the entry
2.00000. If the dot is neglected than it would be an integer with the entry 2 . Some routines need
special types of input variables, but most of them are tolerant. It is important to know that there is
also a hierachy of variables, for instance if a floating point variable is mutiplied with an integer, the
result will be a floating point and not an integer.
3.1 Data types and conversion
a) BYTE
Creation: Creates a byte (0-255)
Converts an expression to byte data type.
Scales and converts an array to byte data typ e.
b) INTEGERS AND LONG-INTEGERS
Creation: from -32768 to 32767 (2 bytes)
Converts an expression to integer data type.
Creation: from -2147483647 to 2147483648 (4 bytes)
Converts an expression to longword integer data type.
c) FLOATING POINTS (COMPLEX)
-45Creation: from -8.40779*10 to 3.4*10 (4 bytes)
Converts an expression to single-precision floating-point data type.
Creation:
Converts an exp ression to double-precision floating-point data type.
creates or converts an expression to
complex data type.
d) TEXT STRINGS
Creation:
Converts the input parameters to
characters and returns a string expression.
38
Principles of data handling 3. 0
a=indgen(3,3)
0
res=FINDGEN (dim 1 , ..., dim n )
print,a
res=DIST (n)
print,a
res=DINDGEN (dim 1 , ..., dim n )
print,a
res=DBLARR (dim 1 , ... , dim n )
a=[[1,0,0], [0,1,0], [0,0,1]]
res=COMPLEXARR (dim 1 [, dim 2 , ... , dim n ])
0
res=CINDGEN ( dim 1 [, dim 2 , ... , dim n ])
0
res=BYTARR (dim 1 [, dim 2 , ... , dim n ])
0
res=BINDGEN (dim 1 [, dim 2 , ... , dim n ])
0
1.00000 1.41421 2.23607 1.41421
a=[1, 3, 7, 9, 11]
2.00000 2.23607 2.82843 2.23607
0
1.00000 1.41421 2.23607 1.41421
0
0.000000 1.00000 2.00000 1.00000
1 0
print,a
0 1 0
a=dist(4)
0 1
0 1 2 3 4 5 6 7 8
a=intarr(3,3)
print,a
0
a=indgen(9)
0
6 7 8
0
3 4 5
0 1 2
WAVE-Tutorial for NMR Applications page: 6
3.2 Creation of vectors and arrays
Nomenclature: A one-dimensional array is referred in this tutorial as a vector, but for creation or
handling, there is no difference to more-dimensional Array creation routines. All arrays (vectors)
start with index 0 !!.
There are two different ways of array generation. One is to create an array with arbitrary
dimensions filled with zeros, the entry can then be filled by data. This class of statement always
ends with ARR. Others fill the created array with entries, like the GEN commands which set the
entry to its index (or position) in the array.
Examples: for integer arrays
Small arrays can be generated by hand
for a vector
or
for more dimensions
automated generation
The statements are:
Returns a byte array with the
specified dimensions, setting the contents of the result to increasing numbers starting at 0.
Returns a byte vector or array.
Returns a complex single
-precision floating-point arr
Returns a complex single
-precision floating-point vector or array.
Returns a double-precision floating-point
Returns a double-precision floating-point
array with the specified dimensions.
Standard Library function that generates a
square array in which each element equals the euclidean distance from the nearest corner.
Returns a single-precision floating-point
array with the specified dimensions.
vector or array.
ay.res=STRARR (dim 1 , ... , dim n )
i=indgen(3)
res=REPLICATE (value, dim 1 , ..., dim n )
0 1 0
res=INDGEN ( dim 1 , ... , dim n )
0
res=SINDGEN (dim 1 , ... , dim n )
1 0
i,i)=1
0 1
TEST(*,11)=INS
a=intarr(3,3)
a(
a(0,0)=1
res=INTARR ( dim 1 , ... , dim n )
a(1,1)=1
res=LINDGEN ( dim 1 , ... , dim n )
a(2,2)=1
TEST(*,11)=0
a=intarr(3,3)
0
res=FLTARR ( dim 1 , ..., dim n )
res=LONARR ( dim 1 , ... , dim n )
WAVE-Tutorial for NMR Applications page: 7
Returns a single-precision floating-point
Returns an integer array with the
specified dimensions.
Returns an integer vector or array.
Returns a
with the specified dimensions.
Returns a
Forms an array with the given
dimensions, filled with the specified scalar value.
Returns a string array with the
specified dimensions.
Returns a string array.
3.3 Array handling and assignment
These are very practical features of WAVE, because all rows, regions or paths can be handled in a
single statement. This is demonstrated in some examples. For detailed description see the WAVE
manual.
Examples:
the following matrix should be generated:
Way 1: Generation of a zero-filled matrix and setting the elements by hand
Way 2: using an index vector
Other very practical features of PV-WAVE array handing are the possibilities to address full rows
or columns or dedicated regions of arrays by simple statements.
Examples: for an array with 200 *12 entries named as TEST
1) The last row should be set to zero. (Note that n entries run from 0 to n-1)
2) In the last row another vector named INS (200 entries) should be inserted.
manipulating entries in a matrix: A matrix can be combined in mathematical operations like scalars,
special mathematical
i
longword integer vector or array.
longword integer array
vector or array.ARR = FLTARR(100)
NAME(INDEX) = 'JOE'
MMAX = 100 * X + 2.987
DATA(100) = 1.234999
ARR = ARR(50:*)
DATA( [3, 5, 7, 9] ) = 0
NAME = 'MARY'
variable(
subscript_range) =
scalar_expression
WAVE-Tutorial for NMR Applications page: 8
Form 1
The first (and most basic) form of the assignment statement has the form:
variable = expression
Stores the value of the expression in the variable. The old value of the variable, if any, is discarded
and the value of the expression is stored in the variable. The expression on the right side may be
of any type or structure. Some examples of the basic form of the assignment statement are:
Stores the value of the expression in MMAX.
Stores the string MARY' in the variable NAME.
ARR is now a 100-element floating-point array.
Discards elements 0 to 49 of ARR. ARR is
now a 50-element array.
Form 2
The second type of assignment statement has the form:
variable(subscripts) = scalar_expression
Stores the scalar in an element of the array variable.
Here, a single element of the specified array is set to the value of the scalar expression. The
expression may be of any type and is converted, if necessary, to the type of the variable. The
variable on the left side must be either an array or a file variable.
Sets element (100) of DATA to value.
Stores a string in the array. NAME must be a
Using Array Subscripts with the Second Form
If the subscript expression is an array, the scalar value will be stored in the elements of the array
whose subscripts are elements of the subscript array. For example, the statement:
will zero the four specified elements of DATA: DATA(3), DATA(5), DATA(7), and DATA(9).
The subscript array is converted to longword type if necessary before use. Elements of the
subscript array that are negative or greater than the highest subscript of the subscripted array are
ignored.
Form 3
The third type of assignment statement is similar to the second, except the subscripts specify a
range in which all elements are set to the scalar expression.
Stores the scalar in the elements of the array variable designated by the subscript range.
A subscript range specifies a beginning and ending subscript. The beginning and ending
subscripts are separated by the colon character. An ending subscript equal to the size of the
dimension minus one may be written as *. For example, ARR(I:J) denotes those points in the
vector ARR with subscripts between I and J. I must be less than J and greater than or equal to
string array or an error will result.B(J, *) = 1
B(*) = 100.
B( [2, 4, 6 ] ) = [4, 16, 36]
var(array) = array
B(200:220, *) = 0
B(100, 200) = B(200:300, 300:400)
B(*, I) = 1
B(13, 24) = A
variable(subscripts) = array
WAVE-Tutorial for NMR Applications page: 9
zero. J must be less than the size of the array dimension. ARR(I:*) denotes the points in ARR from
ARR(I) to the last point.
Assuming the variable B is a 512-by-512 byte array, some examples are:
Stores ones in the
Stores ones in the jth column.
Zeroes all the rows of the columns 200 through 220 of the array B.
Stores the value 100 in all the elements of the array B.
Form 4
The fourth type assignment statement is of the form:
Inserts the array expression into the array variable starting at the element designated by the
subscripts.
Note that this form is syntactically identical to the second type of assignment statement, except the
expression on the right is an array instead of a scalar. This form of the assignment statement is
used to insert one array into another.The array expression on the right is inserted into the array
appearing on the left side of the equal sign, starting at the point designated by the subscripts. For
example, to insert the contents of an array called A into an array called B, starting at point
B(13,24):
If A is a 5-column by 6-row array, elements B(13:17, 24:29) will be replaced by the contents of the
Another example moves a subarray from one position to another:
A subarray of B, specifically the columns 200 to 300 and rows 300 to 400, is moved to columns
100 to 200 and rows 200 to 300, respectively.
Using Array Subscripts with the Fourth Form
If the subscript expression applied to the variable is an array and an array appears on the right
side of the statement:
elements from the right side are stored in the elements designated by the subscript vector. Only
those elements of the subscripted variable whose subscripts appear in the subscript vector are
changed.For example, the statement:
array A.
ith row.

Un pour Un
Permettre à tous d'accéder à la lecture
Pour chaque accès à la bibliothèque, YouScribe donne un accès à une personne dans le besoin