simple import of native dataset.
simple FID handling, processing and display
FFT with zerofilling
urQRd : noise-reduction
You have first to execute the first two cells, then you can execute independently any of the example cells. We begin first with simple import then we show how to make more elaborated commands involving data treatment algorithms such as urQRd.
%matplotlib inline
cd ../..
# load scientific environment
import spike.Orbitrap as O # loads the whole NPKV2 environment, tuned to Orbitrap
from spike.File.Thermo import Import_1D # adds the Thermofisher importer
You enter the filename, then the command Import_1D()
loads it into memory
the data is put into a python variable, that you can handle freely
#put your filename here
filename = "DATA_test/ubiquitin_5_scan_res_30000_1.dat"
o = Import_1D(filename)
print o
Then you can apply action to the data by the appending the method name to the variable. The methods may have parameters
For instance displaying, You can zoom in, and move around with the graphical tools You can also store picture files (png, pdf, etc..)
o.display(label = "FID")
methods are applied in sequence on the data, modifying its content, this is call a pipe.
apod_sin(maxi = 0.5)
corresponds to a sine-bell apodisation, with its maxium midway in the FID. (aka Hammng window)
print o
o.apod_sin(maxi = 0.5).chsize(o.buffer.size*2).rfft().modulus()
o.units = 'm/z'
o.display(label = "zerofill x2")
this is strictly equivalent
# here, we have to reload it again !
o = Import_1D(filename)
o.units = 'm/z'
o.apod_sin(maxi = 0.5)
o.chsize(o.buffer.size*4)
o.rfft()
o.modulus().display(label = "zerofill x4")
is a preprocessing technique, used for reducing the noise
The parameter $k$ given to urQRd is related to the number of expected lines in the spectrum. It should be chosen 2 to 3 times larger than this expected number.
Be carefull than the processing time and the memory footprint are both proportionnal to this value.
o = Import_1D("DATA_test/ubiquitin_5_scan_res_30000_1.dat")
o.report()
o.units = 'm/z'
rank = 30
o.urqrd(k = rank).rfft().modulus().display(label = "urQRd, rank = {}".format(rank))
there are many shortcuts and tricks in IPython, read the doc !
a couple of them are really helpful for MS processing
shift-return
o.rfft?
<TAB>
key. Try for instance typing o. <TAB>
If needed, you can directly manipulate the numeric data held into the SPIKE dataset,
the .get_buffer()
method returns the underlying numpy
array.
The .set_buffer()
method sets it, data can be real or complex.
Do .adapt_size()
afterwards if you changed the number of points.
o = Import_1D(filename)
oo = o.copy()
oo.chsize(len(o.buffer)/4) # shorten the FID
oo.set_buffer( oo.get_buffer()+800 ) # this adds a value to the data, just for display purpose
oo.adapt_size()
o.display(label = "FID")
oo.display(label = "shorten FID", new_fig = False)