(The examples are done on a Intel Mac, Os X system. Red is my input. Blue is the computers responce. Black is a comment)
First, logon one of the iMac computers (as Chemistry 598)
(username and password)
Varian's Vnmr software is designed to run a NMR spectrometer, collect data and allow basic processing, plotting and saving of the data collected. However, for advanced analysis and designing figures for manuscripts and presentations, it is often nice to get the data out of VNMR and into other software packages. Today we will show the example of getting data from VNMR to Matlab. Matlab is a Matrix Laboratory program and is wonderful for analysis and plotting of Vector and Matrix data (i.e. NMR data). While todays example uses matlab, there are lots of scientific analysis and plotting software packages that can be used to 'work-up' NMR data (e.g. IDL, Octave, Origin, Sigmaplot, Igor, Grace, Aabel, etc.). The first step will always be to get the data saved in ascii format, which is generally readable by all spreadsheet and scientific plot/analysis programs.
So, when you are on a Varian spectrometer and using either Vnmr or Vnmrj, you can save the FID in ascii format using the command 'writefid' and you can save the spectrum in ascii format using a Varian macro called either 'writexy' or 'writespec'. Also, if you are doing 2D NMR you can write out a 1D trace in ascii format using 'writetrace'. (Also, remember that you can save your FID in Varian binary format using the command 'svf')
So, lets put 90:10 D2O:H2O sample in the 200 MHz NMR. We will lock, shim and run a nutation experiment with pw arrayed from 0 to 190 microseconds in steps of 10 microseconds. The VNMR experimental setup is summarized below:



Okay, now we want the experiment, which takes 6 minutes. The experiment collects 20 FIDs, each with a different value of pw (the pulse width). This Pulse Width Arrayed experiment is typically called a Nutation Experiment. A plot of FID #4 is shown below:

Now, we can process the data (ft), phase the second spectrum (ds(2), aph) and display the array of spectra (dssh). The plot is shown below:

From this nutation experiment, we can determine the 90 degree pulse width. This can be done visually. However, it is sometime nice to be able to fit the data to a damped sine wave which gives a more accurate estimate of the 90-degree pulse width and the damping constant is related to the amount of B1 field inhomogeneity. So, lets get the data out of VNMR and into MATLAB.
We start by saving the data: svf('nutation_Water_0to190us')
This saves the experimental raw data (the FIDs) in a binary Varian format. Specifically it creates a directory named nutation_Water_0to190us.fid and stores it in your current working directory (this can be determined by typing pwd, and is currently /home/gemini/course/chm598).
I am working on a macro to read Varian data directly into MATLAB. However, it is alway good to save as ascii data, because all analysis packages and spreadsheets will import this format.
To write the raw data, FIDs, in ascii format, use the writefid command:
writefid('nutation_Water_writefid_0us',1)
writefid('nutation_Water_writefid_10us',2)
writefid('nutation_Water_writefid_20us',3)
etc.....
(this could be done as a vnmr macro or for-loop to save time)
This saves each FID (1,2,3,...) as a column of complex (real-imaginary) intensities (no time axis given).
To avoid having to process the data in MATLAB, we can always process in VNMR and save ascii spectra. This is done with the writexy macro, and you must first process the FIDs (wft). To write out a specific spectrum, first display the spectrum you want to save.... For example spectrum #4
ds(4)
Then run the macro writexy
writexy
The ascii data set will be saved in the experimental directory as xytrace.#
For example, the above writexy command (for ds(4) would write a file /home/gemini/vnmrsys/exp43/xytrace.4)
This can be done for all 20 spectra and they are renamed and moved to /home/gemini/courses/chm598. The names are
nutation_Water_writexy_0us.txt
nutation_Water_writexy_10us.txt
nutation_Water_writexy_20us.txt
.......
nutation_Water_writexy_190us.txt
Now we have a full set of ascii spectra and original FIDs!!!
Get them onto the computer you are using.... you can do this with cyberduck (or any sftp program) or start X11 on the mac (/Applications/Utilities/X11). This will startup an xterm.
You can type the following in an xterm or terminal window (command line prompt, chm598$)
chm598$ ls
Desktop Library Music Pictures Sites
Documents Movies NMR Public
chm598$ cd Desktop
chm598$ mkdir NMR
chm598$ cd NMR
chm598$ pwd
/Users/chm598/Desktop/NMR
Now start your VNP connection so that you can connect to the internal address given to the Sun Computer running the 200 MHz spectrometer.
Once started you can now connect to 192.168. addresses.... The Sun computer is 192.168.1.2 (and you can login as 'gemini' and you should know the password)
chm598$ sftp gemini@192.168.1.2
sftp> cd courses
sftp> cd chm598
sftp> pwd
Remote working directory: /home/gemini/course/chm598
sftp> ls
briantraining briantraining.fid caffeine_stefan.fid
etoh_1d_test etoh_1d_test.fid etoh_array.fid
etoh_in_cdcl3.fid inv_rec_test1_pro1.fid meg_test.fid
meg_test_fid nutation_Water_0to190us.fid nutation_Water_writefid_0us
nutation_Water_writefid_100us nutation_Water_writefid_10us nutation_Water_writefid_110us
nutation_Water_writefid_120us nutation_Water_writefid_130us nutation_Water_writefid_140us
nutation_Water_writefid_150us nutation_Water_writefid_160us nutation_Water_writefid_170us
nutation_Water_writefid_180us nutation_Water_writefid_190us nutation_Water_writefid_20us
nutation_Water_writefid_30us nutation_Water_writefid_40us nutation_Water_writefid_50us
nutation_Water_writefid_60us nutation_Water_writefid_70us nutation_Water_writefid_80us
nutation_Water_writefid_90us nutation_Water_writexy.txt nutation_Water_writexy_0us.txt
nutation_Water_writexy_100us.txt nutation_Water_writexy_10us.txt nutation_Water_writexy_110us.txt
nutation_Water_writexy_120us.txt nutation_Water_writexy_130us.txt nutation_Water_writexy_140us.txt
nutation_Water_writexy_150us.txt nutation_Water_writexy_160us.txt nutation_Water_writexy_170us.txt
nutation_Water_writexy_180us.txt nutation_Water_writexy_190us.txt nutation_Water_writexy_20us.txt
nutation_Water_writexy_30us.txt nutation_Water_writexy_40us.txt nutation_Water_writexy_50us.txt
nutation_Water_writexy_60us.txt nutation_Water_writexy_70us.txt nutation_Water_writexy_80us.txt
nutation_Water_writexy_90us.txt ourtest ourtest.fid
test_1h_pro.fid test_cosy_pro.fid test_d2O_h2o.fid
tst_h2o.fid
so, we are in the directory on the Sun computer where all our data is.... lets download it to our iMac computer now
sftp> mget ./*
sftp> bye
chm598$ ls
briantraining nutation_Water_writexy.txt
etoh_1d_test nutation_Water_writexy_0us.txt
meg_test_fid nutation_Water_writexy_100us.txt
nutation_Water_writefid_0us nutation_Water_writexy_10us.txt
nutation_Water_writefid_100us nutation_Water_writexy_110us.txt
nutation_Water_writefid_10us nutation_Water_writexy_120us.txt
nutation_Water_writefid_110us nutation_Water_writexy_130us.txt
nutation_Water_writefid_120us nutation_Water_writexy_140us.txt
nutation_Water_writefid_130us nutation_Water_writexy_150us.txt
nutation_Water_writefid_140us nutation_Water_writexy_160us.txt
nutation_Water_writefid_150us nutation_Water_writexy_170us.txt
nutation_Water_writefid_160us nutation_Water_writexy_180us.txt
nutation_Water_writefid_170us nutation_Water_writexy_190us.txt
nutation_Water_writefid_180us nutation_Water_writexy_20us.txt
nutation_Water_writefid_190us nutation_Water_writexy_30us.txt
nutation_Water_writefid_20us nutation_Water_writexy_40us.txt
nutation_Water_writefid_30us nutation_Water_writexy_50us.txt
nutation_Water_writefid_40us nutation_Water_writexy_60us.txt
nutation_Water_writefid_50us nutation_Water_writexy_70us.txt
nutation_Water_writefid_60us nutation_Water_writexy_80us.txt
nutation_Water_writefid_70us nutation_Water_writexy_90us.txt
nutation_Water_writefid_80us ourtest
nutation_Water_writefid_90us
This will get us ALL the files in this directory (but will not get the subdirectory data, i.e., the varian directory datasets)
I have also put this data on iMac6 in PSH530. So, you can connect to this machine and get data if you prefer:
Go -> Connect to Server -> afp://129.219.53.7 -> (type u: and p:) -> chm598
I have also read in ALL data mentioned above and saved it in matlab format (Nutation_Water_Matlab.mat).
Or you can download the archived data in zip format here.
We now have ALL FIDs and SPECTRA in ASCII Format and can import this data into any common scientific software for further analysis, plotting and presentation.
As an example, lets load this data in Matlab. Because we are using intel Mac's and we don't have the latest intel Mac Java patch, we are going to do this in no jvm mode.
So, start up and xterm (and as an aside, I like the following xterm display settings, which and be stored in .Xdefaults)
chm598$ cd /Applications/MATLAB73/bin
chm598$ ./matlab -nojvm
Now this xterm window should be a Matlab workspace:
>> cd /Users/chm598/Desktop/NMR
>> load nutation_Water_writexy_0us.txt;
>> load nutation_Water_writexy_10us.txt;
>> load nutation_Water_writexy_20us.txt;
>> load nutation_Water_writexy_30us.txt;
etc..... all the way to nutation_Water_writexy_190us.txt
I have also included a rich text format (rtf) file with the matlab commands... these can be cut and paste into matlab for your convenience and to minimize typing during class.
>> whos
Name Size Bytes Class Attributes
ans 1x26 52 char
nutation_Water_writexy_0us 32768x2 524288 double
nutation_Water_writexy_100us 32768x2 524288 double
nutation_Water_writexy_10us 32768x2 524288 double
nutation_Water_writexy_110us 32768x2 524288 double
nutation_Water_writexy_120us 32768x2 524288 double
nutation_Water_writexy_130us 32768x2 524288 double
nutation_Water_writexy_140us 32768x2 524288 double
nutation_Water_writexy_150us 32768x2 524288 double
nutation_Water_writexy_160us 32768x2 524288 double
nutation_Water_writexy_170us 32768x2 524288 double
nutation_Water_writexy_180us 32768x2 524288 double
nutation_Water_writexy_190us 32768x2 524288 double
nutation_Water_writexy_20us 32768x2 524288 double
nutation_Water_writexy_30us 32768x2 524288 double
nutation_Water_writexy_40us 32768x2 524288 double
nutation_Water_writexy_50us 32768x2 524288 double
nutation_Water_writexy_60us 32768x2 524288 double
nutation_Water_writexy_70us 32768x2 524288 double
nutation_Water_writexy_80us 32768x2 524288 double
nutation_Water_writexy_90us 32768x2 524288 double
This shows all the data you just read into Matlab and the array size (all are 32768 x 2 arrays).
The first column is the x axis (in Hz) and the second column is the y axis (signal intensity). Lets shorten the name and breakup the data into x and y variables:
>> x0=nutation_Water_writexy_0us(:,1);
>> y0=nutation_Water_writexy_0us(:,2);
>> x10=nutation_Water_writexy_10us(:,1);
>> y10=nutation_Water_writexy_10us(:,2);
etc...
Now we can plot any or all of the spectra.... For example, plotting the pw=30us spectrum is
>> plot(x30,y30)
and should look something like:

Now we can determine the x-value that represents the peak max, so that we can plot this as a function of pw.
>> x=[1:1:32768]';
>> plot(x,y30,'x');
Now expand the plot to determine which point represents the peak max.... it is point 16583.
So, plot this point for all the spectra and we should have are dampled sine oscillation:
>> nuty=[y0(16583,1) y10(16583,1) y20(16583,1) y30(16583,1) y40(16583,1) y50(16583,1) y60(16583,1) y70(16583,1) y80(16583,1) y90(16583,1) y100(16583,1) y110(16583,1) y120(16583,1) y130(16583,1) y140(16583,1) y150(16583,1) y160(16583,1) y170(16583,1) y180(16583,1) y190(16583,1)]';
>> nutx=[0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190]';
>> plot(nutx,nuty,'o')
Should look something like:

Now we can fit this to a dampled sine wave.
Lets start this process over, now start with the raw data.... the FIDs.....
You can try this on your own.