ImageD11.peakmerge
index
/sware/exp/fable/standalone/redhate4-a64/lib/python2.5/site-packages/ImageD11/peakmerge.py

Class for reading peaksearch files, merging peaks on adjacent frames
and writing out the result...
 
This is mostly replaced with the 3D blobsearcher - this algorithm uses a lot
of memory

 
Modules
       
numpy.oldnumeric
fabio
logging
sys
time

 
Classes
       
peak
peakmerger
pkimage

 
class peak
    Represents a peak
 
  Methods defined here:
__cmp__(self, other)
For sorting - depreciated by DSU
__eq__(self, other)
For deciding if peaks overlap
__init__(self, line, omega, threshold, num, tolerance)
line = line in the outputfile from peaksearch
omega = omega rotation angle
threshold = the threshold level when the peak was found
tolerance = the distance (pixels) between peak centres for merging
__repr__(self)
Not sure that this is used, again, for printing
__str__(self)
for printing something
combine(self, other)
Combine this peak with another peak (eg merge!)
#
# If the thresholds are different, we see the same peaks
# twice. We will just pick the one with the lower threshold
#
# Otherwise we try to average them
#

 
class peakmerger
    The useful class - called by the gui to process peaksearch output
into spots
 
  Methods defined here:
__init__(self, quiet='No')
object to read in peaksearch output file and merge the peaks
quiet arg decides if we spray stdout
filter(self)
Does nothing really, just makes a self.finalpeaks array
 
TODO: pass functions to filter/compress finalpeaks
getheaderinfo(self, key)
try to find "key" in the headers and return it
getheaderkeys(self)
things in the headers
harvestpeaks(self, numlim=None, omlim=None, thresholds=None)
Harvests the peaks from the images within a range of
imagenumbers and/or omega
eg: it actually reads the numbers now
mergepeaks(self)
Merges peaks together - if they overlap and are on adjacent frames
 
More complex than initially planned
readpeaks(self, filename, startom=0.0, omstep=1.0)
Read in the output from the peaksearching script
Filename is the output file
optionally startom and omstep fill in omega ONLY if missing in file
savepeaks(self, filename)
# Write out minimal information
# list of xcorr,ycorr,omega, try to keep intensity now
setpixeltolerance(self, tolerance=2)
TODO ah... if only

 
class pkimage
    Contains the header information from an image
Also pointers to positions of lines in peaksearch output file
 
  Methods defined here:
__init__(self, name)
name is the filename
addtoheader(self, headerline)
save header info in dict
headerline is line starting with # in peaksearch output
otherheaderstuff(self, headerline)
Hard to parse header info - called by addtoheader

 
Functions
       
roundfloat(x, tol)
Return the float nearest to x stepsize tol