Bug #1951
closedpeak finder failing
0%
Description
I noticed that running under ubuntu 12.04, python 2.7.3, numpy 1.6.1, scipy 0.10.1 that sometimes peakfinder was failing whereas it runs ok on CentOS 5.5
The problem seems to be that one of the stats isn't being returned in the same format everytime. Sometimes it's in numpy.array format, other times it was of type [(float,float)].
This might be somewhat related to issue 1401.
I fixed it for now with the following hack in apPeaks.py, which is backward compatible:
def convertBlobsToPeaks(blobtree, bin=1, tmpldbid=None, tmplnum=None, diam=None, peaktype="maximum"):
peaktree = []
#if tmpldbid is not None:
# print "TEMPLATE DBID:",tmpldbid
def setPeakCoordFromBlob(peak,blob,key,bin):
coord = blob.stats[key]
# fix put into deal with some peaks being returned wrapped in a list
while len(coord) != 2:
coord = coord0
peak['ycoord'] = int(round(float(coord0)*float(bin)))
peak['xcoord'] = int(round(float(coord1)*float(bin)))
for blobclass in blobtree:
peakdict = {}
if peaktype == "maximum":
setPeakCoordFromBlob(peakdict,blobclass,'maximum_position',bin)
else:
setPeakCoordFromBlob(peakdict,blobclass,'center',bin)
peakdict['correlation'] = blobclass.stats['mean']
peakdict['peakmoment'] = blobclass.stats['moment']
peakdict['peakstddev'] = blobclass.stats['stddev']
peakdict['peakarea'] = blobclass.stats['n']
peakdict['tmplnum'] = tmplnum
peakdict['template'] = tmpldbid
peakdict['diameter'] = diam
### add appropriate label
if tmpldbid is not None:
peakdict['label'] = "templ%d"%(tmpldbid)
elif diam is not None:
peakdict['label'] = "diam%.1f"%(diam)
peaktree.append(peakdict)
return peaktree