Project

General

Profile

Actions

Bug #1951

closed

peak finder failing

Added by Anonymous almost 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
07/26/2012
Due date:
% Done:

0%

Estimated time:
Affected Version:
Appion/Leginon 2.1.0
Show in known bugs:
No
Workaround:

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
Actions #1

Updated by Anonymous almost 12 years ago

still learning redmine formatting


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 = coord[0]
        peak['ycoord'] = int(round(float(coord[0])*float(bin)))
        peak['xcoord'] = int(round(float(coord[1])*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

Actions #2

Updated by Anchi Cheng over 6 years ago

  • Status changed from New to Closed
  • Target version set to Appion/Leginon 3.1.0
Actions

Also available in: Atom PDF