ccpn.core.lib.PeakPickers package¶
PeakPickers; user peakPickers are automatically picked up by getPeakPickerTypes
Submodules¶
ccpn.core.lib.PeakPickers.NmrgluePeakPicker module¶
Nmrglue-based PeakPicker;
- class ccpn.core.lib.PeakPickers.NmrgluePeakPicker.NmrgluePeakPicker(**kwargs)[source]¶
Bases:
ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerABC
A peak picker using the Nmrglue peak picking code
- findPeaks(data) list [source]¶
Find the peaks in the numpy data; return a list with SimplePeak instances; note that SimplePeak.points are ordered z,y,x for nD, in accordance with the numpy data array
- Parameters
data – numpy nD array
:return list with SimplePeak instances
- onlyFor1D = False¶
- peakPickerType = 'Nmrglue'¶
ccpn.core.lib.PeakPickers.PeakPicker1D module¶
Simple 1D PeakPicker; for testing only
- class ccpn.core.lib.PeakPickers.PeakPicker1D.PeakPicker1D(**kwargs)[source]¶
Bases:
ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerABC
A peak picker based on Eli Billauer, 3.4.05. algorithm (see _findMaxima function).
- findPeaks(data)[source]¶
find the peaks in data (type numpy-array) and return as a list of SimplePeak instances note that SimplePeak.points are ordered z,y,x for nD, in accordance with the numpy nD data array
called from the pickPeaks() method
any required parameters that findPeaks method needs should be initialised/set before using the setParameters() method; i.e.:
myPeakPicker = PeakPicker(spectrum=mySpectrum) myPeakPicker.setParameters(dropFactor=0.2, positiveThreshold=1e6, negativeThreshold=None) corePeaks = myPeakPicker.pickPeaks(axisDict={‘H’:(6.0,11.5),’N’:(102.3,130.0)}, spectrum.peaklists[-1])
- Parameters
data – nD numpy array
:return list of SimplePeak instances
To be subclassed
- onlyFor1D = True¶
- peakPickerType = 'PeakPicker1D'¶
ccpn.core.lib.PeakPickers.PeakPickerABC module¶
PeakPicker abstract base class
- class ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerABC(**kwargs)[source]¶
Bases:
ccpn.util.traits.CcpNmrJson.CcpNmrJson
ABC for implementation of a peak picker
- autoFit¶
- classVersion = 1.0¶
- defaultPointExtension = 1¶
- dimensionCount¶
- dropFactor¶
- findPeaks(data) list [source]¶
find the peaks in data (type numpy-array) and return as a list of SimplePeak instances note that SimplePeak.points are ordered z,y,x for nD, in accordance with the numpy nD data array
called from the pickPeaks() method
any required parameters that findPeaks method needs should be initialised/set before using the setParameters() method; i.e.:
myPeakPicker = PeakPicker(spectrum=mySpectrum) myPeakPicker.setParameters(dropFactor=0.2, positiveThreshold=1e6, negativeThreshold=None) corePeaks = myPeakPicker.pickPeaks(axisDict={‘H’:(6.0,11.5),’N’:(102.3,130.0)}, spectrum.peaklists[-1])
- Parameters
data – nD numpy array
:return list of SimplePeak instances
To be subclassed
- fitMethod¶
A trait that defines a string object, casts from bytes object and is json serialisable
- keysInOrder = True¶
- negativeThreshold¶
- onlyFor1D = False¶
- peakPickerType = None¶
- pickPeaks(sliceTuples, peakList, positiveThreshold=None, negativeThreshold=None) list [source]¶
Pick peaks in spectral region defined by sliceTuples=[(start_1,stop_1), (start_2,stop_2), …], sliceTuples are 1-based; sliceTuple stop values are inclusive (i.e. different from the python slice object)
- Parameters
sliceTuples – list of (start,stop) point values per dimension (1-based)
peakList – peakList instance to add newly pickedPeaks
- Returns
list of core.Peak instances
- pointExtension¶
- positiveThreshold¶
- saveAllTraitsToJson = True¶
- setParameters(**parameters)[source]¶
Set parameters as attributes of self
Example calling function:
>>> peakPicker.setParameters(**parameters) >>> peakPicker.setParameters(fitMethod='gaussian', dropFactor=0.1)
The contents of parameters to be defined by the peakPicker class. In the above example, ‘fitMethod’ and ‘dropFactor’ are defined in the baseClass, but their properties and types are to be defined by the subclass.
- Parameters
parameters – dict of key, value pairs
- class ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerTrait(**kwds)[source]¶
Bases:
ccpn.util.traits.CcpNmrTraits.Instance
Specific trait for a PeakPicker instance.
- class jsonHandler[source]¶
Bases:
ccpn.util.traits.TraitJsonHandlerBase.CcpNmrJsonClassHandlerABC
- klass¶
alias of
ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerABC
- class ccpn.core.lib.PeakPickers.PeakPickerABC.SimplePeak(points, height, lineWidths=None, volume=None, clusterId=None)[source]¶
Bases:
object
A simple class to hold peak data
- currentIndx = 0¶
- ccpn.core.lib.PeakPickers.PeakPickerABC.getPeakPickerTypes() collections.OrderedDict [source]¶
Get peakPicker types
- Returns
a dictionary of (type-identifier-strings, PeakPicker classes) as (key, value) pairs
- ccpn.core.lib.PeakPickers.PeakPickerABC.isRegistered(peakPickerType)[source]¶
Return True if a PeakPicker class of type peakPickerType is registered
- Parameters
peakPickerType – type str; reference to peakPickerType of peakPicker class
- Returns
True if class referenced by peakPickerType has been registered else False
ccpn.core.lib.PeakPickers.PeakPickerNd module¶
Module Documentation here
- class ccpn.core.lib.PeakPickers.PeakPickerNd.PeakPickerNd(**kwargs)[source]¶
Bases:
ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerABC
A simple Nd peak picker for testing
- checkAllAdjacent¶
- findPeaks(data) list [source]¶
find the peaks in data (type numpy-array) and return as a list of SimplePeak instances note that SimplePeak.points are ordered z,y,x for nD, in accordance with the numpy nD data array
called from the pickPeaks() method
any required parameters that findPeaks method needs should be initialised/set before using the setParameters() method; i.e.:
myPeakPicker = PeakPicker(spectrum=mySpectrum) myPeakPicker.setParameters(dropFactor=0.2, positiveThreshold=1e6, negativeThreshold=None) corePeaks = myPeakPicker.pickPeaks(axisDict={‘H’:(6.0,11.5),’N’:(102.3,130.0)}, spectrum.peaklists[-1])
- Parameters
data – nD numpy array
:return list of SimplePeak instances
- fitExistingPeaks(peaks: Sequence[Peak])[source]¶
Refit the current selected peaks. Must be called with peaks that belong to this peakList
- halfBoxFindPeaksWidth¶
- halfBoxFitWidth¶
- halfBoxSearchWidth¶
- minimumLineWidth¶
Casting list, any iterable
- noise¶
- onlyFor1D = False¶
- peakPickerType = 'PeakPickerNd'¶
- pickPeaks(sliceTuples, peakList, positiveThreshold=None, negativeThreshold=None) list [source]¶
Set the default functionality for picking simplePeaks from the region defined by axisDict
- searchBoxDoFit¶
- searchBoxMode¶
- setLineWidths¶
- singularMode¶
- snapToExtremum(peak) list [source]¶
- Parameters
axisDict – Axis limits are passed in as a dict of (axisCode, tupleLimit) key, value pairs with the tupleLimit supplied as (start,stop) axis limits in ppm (lower ppm value first).
peakList – peakList instance to add newly pickedPeaks
- Returns
list of core.Peak instances
ccpn.core.lib.PeakPickers.Simple1DPeakPicker module¶
Simple 1D PeakPicker; for testing only
- class ccpn.core.lib.PeakPickers.Simple1DPeakPicker.Simple1DPeakPicker(**kwargs)[source]¶
Bases:
ccpn.core.lib.PeakPickers.PeakPickerABC.PeakPickerABC
A simple peak picker for testing
- findPeaks(data) list [source]¶
Find the local (positive) maxima in the numpy data; return a list with SimplePeak instances; note that SimplePeak.points are ordered z,y,x for nD, in accordance with the numpy data array
- onlyFor1D = True¶
- peakPickerType = 'Simple1D'¶