spike package¶
Subpackages¶
- spike.Algo package
- Submodules
- spike.Algo.BC module
- spike.Algo.CS_transformations module
- spike.Algo.Cadzow module
- spike.Algo.Cadzow_mpi module
- spike.Algo.Cadzow_mpi2 module
- spike.Algo.Laplace module
- spike.Algo.Linpredic module
- spike.Algo.SL0 module
- spike.Algo.SL0_test module
- spike.Algo.maxent module
- spike.Algo.rQRd module
- spike.Algo.sane module
- spike.Algo.sane_old module
- spike.Algo.savitzky_golay module
- spike.Algo.urQRd module
- Module contents
- spike.Display package
- spike.File package
- Submodules
- spike.File.Apex module
- spike.File.BrukerNMR module
- spike.File.BrukerSMX module
- spike.File.GifaFile module
- spike.File.HDF5File module
- spike.File.Solarix module
- spike.File.Spinit module
- spike.File.Spinit_with2D module
- spike.File.Thermo module
- spike.File.csv module
- spike.File.mzXML module
- Module contents
- spike.Miscellaneous package
- spike.plugins package
- Submodules
- spike.plugins.Bruker_NMR_FT module
- spike.plugins.Bucketing module
- spike.plugins.FTMS_calib module
- spike.plugins.Fitter module
- spike.plugins.Linear_prediction module
- spike.plugins.PALMA module
- spike.plugins.Peaks module
- spike.plugins.apmin module
- spike.plugins.bcorr module
- spike.plugins.bokeh_display module
- spike.plugins.fastclean module
- spike.plugins.gaussenh module
- spike.plugins.pg_sane module
- spike.plugins.rem_ridge module
- spike.plugins.sane module
- spike.plugins.sg module
- spike.plugins.test module
- spike.plugins.urQRd module
- spike.plugins.wavelet module
- spike.plugins.zoom3D module
- Module contents
- spike.util package
- Submodules
- spike.util.ConfigForm module
- spike.util.ValErr module
- spike.util.compat module
- spike.util.counter module
- spike.util.debug_tools module
- spike.util.dynsubplot module
- spike.util.hashcheck module
- spike.util.log_all module
- spike.util.log_stderr module
- spike.util.log_stdout module
- spike.util.mail module
- spike.util.mail_error_logger module
- spike.util.mpiutil module
- spike.util.near_prime module
- spike.util.progrbarUi module
- spike.util.progressbar module
- spike.util.readwrite_tools module
- spike.util.sendgmail module
- spike.util.shift_comments module
- spike.util.signal_tools module
- spike.util.simple_logger module
- spike.util.simple_logger2 module
- spike.util.widgets module
- Module contents
- spike.v1 package
- Submodules
- spike.v1.Bruker module
- spike.v1.Generic module
- spike.v1.GenericDosy module
- spike.v1.GenericMaxEnt module
- spike.v1.Kore module
- spike.v1.Launch module
- spike.v1.NPKv1 module
- spike.v1.Nucleus module
- spike.v1.Param module
- spike.v1.Process1D module
- spike.v1.Process2D module
- spike.v1.Process3D module
- spike.v1.ProcessDosy module
- spike.v1.mflops module
- spike.v1.test module
- spike.v1.v1_Tests module
- Module contents
Submodules¶
spike.FTICR module¶
This file implements all the tools for handling FT-ICR data-sets
It allows to work with 1D and 2D
To use it :
import FTICR d = FTICR.FTICRData(…) # There are several possible initialisation : empty, from file play with d
d will allows all NPKData methods, plus a few specific ones.
alternatively, use an importer : from File.(Importer_name) import Import_1D d = Import_1D(“filename)”)
Created by Marc-André on 2014-08 Copyright (c) 2014 IGBMC. All rights reserved.
-
class
spike.FTICR.
FTICRAxis
(itype=0, currentunit='points', size=1024, specwidth=1000000.0, offsetfreq=0.0, left_point=0.0, highmass=10000.0, calibA=100000000.0, calibB=0.0, calibC=0.0, lowfreq=10000.0, highfreq=1000000.0)[source]¶ Bases:
spike.FTMS.FTMSAxis
hold information for one FT-ICR axis used internally
-
class
spike.FTICR.
FTICRData
(dim=1, shape=None, mode='memory', group='resol1', buffer=None, name=None, debug=0)[source]¶ Bases:
spike.FTMS.FTMSData
subclass of FTMS.FTMSData, meant for handling FT-ICR data allows 1D and 2D data-sets
spike.FTMS module¶
FTMS.py
This file defines generic classes for FT-MS Spectroscopy (FT-ICR and Orbitrap)
not meant to be used directly, but rather called from either Orbitrap.py or FTICR.py
Created by Marc-André on 2014-08 Copyright (c) 2014 IGBMC. All rights reserved.
-
class
spike.FTMS.
FTMSAxis
(itype=0, currentunit='points', size=1024, specwidth=1000000.0, offsetfreq=0.0, left_point=0.0, highmass=10000.0, calibA=0.0, calibB=0.0, calibC=0.0)[source]¶ Bases:
spike.NPKData.Axis
hold information for one FT-MS axis used internally
-
Hz_axis
()¶ return axis containing Hz values, can be used for display
-
borders
¶ the (min, max) available windows, used typically for display
-
display_icalib
(axis, xref, mzref, symbol='bo')¶ generates a plot of the current calibration xref : list of point coordinates of the reference points mzref: list of reference m/z symbol: matplotlib notation for points (default is blue rounds)
-
extract
(zoom)[source]¶ redefines the axis parameters so that the new axe is extracted for the points [start:end] zoom is defined in current axis unit
-
imzmeas
= array([-1.72723371e-077, 4.33885927e-311, -3.95252517e-323, 0.00000000e+000, 2.12199579e-314, 0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.75871011e-310, 3.50977866e+064])¶
-
lowmass
¶ highest mass of interest - defined by the Nyquist frequency limit
-
mz_axis
()¶ return axis containing m/z values, can be used for display
-
mzref
= array([-1.72723371e-077, -1.72723371e-077, 2.10077583e-312, 6.79038654e-313, 2.22809558e-312, 2.14321575e-312, 2.35541533e-312, 6.79038654e-313, 2.22809558e-312, 2.14321575e-312])¶
-
ppm
(axis, xref, mzref)¶ computes the mean error in ppm from a array of positions (xref) and the theoretical m/z (mzref) uses l1 norm ! xref : array of point coordinates of the reference points mzref: array of reference m/z
-
ppm_error
(axis, xref, mzref)¶ computes the error from a array of positions (xref) and the theoretical m/z (mzref) returns an array with errors in ppm xref : array of point coordinates of the reference points mzref: array of reference m/z
-
-
class
spike.FTMS.
FTMSData
(dim=1, shape=None, mode='memory', buffer=None, name=None, debug=0)[source]¶ Bases:
spike.NPKData.NPKData
subclass of NPKData, meant for handling FT-MS data allows 1D and 2D data-sets
-
highmass
¶ copy highmass to all the axes
-
ref_freq
¶ copy ref_freq to all the axes
-
ref_mass
¶ copy ref_mass to all the axes
-
save_msh5
(name, compressed=False)[source]¶ save data to a HDF5 file
if compressed is True, file is internally compressed using HDF5 compressors (currently zlib) not final version !!
-
specwidth
¶ copy specwidth to all the axes
-
spike.NPKConfigParser module¶
A utility that wraps ConfigParser for NPK
Typical use is :
cp = NPKConfigParser() cp.readfp(open(configfilename)) # where configfilename is the name of the config file var1 = cp.get( section, varname1) var2 = cp.get( section, varname2, default_value) … you can use get() getint() getfloat() getboolean() see details in methods.
Created by Marc-André on 2011-10-14. Copyright (c) 2011 IGBMC. All rights reserved.
MAD modif on 21 - may 2012 - added getword and removing trailing comments MAD, in April 2017 : adapted (painfully) to python3
-
class
spike.NPKConfigParser.
NPKConfigParser
(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=<object object>, converters=<object object>)[source]¶ Bases:
configparser.ConfigParser
this is a subclass of ConfigParser.ConfigParser, providing default value for values will never raise an error on missing values
-
get
(section, option, default=None, raw=0, verbose=False, fallback=<object object>)[source]¶ read a value from the configuration, with a default value
-
getboolean
(section, option, default='OFF', raw=0, verbose=False)[source]¶ read a boolean value from the configuration, with a default value
-
getfloat
(section, option, default=0.0, raw=0, verbose=False)[source]¶ read a float value from the configuration, with a default value
-
spike.NPKData module¶
NPKData.py
Implement the basic mechanisms for spectral data-sets
First version created by Marc-André and Marie-Aude on 2010-03-17.
-
class
spike.NPKData.
Axis
(size=64, itype=0, currentunit='points')[source]¶ Bases:
object
hold information for one spectral axis used internally
-
borders
¶ the (min, max) available windows, used typically for display
-
check_zoom
(zoom)[source]¶ check whether a zoom window (or any slice), given as (low,high) is valid - check low<high and within axis size - check that it starts on a real index if itype is complex return a boolean
-
cpxsize
¶ returns size of complex entries this is different from size, size == cpxsize if axis is real size == 2*cpxsize if axis is complex
-
currentunit
¶ get the current unit for this axis, to be chosen in axis.units.keys()
-
extract
(zoom)[source]¶ redefines the axis parameters so that the new axis is extracted for the points [start:end]
zoom is given in current unit - does not modify the Data, only the axis definition
This definition should be overloaded for each new axis, as the calibration system, associated to unit should be updated.
-
getslice
(zoom)[source]¶ given a zoom window (or any slice), given as (low,high) in CURRENT UNIT,
returns the value pair in index, as (star,end) which insures that - low<high and within axis size - that it starts on a real index if itype is complex raise error if not possible
-
load_sampling
(filename)[source]¶ loads the sampling scheme contained in an external file file should contain index values, one per line, comment lines start with a # complex axes should be sampled by complex pairs, and indices go up to self.size1/2
sampling is loaded into self.sampling and self.sampling_info is a dictionnary with information
-
sampled
¶ true is sampled axis
-
-
class
spike.NPKData.
LaplaceAxis
(size=64, dmin=1.0, dmax=10.0, dfactor=1.0, currentunit='damping')[source]¶ Bases:
spike.NPKData.Axis
hold information for one Laplace axis (DOSY) used internally
-
class
spike.NPKData.
NMRAxis
(size=64, specwidth=6283.185307179586, offset=0.0, frequency=400.0, itype=0, currentunit='points')[source]¶ Bases:
spike.NPKData.Axis
hold information for one NMR axis used internally
-
Hz_axis
()¶ return axis containing Hz values, can be used for display
-
-
class
spike.NPKData.
NPKData
(dim=1, shape=None, buffer=None, name=None, debug=0)[source]¶ Bases:
object
a working data used by the NPK package
The data is a numpy array, found in self.buffer can also be accessed directly d[i], d[i,j], …
1D 2D and 3D are handled, 3 axes are defined : axis1 axis2 axis3 axes are defined as in NMR in 1D, every is in axis1 in 2D, the fastest varying dimension is in axis2, the slowest in axis1 in 3D, the fastest varying dimension is in axis3, the slowest in axis1 see axis_index typical properties and methods are : utilities:
.display() .check()- properties
- .itype .dim .size1, .size2, .size3 …
- moving data :
- .row(i) .col(i) .set_row(i) .set_col(i) .copy() .load() .save()
- processing :
- .fft() .rfft() .modulus() .apod_xxx() sg() transpose() …
- arithmetics :
- .fill() .mult .add() also direct arithmetics : f = 2*d+e
all methods return self, so computation can be piped etc…
-
absmax
¶
-
adapt_size
()[source]¶ adapt the sizes held in the axis objects to the size of the buffer TO BE CALLED each time the buffer size is modified otherwise strange things will happen
-
add
(otherdata)[source]¶ add the provided data : otherdata to the current one eg : data.add(otherdata) add content of otherdata to data buffer
can add NPKData and numbers
-
addfreq
(freq, amp=1.0)[source]¶ add to the current data-set (1D) a single frequency sinusoid characterized by its frequency (from axis.specwidth) and amplitude
-
addnoise
(noise, seed=None)[source]¶ add to the current data-set (1D, 2D, 3D) a white-gaussian, characterized by its level noise, and the random generator seed.
-
apmin
(d, first_order=True, inwater=False, baselinecorr=True, apt=False, debug=False)¶ automatic 1D phase correction phase by minimizing the negative wing of the 1D spectrum
first_order = False inhibit optimizing 1st order phase inwater = True does not look to the central zone of the spectrum baselinecorr = True, an advanced baseline correction is applied on the final steps apt = True (Attached proton test) performs the phasing on up-down spectra, such as APT / DEPT 13C spectra.
performs a grid/simplex search on P0 first then on (P0 P1) the dataset is returned phased and the values are stored in d.axis1.P0 and d.axis1.P1
P1 is kept to 0 if first_order=False
- note that if baselinecorr is True
- the algo becomes quite slow !
- a simple linear baseline correction is always applied anyway anyhow
adapted from NPK v1 MAD, may 2016
-
apod_em
(lb, axis=0)[source]¶ apply an exponential apodisation, lb is in Hz WARNING : different from common definition of apodisation
-
apod_gm
(gb, axis=0)[source]¶ apply an gaussian apodisation, gb is in Hz WARNING : different from common definition of apodisation
-
apod_sq_sin
(maxi=0.0, axis=0)[source]¶ apply a squared sinebell apodisation maxi ranges from 0 to 0.5
-
apod_tm
(tm1, tm2, axis=0)[source]¶ apply a trapezoide apodisation, lb is in Hz WARNING : different from common definition of apodisation This commands applies a trapezoid filter function to the data- set. The function raises from 0.0 to 1.0 from the first point to point n1. The function then stays to 1.0 until point n2, from which it goes down to 0.0 at the last point. If in 2D or 3D then Fx tells on which axis to apply the filter.
-
apply_process
(axis_it, process, axis=0, mp=True, N_proc=None)[source]¶ scans through given data, using axis_it which is an iterator, applying process method (by its name) store results into self, along to axis if axis_it iterates over self, then processing is in-place
however it can iterate over an other data-set, thus importing the dataif self.dim is equal to axis_it().dim, then data are
if mp, does it in a multiprocessing fashion using multiprocessing.Pool() if N_proc is None, finds the optimum number itself.
-
bcorr
(npkd, method='spline', xpoints=None)¶ recapitulate all baseline correction methods, only 1D so far
- method is either
- auto:
- use bcorr_auto, uses an automatic determination of the baseline does not work with negative peaks.
- linear:
- simple 1D correction
- spline:
- a cubic spline correction
both linear and spline use an additional list of pivot points ‘xpoints’ used to calculate the baseline if xpoints absent, pivots are estimated automaticaly if xpoints is integer, it determines the number of computed pivots (defaut is 8 if xpoints is None)
default is spline with automatic detection of 8 baseline points
-
bcorr_auto
(npkd, iterations=10, nbchunks=40, degree=1, nbcores=2, smooth=True)¶ applies an automatic baseline correction
Find baseline by using low norm value and then high norm value to attract the baseline on the small values. Parameters : iterations : number of iterations for convergence toward the small values. nbchunks : number of chunks on which is done the minimization. Typically, each chunk must be larger than the peaks. degree : degree of the polynome used for approaching each signal chunk. nbcores : number of cores used for minimizing in parallel on many chunks (if not None)
smooth i True, applies a final Savitsky-Golay smoothing
-
bcorr_lin
(npkd, xpoints, axis='F2')¶ ” compute and applies a linear function as a baseline correction xpoints are the location of pivot points
-
bcorr_spline
(npkd, xpoints, axis='F2')¶ ” compute and applies a spline function as a baseline correction xpoints are the location of pivot points
-
bk_corr
()¶ applies a correction on the spectrum for the time offset in the FID. time offset is stored in the axis property zerotime
-
bk_ftF1
(data)¶ emulates Bruker ft of a 2D in F1 depending on FnMode
None 0 QF 1 QSEQ 2 TPPI 3 States 4 States-TPPI 5 Echo-AntiEcho 6
-
bk_ftF2
(data)¶ emulates Bruker ft of a 2D in F1 depending on FnMode
-
bk_pk
()¶ applies a correction on the spectrum for the time offset in the FID and from proc file parameters.
-
bk_wdw
(data, axis=1)¶ emulates Bruker window function
-
bk_xf1
(data)¶ emulates xf1 command from topspin
-
bk_xf2
(data)¶ emulates xf2 command from topspin
-
bk_xf2p
()¶ applies a correction on the spectrum for the time offset in the FID and from proc file parameters.
-
bk_xfb
(data)¶ emulates xfb command from topspin
-
bokeh
(npkd, scale=1.0, autoscalethresh=3.0, absmax=None, show=False, title=None, label=None, xlabel='_def_', ylabel='_def_', axis=None, image=False, mode3D=False, zoom=None, mpldic={}, dbkdic={}, dfigdic={}, linewidth=1, color=None, plot_width=600, plot_height=400, sizing_mode=None, redraw=False, tools='pan, box_zoom, box_select, reset, save')¶ Display using bokeh instead of matplotlib
scale allows to increase the vertical scale of display absmax overwrite the value for the largest point, which will not be computed
display is scaled so that the largest point is first computed (and stored in absmax), and then the value at absmax/scale is set full screen- show will call bk.show() at the end, allowing every declared display to be shown on-screen
- useless in ipython/jupyter notebook
title add a title to the bokeh plot label add a label text to plot xlabel, ylabel axes label (default is self.currentunit - use None to remove) axis used as axis if present, axis length should match experiment length
in 2D, should be a pair (xaxis,yaxis)- image if True, the function will generate the 2D NMR FID of data,
- if False (Default), the function present contour plots.
mode3D not implemented zoom is a tuple defining the zoom window (left,right) or ((F1_limits),(F2_limits))
defined in the current axis unit (points, ppm, m/z etc ….)mpldic a dictionnary passed as is to the matplotlib plot command dbkdic a dictionnary passed as is to populated the parameters of the bokeh graph dfigdic a dictionnary passed as is to populated the content of the bokeh figure linewidth linewidth for the plots (useful for example when using seaborn) color if 1D is the color of the curve,
if 2D FID is the palette name to be used, if 2D contour is the color set to be used by matplotlib.plot_width, plot_height width and height of the plot sizing_mode if provided, resize plot according to the window chosen sizes.
e.g. “scale_width”, “scale_height”, “scale_both”- tools a string containing the tools to be available for bokeh interactivity.
- e.g. “pan, box_zoom, box_select, reset, save” (see bokeh doc for more info)
-
bruker_corr
()¶ applies a correction on the spectrum for the time offset in the FID. time offset is stored in the axis property zerotime
-
bruker_proc_phase
()¶ applies a correction on the spectrum for the time offset in the FID and from proc file parameters.
-
bucket1d
(data, zoom=(0.5, 9.5), bsize=0.04, pp=False, thresh=10, file=None)¶ This tool permits to realize a bucket integration from the current 1D data-set. You will have to give (all spectral values are in ppm)
- zoom (low,high), : the starting and ending ppm of the integration zone in the spectrum
- bsize: the size of the bucket
- pp: if True, the number of peaks in the bucket is also added
- peaks are detected if intensity is larger that thresh*noise
- file: the filename to which the result is written
- For a better bucket integration, you should be careful that :
- the bucket size is not too small, size is better than number !
- the baseline correction has been carefully done
- the spectral window is correctly determined to encompass the meaningfull spectral zone.
-
bucket2d
(data, zoom=((0.5, 9.5), (0.5, 9.5)), bsize=(0.1, 0.1), pp=False, thresh=10, file=None)¶ This tool permits to realize a bucket integration from the current 2D data-set. You will have to give the following values: (all spectral values are in ppm)
- zoom (F1limits, F2limits), : the starting and ending ppm of the integration zone in the spectrum
- bsize (F1,F2): the sizes of the bucket
- pp: if True, the number of peaks in the bucket is also added
- peaks are detected if intensity is larger that thresh*noise
- file: the filename to which the result is written
- For a better bucket integration, you should be careful that :
- the bucket size is not too small, size is better than number !
- the baseline correction has been carefully done
- the spectral window is correctly determined to encompass the meaningfull spectral zone.
-
calib
(npk, axis=1, method='l1', verbose=False)¶ the current FTMS experiment is recalibrated optimatly along its axis ‘axis’ (usefull only in 2D) using parameters provided with set_calib() uses the current (2 or 3 parameters) calibration
method is either ‘l1’ (robust) or ‘l2’ (classic)
The current calibration is copied to a new unused axis called RefAxis
-
calibdosy
(npk, nucleus='1H')¶ use stored parameters to determine correct DOSY calbiration
-
centroid
(npkd, *arg, **kwarg)¶
-
check
(warn=False)[source]¶ check basic internal validity raises exceptions unless warn is set to True - in which case, only warnings are issued can be used in pipes as it returns self if everything is ok
-
check_zoom
(zoom)[source]¶ check whether a zoom window, given as (low,high) or ((low1,high1),(low2,high2)) is valid - check low<high and within axis size - check that it starts on a real index in itype is complex return a boolean
-
chsize
(sz1=-1, sz2=-1, sz3=-1)[source]¶ Change size of data, zero-fill or truncate. DO NOT change the value of OFFSET and SPECW, so EXTRACT should always be preferred on spectra (unless you know exactly what your are doing).
-
conv_n_p
()¶ realises the n+p to SH conversion
-
cpxsize1
¶ returns the size of the F1 spectral axis in 1D 2D and 3D (number of entries, real or complex) i.e. the unique axis in 1D, the slowest axis in 2D and 3D
-
cpxsize2
¶ returns the size of the F2 spectral axis in 2D and 3D (number of entries, real or complex) i.e. the slowest axis in 2D and the intermediate in 3D
-
cpxsize3
¶ returns the size of the F3 spectral axis in 3D (number of entries, real or complex) i.e. the slowest axis in 3D
-
diag
(direc='F12')[source]¶ In 2D, extracts the diagonal of the 2D and put into the 1D buffer.
In 3D, extracts one diagonal plane of the 3D cube, chosen with the direc parameter and put it into the 2D buffer direct values are :
“F12” is the F1=F2 diagonal “F23” is the F2=F3 diagonal “F13” is the F1=F3 diagonal
-
dim
¶ returns the dimension of data : 1 2 or 3 (for 1D 2D or 3D)
-
display
(scale=1.0, autoscalethresh=3.0, absmax=None, show=False, label=None, new_fig=True, axis=None, zoom=None, xlabel='_def_', ylabel='_def_', title=None, figure=None, linewidth=1, color=None, mpldic={}, mode3D=False)[source]¶ not so quick and dirty display using matplotlib or mlab - still a first try
- scale allows to increase the vertical scale of display,
- in 2D if “auto” will compute a scale so the first level is located at at autoscalethresh sigma
autoscalethresh used for scale=”auto” absmax overwrite the value for the largest point, which will not be computed
display is scaled so that the largest point is first computed (and stored in _absmax), and then the value at _bsmax/scale is set full screen- show will call plot.show() at the end, allowing every declared display to be shown on-screen
- useless in ipython
label add a label text to plot xlabel, ylabel : axes label (default is self.currentunit - use None to remove) axis used as axis if present, axis length should match experiment length
in 2D, should be a pair (xaxis,yaxis)- new_fig will create a new window if set to True (default) (active only is figure==None)
- if new_fig is a dict, it will be passed as is to plt.figure()
mode3D obsolete zoom is a tuple defining the zoom window (left,right) or ((F1_limits),(F2_limits))
defined in the current axis unit (points, ppm, m/z etc ….)figure if not None, will be used directly to display instead of using its own linewidth: linewidth for the plots (useful for example when using seaborn) mpldic: a dictionnary passed as is to the plot command
can actually be called without harm, even if no graphic is available, it will just do nothing.
-
display_calib
(npkd, axis=1, compare=False)¶ generates a plot of the current calibration if compare is True, will try to draw the previous calibration curve along with the current one
-
display_fit
(npkd, **kw)¶ displays the result of the fit accept the same arguments than display()
-
display_peaks
(npkd, peak_label=False, zoom=None, show=False, color=None, markersize=6, figure=None)¶ display the content of the peak list, zoom is in current unit.
-
do_palma
(npkd, miniSNR=32, mppool=None, nbiter=1000, lamda=0.1, uncertainty=1.2, precision=1e-08)¶ realize PALMA computation on each column of the 2D datasets dataset should have been prepared with prepare_palma()
the noise in the initial spectrum is analysed on the first DOSY increment then each column is processed with palma() if its intensity is sufficient
miniSNR: determines the minimum Signal to Noise Ratio of the signal for allowing the processing mppool: if passed as a multiprocessing.Pool, it will be used for parallel processing
the other parameters are transparently passed to palma()
-
extract
([[x1, y1]])[source]¶ extract([x1, y1], [x2, y2]) or extract([x1, y1, x2, y2]) etc…
Permits to extract a portion of the data. Data can then be processed as a regular data-set. EXTRACT changes the value of OFFSET and SPECW accordingly.
- extract(x1,y1) for 1D datasets.
- extract(x1, y1, x2, y2) for 2D datasets.
coordinates are given in axis current unit
see also : chsize
-
f1demodu
(shift, axis=1)[source]¶ ‘demodulate’ a given 2D with FID along F1 by multiplying it with the complex serie exp(j 2 pi shift) this has the effect of shifting the frequency by ‘shift’ expressed in Hz
Only for 2D. it is assumed to have complex pairs in even and odd columns faked by calling flipphase()
-
fake
(dd, title)¶ fake method
-
fastclean
(npkd, nsigma=2.0, nbseg=20, axis=0)¶ set to zeros all points below nsigma times the noise level This allows the corresponding data-set, once stored to file, to be considerably more compressive.
- nsigma: float
- the ratio used, typically 1.0 to 3.0 (higher compression)
- nbseg: int
- the number of segments used for noise evaluation, see util.signal_tools.findnoiselevel
- axis: int
- the axis on which the noise is evaluated, default is fastest varying dimension
-
fft
(axis=0)[source]¶ computes the complex Fourier transform,
takes complex time domain data and returns complex frequency domain data
see test_axis for information on axis
-
fftr
(axis=0)[source]¶ computes the alternate Fourier transform,
takes complex time domain data and returns real frequency domain data
see test_axis for information on axis
-
fit
(npkd, zoom=None)¶ fit the 1D npkd data-set for Lorentzian line-shape current peak list is used as an initial values for fitting Only peaks within the zoom windows are fitted
- fitting is contraint from the initial values
- intensity will not allowed to change by more than x0.5 to x2
- positions by more than 5 points
- width by more than x5
(constraints work only for scipy version >= 0.17 )
It may help to use centroid() to pre-optimize the peak list before calling fit(), or calling fit() twice (slower)
-
flip
()[source]¶ on a 2D with axis2.itype==1 and axis1.itype==0 copies the imaginary from on axis to the other after this, we have
axis2.itype==0 and axis1.itype==1 size1 is doubled size2 is halvedUseful for complex FT this is the opposite of flop()
>>>bb=NPKData(buffer=array([[ 0., 1., 2., 3.],[ 4., 5., 6., 7.],[ 8., 9., 10., 11.],[ 12., 13., 14., 15.]])) >>>print bb.buffer array([[ 0., 1., 2., 3.],
[ 4., 5., 6., 7.], [ 8., 9., 10., 11.], [ 12., 13., 14., 15.]])>>>bb.axis2.itype=1 >>>print bb.typestr() data-set is complex in F2 >>>bb.flip() >>>print bb.typestr() data-set is complex in F1 >>>print bb.buffer array([[ 0., 2.],
[ 1., 3.], [ 4., 6.], [ 5., 7.], [ 8., 10.], [ 9., 11.], [ 12., 14.], [ 13., 15.]])
-
flipphase
(ph0, ph1, axis=1)[source]¶ equivalent to flip(); phase();flop() but much faster apply a phase correction along F1 axis of a 2D. on 2D where axis1.itype = 0 and axis2.itype = 1 using pairs of columns as real and imaginary pair phase corrections are in degree
-
flop
()[source]¶ on a 2D with axis2.itype==0 and axis1.itype==1 copies the imaginary from on axis to the other after this, we have
axis2.itype==1 and axis1.itype==0 size1 is halved size2 is doubledUseful for complex FT this is the opposite of flip()
-
ft_n_p
(data, axis='F1')¶ F1-Fourier transform for N+P (echo/antiecho) 2D
-
ft_phase_modu
(data, axis='F1')¶ F1-Fourier transform for phase-modulated 2D
-
ft_seq
(data)¶ performs the fourier transform of a data-set acquired on a Bruker in simultaneous mode Processing is performed only along the F2 (F3) axis if in 2D (3D)
(Bruker QSIM mode)
-
ft_sh
(data, axis='F1')¶ States-Haberkorn F1 Fourier transform
-
ft_sh_tppi
(data, axis='F1')¶ States-Haberkorn / TPPI F1 Fourier Transform
-
ft_sim
(data)¶ performs the fourier transform of a data-set acquired on a Bruker in simultaneous mode Processing is performed only along the F2 (F3) axis if in 2D (3D)
(Bruker QSIM mode)
-
ft_tppi
(data, axis='F1')¶ TPPI F1 Fourier transform
-
gaussenh
(npkd, width, enhancement=2.0, axis=0)¶ apply an gaussian enhancement, width is in Hz enhancement is the strength of the effect multiplies by gauss(width) * exp(-enhancement*width)
-
get_buffer
(copy=False)[source]¶ returns a view or a copy of the numpy buffer containing the NPKData values dtype is either real or complex if axis is complex. remarks :
- default is a view, if you want a copy, simply do d.get_buffer(copy=True)
- if you use a view, do not modify the size, nor the dtype
- see set_buffer()
WARNING - In nD with n>1 and if NPKData is hypercomplex, only the fastest (n) axis is considered, all other imaginary parts are left as real.
-
ifft
(axis=0)[source]¶ computes the inverse of fft(), takes complex frequency domain data and returns complex time domain data
see test_axis for information on axis
-
ifftr
(axis=0)[source]¶ computes the inverse of fftr, takes real frequency domain data and returns complex time domain data
see test_axis for information on axis
-
irfft
(axis=0)[source]¶ computes the inverse of rfft(), takes complex frequency domain data and returns real time domain data
see test_axis for information on axis
-
itype
¶ returns complex type of each axes coded as single number, using NPKv1 code
-
kaiser
(beta, axis=0)[source]¶ apply a Kaiser apodisation beta is a positive number
beta Window shape —- ———— 0 Rectangular 5 Similar to a Hamming 6 Similar to a Hanning 8.6 Similar to a Blackman
-
load_sampling
(filename, axis=1)[source]¶ equivalent to the axis.load_sampling() method - can be pipelined
-
load_txt
(name)[source]¶ load 1D data in texte, single column, no unit - with attributes as pseudo comments
-
lpext
(npkd, final_size, lprank=10, algotype='burg')¶ extends a 1D FID or 2D FID in F1 up to final_size, using lprank coefficients, and algotype mode
-
mean
(zone=None)[source]¶ computes mean value in the designed spectral zone (NEW!) returns a complex if data is complex along fastest axis
-
median
()[source]¶ Executes a median filter on the data-set (1D or 2D).a window of x points (or y by x in 2D) is moved along the data set, the point are ordered, and the indexth point is taken as the new point for the data set.
-
mult
(multiplier)[source]¶ Multiply data-set by a scalar eg : d.mult(alpha) multiplies d buffer by alpha
-
mult_by_vector
(axis, vector, mode='real')[source]¶ multiply the data-set by a vector, along a given axis if mode == “real”, does it point by point regardles of itype if mode == “complex” uses axis.itype to determine how handle complex values
in all cases vector can be real or complex
-
palma
(npkd, N, nbiter=1000, uncertainty=1.0, lamda=0.1, precision=1e-08, full_output=False)¶ realize PALMA computation on a 1D dataset containing a decay dataset should have been prepared with prepare_palma on each column, the noise is estimated, then PPXA+ algorithm is applied nbiter: maximum iteration number of the PALMA algo
- uncertainty: noise is estimated on the dataset, and then multiplied by this value
- so uncertainty=1 is full confidence in the noise evaluation algo uncertainty>1 allows more room for algo when data quality is poor
- lamda is the balance between entropy and L1
- lamda = 0 is full L1 lamda = 1 is full Ent
precision: is the required precision for the convergence full_output is used for debugging purposes, do not use in production
check PPXAplus() doc for details
-
peakpick
(npkd, threshold=None, zoom=None, autothresh=3.0)¶ performs a peak picking of the current experiment threshold is the level above which peaks are picked
None (default) means that autothresh*(noise level of dataset) will be used - using d.std() as proxy for noise-level- zoom defines the region on which detection is made
- zoom is in currentunit (same syntax as in display) None means the whole data
-
peaks2d
(npkd, threshold, zoom)¶ code for NPKData 2D peak picker
-
pg_sane
(npkd, HTmode='projection', axis=1, iterations=10, HTratio=None, rank=20, Lthresh=2.0, sampling=None, size=None, final='SANE')¶ Papoulis Gershberg algorithm - stabilized with SANE
This function takes FID with a partial sampling, and fills the holes with estimated values. The FID can then be processed normally, as it was completely acquired.
mode (threshold or projection) determine PG algorithm iterations : the number of iterations used for the program
pg_sane converges quite rapidely, and usually 5 to 20 iterations are suffisant. when the SNR is high, or for large data-sets (>8k) more iterations might be needed- HTratio: number of lines left by HT/projection - usually a few % of the whole spectrum
- default is 0.01 ( 1% )
- rank : a rough estimate of the number of lines present in the FT spectrum of the FID - not stringent -
- if in doubt, use a slightly larger value.
- Lthresh : the multiplier for HT/threshold, usually 2.0
- lower recovers more weak signals but requires more iterations higher requires less iteration but look only to larger peaks.
- sampling : if provided, the sampling index list and npkd is supposed to be zerofilled (missing values set to zero)
- if None, npkd.axis1.sampled should be True, and sampling it will be fetched via npkd.axis1.get_sampling()
- final: the final step after iterations,
- default is ‘SANE’: better (noise-less) data-sets, the best reconstruction quality in simulations ‘PG’ to reapply PG step - produces the cleanest/more compressible data-sets ‘Reinject’: the closest to acquired data - to use if there is very little noise.
size: if different from None, pg_sane will also extrapolate to size
-
phase
(ph0, ph1, axis=0)[source]¶ apply a phase correction along given axis phase corrections are in degree for a N complex spectrum, correction on ith point is
ph = ph0 +ph1*(i/N - 0.5) so central point is unchanged
-
pp
(npkd, threshold=None, zoom=None, autothresh=3.0)¶ performs a peak picking of the current experiment threshold is the level above which peaks are picked
None (default) means that autothresh*(noise level of dataset) will be used - using d.std() as proxy for noise-level- zoom defines the region on which detection is made
- zoom is in currentunit (same syntax as in display) None means the whole data
-
prepare_palma
(npkd, finalsize, Dmin, Dmax)¶ this method prepares a DOSY dataset for processing - computes experimental values from imported parameter file - prepare DOSY transformation matrix
-
proj
(axis=0, projtype='s')[source]¶ returns a projection of the dataset on the given axis projtype determines the algorithm :
“s” is for skyline projection (the highest point is retained) “m” is for mean,
-
real
(axis=0)[source]¶ This command extract the real part of the current the data set considered as complex. <ul> <li>axis is not needed in 1D, <li>can be F1, F2 or F12 in 2D, <li>and can be F1, F2, F3, F12, F13, F23, or F123 in 3D. </ul>
-
rem_ridge
(data)¶ This function removes a F1 ridge by evaluating a mean avalue over the last 10% data of each column of a 2D
-
report_peaks
(npkd, file=None, format=None)¶ print the content of the peak list, using the current unit
if file should be an already opened writable file stream. if None, output will go to stdout
for documentation, check Peak1D.report() and Peak2D.report()
-
reverse
(axis=0)[source]¶ reverse the order of the current data-set (i.e. first points are last, last points are first). If dataset is complex, REVERSE will reverse the complex vector (2 by 2).
-
revf
(axis=0)[source]¶ Processes FID data-sets by multiplying by -1 2 points out of 4. Permits to preprocess Bruker FIDs in Dim 2 (Bruker trick) before RFT, or permits to bring back zero frequency in the center for some other data formats
-
rfft
(axis=0)[source]¶ computes the real Fourier transform, takes real time domain data and returns complex frequency domain data
see test_axis for information on axis
-
sane
(npkd, rank, orda=None, iterations=1, axis=0, trick=True, optk=False, ktrick=False)¶ Apply “sane” denoising to data rank is about 2 x number_of_expected_lines Manages real and complex cases. Handles the case of hypercomplex for denoising of 2D FTICR for example.
sane algorithm. Name stands for Support Selection for Noise Elimination. From a data series return a denoised series denoised data : the series to be denoised - a (normally complex) numpy buffer rank : the rank of the analysis orda : is the order of the analysis
internally, a Hankel matrix (M,N) is constructed, with M = orda and N = len(data)-orda+1 if None (default) orda = (len(data)+1)/2iterations : the number of time the operation should be repeated optk : if set to True will calculate the rank giving the best recovery for an automatic estimated noise level. trick : permits to enhanced the denoising by using a cleaned signal as the projective space. “Support Selection” ktrick : if a value is given, it permits to change the rank on the second pass.
The idea is that for the first pass a rank large enough as to be used to compensate for the noise while for the second pass a lower rank can be used.
-
save_csv
(name, fmt='%.9g')[source]¶ save 1D data in csv, in 2 columns : x, y x values are conditions by the .currentunit attribute data attributes are stored as pseudo comments
data can be read back with File.csv.Import_1D()
-
save_txt
(name)[source]¶ save 1D data in texte, single column, no unit - with attributes as pseudo comments
-
set_buffer
(buff)[source]¶ modify the internal buffer of the NPKData. allows real or complex arrays to be used remarks
- see get_buffer()
-
set_calib
(npkd, mzmeas, mzref, axis=1)¶ preset parameters for mass calibration mzref : list of reference m/z of calibrants mzmeas : list of measured m/z of calibrants
axis is the axis to be calibrated, defaut is 1
-
set_col
(i, d1D)[source]¶ set into the current 2D the given 1D, as the column at position 0<=i<=size2-1
-
set_unit
(currentunit)[source]¶ a method equivalent to the unit property can be used in processing pipelines if currentunit is a list/tuple, each entries are applied to the different axes
-
sg
(npkd, window_size, order, deriv=0, axis=0)¶ applies Savitzky-Golay of order filter to data window_size : int
the length of the window. Must be an odd integer number.- order : int
- the order of the polynomial used in the filtering. Must be less than window_size - 1.
- deriv: int
- the order of the derivative to compute (default = 0 means only smoothing)
- axis: int
- the axis on which the filter is to be applied, default is fastest varying dimension
-
sg2D
(npkd, window_size, order, deriv=None)¶ applies a 2D Savitzky-Golay of order filter to data window_size : int
the length of the square window. Must be an odd integer number.- order : int
- the order of the polynomial used in the filtering. Must be less than window_size - 1.
- deriv: None, ‘col’, or ‘row’. ‘both’ mode does not work.
- the direction of the derivative to compute (default = None means only smoothing)
can be applied to a 2D only.
-
simulate
(npkd, zoom=None)¶ Simulate the 1D npkd data-set using the content of the Peak List replace the current data-set
-
size1
¶ returns the size of the F1 spectral axis in 1D 2D and 3D i.e. the unique axis in 1D, the slowest axis in 2D and 3D warning, if data along axis is complex, the size is twice the number of complex pairs
i.e. this is the size of the underlying array
-
size2
¶ returns the size of the F2 spectral axis in 2D and 3D i.e. the slowest axis in 2D and the intermediate in 3D warning, if data along axis is complex, the size is twice the number of complex pairs
i.e. this is the size of the underlying array
-
size3
¶ returns the size of the F3 spectral axis in 3D i.e. the slowest axis in 3D warning, if data along axis is complex, the size is twice the number of complex pairs
i.e. this is the size of the underlying array
-
std
(zone=None)[source]¶ computes standard deviation in the designed spectral zone Computes value on the real part only
-
swap
(axis=0)[source]¶ swap both parth to complex this is the opposite of swa() >>>aa=NPKData(buffer=arange(8.)) >>>aa.axis1.itype=1 >>>print aa.buffer array([ 0., 1., 2., 3., 4., 5., 6., 7.]) >>>print aa.swa().buffer array([ 0., 4., 1., 5., 2., 6., 3., 7.])
-
test_axis
(axis=0)[source]¶ tests on axis
- in 1D, axis is not used
- axis has to be 1 or “F1”
- in 2D, axis is either 2 for horizontal / faster incremented dimension == “F2”
- or 1 for the other dimension == “F1” defaut is 2
- in 3D, axis is 3, 2 or 1 with 3 the faster incremented and 1 the slower == F3 F2 F1
- defaut is 3
alternativaly, you may use the strings “F1”, “F2” or “F3” BUT not F12 F23 as 0 is set to default
-
transpose
(axis=0)[source]¶ Transposes the 2D matrix or planes of the 3D cube. The sizes of the matrix must be a power of two for this command to be used. After transposition, the two dimensions are completely permuted
axis is used in 3D to tell which submatrices should be transposed
see also : sym chsize modifysize
-
unit
¶ copy currentunit to all the axes
-
unswap
(axis=0)[source]¶ this is the opposite of swap() >>>aa=NPKData(buffer=arange(8.)) >>>aa.axis1.itype=1 >>>print aa.buffer array([ 0., 1., 2., 3., 4., 5., 6., 7.]) >>>print aa.unswa().buffer array([ 0., 2., 4., 6., 1., 3., 5., 7.])
-
urqrd
(npkd, k, orda=None, iterations=1, axis=0)¶ Apply urQRd denoising to data k is about 2 x number_of_expected_lines Manages real and complex cases. Handles the case of hypercomplex for denoising of 2D FTICR for example.
-
wavelet
(npkd, nsigma=1.0, wavelet='db3')¶ Performs the wavelet denoising of a 1D or 2D spectrum.
- nsigma the threshold is nsigma times the estimate noise level,
- default 1.0 - corresponds to a relatively strong denoising
- wavelet the wavelet basis used, default ‘db3’ (Daubechies 3)
- check pywt.wavelist() for the list of possible wavelet
eg: d.wavelet(nsigma=0.5) # d is cleaned after execution
ref: Donoho DL (1995) De-noising by soft-thresholding. IEEE Trans Inf Theory 41:613–621.
Based on the PyWavelet library
-
xcol
(start=0, stop=None, step=1)[source]¶ an iterator over columns of a 2D so for c in matrix.xcol():
do something with c…is equivalent to for i in range(matrix.size2): # i.e. all cols
c = matrix.col(i) do something with c…you can limit the range by giving start, stop and step arguments - using the same syntax as xrange()
on hypercomplex data matrix.xcol( step=matrix.axis2.itype+1 ) will step only on cols associated to the real point
-
xplane
(axis, start=0, stop=None, step=1)[source]¶ an iterator over planes of a 3D along axis (1, 2 or 3) (see test_axis() for documentation on axis selection)
so for p in matrix.xplane(“F1”):
do something with p…will scan through all F1 planes
you can limit the range by giving start, stop and step arguments - using the same syntax as xrange()
on hypercomplex axis matrix.xplane(“F2, step=matrix.axis2.itype+1 ) will step only on planes associated to the real point
-
xrow
(start=0, stop=None, step=1)[source]¶ an iterator over rows of a 2D so for r in matrix.xrow():
do something with r…is equivalent to for i in range(matrix.size1): # i.e. all rows
r = matrix.row(i) do something with r…you can limit the range by giving start, stop and step arguments - using the same syntax as xrange()
on hypercomplex data matrix.xrow( step=matrix.axis1.itype+1 ) will step only on rows associated to the real point
-
class
spike.NPKData.
NPKDataTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
- Testing NPKData basic behaviour -
-
spike.NPKData.
NPKData_plugin
(name, method, verbose=False)[source]¶ This function allows to register a new method inside the NPKData class.
for instance - define myfunc() anywhere in your code :
- def myfunc(npkdata, args):
- “myfunc doc” …do whatever, assuming npkdata is a NPKData return npkdata # THIS is important, that is the standard NPKData mechanism
then elsewhere do : NPKData_plugin(“mymeth”, myfunc)
then all NPKData created will have the method .mymeth()
look at ..plugins for details
-
class
spike.NPKData.
Unit
(name='points', converter=<function ident>, bconverter=<function ident>, reverse=False, scale='linear')[source]¶ Bases:
object
a small class to hold parameters for units name: the name of the “unit” converter: a function converting from points to “unit” bconverter: a function converting from “unit” to points reverse: direction in which axis are displayed (True means right to left) scale: scale along this axis, possible values are ‘linear’ or ‘log’
-
spike.NPKData.
as_cpx
(arr)[source]¶ interpret arr as a complex array useful to move between complex and real arrays (see as_float)
>>> print as_cpx(np.arange(4.0)) [ 0.+1.j 2.+3.j]
-
spike.NPKData.
as_float
(arr)[source]¶ interpret arr as a float array useful to move between complex and real arrays (see as_float)
>>> print as_float(np.arange(4)*(1+1j)) [ 0. 0. 1. 1. 2. 2. 3. 3.]
-
spike.NPKData.
conj_ip
(a)[source]¶ computes conjugate() in-place
>>> conj_ip(np.arange(4)*(1+1j)) [ 0.-0.j 1.-1.j 2.-2.j 3.-3.j]
-
spike.NPKData.
flatten
(*arg)[source]¶ flatten recursively a list of lists
>>>print flatten( ( (1,2), 3, (4, (5,), (6,7) ) ) ) [1, 2, 3, 4, 5, 6, 7]
-
spike.NPKData.
hypercomplex_modulus
(arr, size1, size2)[source]¶ Calculates the modulus of an array of hypercomplex numbers. input:
arr : hypercomplex array size1 : size counting horizontally each half quadrant. size2 : siez counting vertically each half quadrant.- eg:
- arr = np.array([[1, 4],[3, 7],[1, 9],[5, 7]]) is an hypercomplex with size1 = 2 and size2 = 2
spike.NPKError module¶
untitled.py
Created by Marc-André on 2010-07-20. Copyright (c) 2010 IGBMC. All rights reserved.
spike.Orbitrap module¶
This file implements all the tools for handling Orbitrap data-sets
To use it :
import Orbitrap d = Orbitrap.OrbiData(…) # There are several possible initialisation : empty, from file play with d
d will allows all NPKData methods, plus a few specific ones.
alternatively, use an importer : from File.(Importer_name) import Import_1D d = Import_1D(“filename)”)
Created by Marc-Andre’ on 2014-09 Copyright (c) 2014 IGBMC. All rights reserved.
-
class
spike.Orbitrap.
OrbiAxis
(itype=0, currentunit='points', size=1024, specwidth=1000000.0, offsetfreq=0.0, left_point=0.0, highmass=10000.0, calibA=0.0, calibB=100000000000000.0, calibC=0.0)[source]¶ Bases:
spike.FTMS.FTMSAxis
hold information for one Orbitrap axis used internally
-
class
spike.Orbitrap.
OrbiData
(dim=1, shape=None, mode='memory', buffer=None, name=None, debug=0)[source]¶ Bases:
spike.FTMS.FTMSData
subclass of FTMS.FTMSData, meant for handling Orbitrap data doc to be written …
spike.Tests module¶
Tests.py
Created by Marc-André on 2010-07-20.
Runs tests on selected modules using the integrated unittests in the different SPIKE modules.
most default values can be overloaded with run time arguments
- Example on a module :
- python -m spike.Tests -D DATA_test -t File.Apex
-
class
spike.Tests.
NPKTest
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
overload unittest.TestCase for default verbosity - Not Used -
-
spike.Tests.
cleandir
(verbose=True)[source]¶ checking files in DATA_dir directory and removes files created by previous tests
-
spike.Tests.
do_Test
()[source]¶ Performs all tests then indicates if successfull. Gives total time elapsed.
spike.dev_setup module¶
dev_setup.py
To be called any time a new version is rolled out !
Created by Marc-Andre’ on 2010-07-20.
-
spike.dev_setup.
generate_file
(fname)[source]¶ write version to the file “name”, usually “version.py”, used later on then version.py is imported at SPIKE initialization. No revision version is included
spike.processing module¶
Processing.py
This program makes the processing of a 2D-FTICR dataset
First version by Marc-Andre on 2011-09-23.
-
class
spike.processing.
Proc_Parameters
(configfile=None)[source]¶ Bases:
object
this class is a container for processing parameters
-
spike.processing.
apod
(d, size, axis=0)[source]¶ apply apodisation and change size 4 cases
- 2D F1 or F2
- 1D coming from F1 or F2
1D or 2D in F2 are default - apodisation in apod_sin(0.5) in 2D F1 (axis=1) - apodisation is kaiser(5)
- 3 situations
- size after > size before size after < size before size after == size before
-
spike.processing.
comp_sizes
(d0, zflist=None, szmlist=None, largest=8589934592, sizemin=1024, vignette=True)[source]¶ - return a list with data-sizes, computed either
- zflist : from zerofilling index eg : (1,0,-1) szmlist : from multiplicant pairs eg : (2,2)
largest determines the largest dataset allowed sizemini determines the minimum size when downzerofilling when vignette == True (default) a minimum size data (defined by sizemini) is appended to the list
-
spike.processing.
do_proc_F1
(dinp, doutp, parameter)[source]¶ scan all cols of dinp, apply proc() and store into doutp
-
spike.processing.
do_proc_F1_demodu_modu
(dinp, doutp, parameter)[source]¶ as do_proc_F1, but applies demodu and then complex modulus() at the end
-
spike.processing.
do_proc_F1_modu
(dinp, doutp, parameter)[source]¶ as do_proc_F1, but applies hypercomplex modulus() at the end
-
spike.processing.
do_process2D
(dinp, datatemp, doutp, parameter)[source]¶ apply the processing to an input 2D data set : dinp result is found in an output file : doutp
dinp and doutp should have been created before, size of doutp will determine the processing will use a temporay file if needed
-
spike.processing.
downsample2D
(data, outp, n1, n2, compress=False, compress_level=3.0)[source]¶ takes data (a 2D) and generate a smaller dataset downsampled by factor (n1,n2) on each axis then returned data-set is n1*n2 times smaller - do a filtered decimation along n2 - simply takes the mean along n1 - set to zero all entries below 3*sigma if compress is True ** Not fully tested on non powers of 2 **
-
spike.processing.
hmclear
(d)[source]¶ given a 1D spectrum d, set to zeros all points betwen freq 0 and highmass helps compression
-
spike.processing.
intelliround
(x)[source]¶ returns a number rounded to the nearest ‘round’ (easy to FT) integer
-
spike.processing.
iterarg
(dinp, rot, size, parameter)[source]¶ an iterator used by the processing to allow multiprocessing or MPI set-up
-
spike.processing.
iterargF2
(dinp, size, scan)[source]¶ an iterator used by the F2 processing to allow multiprocessing or MPI set-up
-
spike.processing.
main
(argv=None)[source]¶ Does the whole on-file processing, syntax is processing.py [ configuration_file.mscf ] if no argument is given, the standard file : process.mscf is used.
-
spike.processing.
pred_sizes
(d0, szmult=(1, 1), sizemin=1024)[source]¶ - given an input data set, determines the optimum size s1,s2 to process it
- with a size multiplicant of szmult
szmult (szm1, szm2) where szm1 is multiplicant for s1 and szm2 for s2 szmx = 1 : no change / 2 : size doubling / 0.5 : size halving any strictly positive value is possible, 0.2 0.33 1.1 2 2.2 5 etc…
however, axes can never get smaller than sizemin returns (si1, si2, …) as the dataset dimension
-
spike.processing.
pred_sizes_zf
(d0, zf=0, sizemin=1024)[source]¶ given an input data set, determines the optimum size s1,s2 to process it with a zerofilling of zf zf = +n is doubling n times along each axis zf = -n is halving n times along each axis zf = 0 is no zerofiling however, axes can never get smaller than sizemin returns (si1, si2, …) as the dataset dimension
Module contents¶
The Spike Package