Processing S3E filtered data example¶
Introduction¶
This example is taken from Listing S7, S8 and S9 in the 2013 JBNMR nmrglue paper. In this example a 2D Agilent/Varian data set collect using a S3E filter is seperated (seperate_s3e.py), converted to NMRPipe format (Sparky file (`data.ucsf) is converted to a NMRPipe file (‘convert.py’) and finally processed (xy_s3e.py).
Instructions¶
Execute python seperate_s3e.py to seperate the S3E sum and difference spectra from data set in the Agilent/Varian fid file. This creates the files fid_dif and fid_sum.
Execute python convert.py to convert these two files to NMRPipe format. This step creates the files test_sum.fid and test_dif.fid.
Execute python xy_s3e.py to process and combine the sum and different spectra. This step creates the test.ft2 file.
The data used in this example is available for download.
Listing S7
import nmrglue as ng
dic, data = ng.varian.read('.', as_2d=True)
dic['nblocks'] /= 2
A = data[::2]
B = data[1::2]
ng.varian.write_fid('fid_sum', dic, A + B, overwrite=True)
ng.varian.write_fid('fid_dif', dic, A - B, overwrite=True)
Listing S8
import nmrglue as ng
# read in the sum data set
dic, data = ng.varian.read('.', fid_file='fid_sum', as_2d=True)
# set the spectral parameters
udic = ng.varian.guess_udic(dic, data)
udic[1]['size'] = 1500 ; udic[0]['size'] = 256
udic[1]['complex'] = True ; udic[0]['complex'] = True
udic[1]['encoding'] = 'direct' ; udic[0]['encoding'] = 'states'
udic[1]['sw'] = 50000.000 ; udic[0]['sw'] = 5000.0
udic[1]['obs'] = 125.690 ; udic[0]['obs'] = 50.648
udic[1]['car'] = 174.538 * 125.690; udic[0]['car'] = 119.727 * 50.648
udic[1]['label'] = 'C13' ; udic[0]['label'] = 'N15'
# convert to NMRPipe format
C = ng.convert.converter()
C.from_varian(dic, data, udic)
pdic, pdata = C.to_pipe()
# write out the NMRPipe file
ng.pipe.write("test_sum.fid", pdic, pdata, overwrite=True)
# repeat for the difference data set
dic, data = ng.varian.read('.', fid_file='fid_dif', as_2d=True)
C = ng.convert.converter()
C.from_varian(dic, data, udic)
pdic, pdata = C.to_pipe()
ng.pipe.write("test_dif.fid", pdic, pdata, overwrite=True)
Listing S9
import nmrglue as ng
# process the direct dimension of the sum data set
sdic, sdata = ng.pipe.read('test_sum.fid')
sdic, sdata = ng.pipe_proc.sp(sdic, sdata, off=0.45, end=0.95, pow=1, c=1.0)
sdic, sdata = ng.pipe_proc.zf(sdic, sdata, size=8192)
sdic, sdata = ng.pipe_proc.ft(sdic, sdata)
uc = ng.pipe.make_uc(sdic, sdata, dim=1)
pts = uc.f('27.5 Hz') - uc.f('0 Hz')
sdic, sdata = ng.pipe_proc.fsh(sdic, sdata, dir='ls', pts=pts)
sdic, sdata = ng.pipe_proc.ps(sdic, sdata, p0=-79.0, p1=0.0)
sdic, sdata = ng.pipe_proc.di(sdic, sdata)
# process the direct dimension of the difference data set
ddic, ddata = ng.pipe.read('test_dif.fid')
ddic, ddata = ng.pipe_proc.sp(ddic, ddata, off=0.45, end=0.95, pow=1, c=1.0)
ddic, ddata = ng.pipe_proc.zf(ddic, ddata, size=8192)
ddic, ddata = ng.pipe_proc.ft(ddic, ddata)
ddic, ddata = ng.pipe_proc.ps(ddic, ddata, p0=-90.0, p1=0.0)
uc = ng.pipe.make_uc(ddic, ddata, dim=1)
pts = uc.f('27.5 Hz') - uc.f('0 Hz')
ddic, ddata = ng.pipe_proc.fsh(ddic, ddata, dir='rs', pts=pts)
ddic, ddata = ng.pipe_proc.ps(ddic, ddata, p0=-79.0, p1=0.0)
ddic, ddata = ng.pipe_proc.di(ddic, ddata)
# sum the different and sum data sets
data = sdata + ddata
dic = ddic
# process the indirect dimension
dic, data = ng.pipe_proc.tp(dic, data)
dic, data = ng.pipe_proc.sp(dic, data, off=0.45, end=0.95, pow=1, c=1.0)
dic, data = ng.pipe_proc.zf(dic, data, size=2048)
dic, data = ng.pipe_proc.ft(dic, data, neg=True)
dic, data = ng.pipe_proc.ps(dic, data, p0=0.0, p1=0.0)
dic, data = ng.pipe_proc.di(dic, data)
dic, data = ng.pipe_proc.tp(dic, data)
# write out the results
ng.pipe.write('test.ft2', dic, data, overwrite=True)