pwem.protocols.protocol_set_filter module

class pwem.protocols.protocol_set_filter.ProtSetFilter(**kwargs)[source]

Bases: EMProtocol

Protocol to filter sets based on its attributes through an expression that should evaluate to true or false. Some predefined expresions are stored (i.e. distance to center, distance between coordinates)

CHOICE_DISTANCE_BETWEEN_COORDS = 2
CHOICE_DISTANCE_CENTER = 1
CHOICE_FORMULA = 0
CHOICE_LABEL = {0: 'formula', 1: 'distance to center', 2: 'distance between particles', 3: 'ranking'}
CHOICE_RANKED = 3
createOutput(modifiedSet)[source]
distanceBetweenCoorStep()[source]

filter by distance between coordinates. If they are too close do not keep them

distanceCenterStep()[source]

compute distance of center to coordinates. Filter if it is two close

formulaStep()[source]

Goes through all items in the input set and applies the formula to each of them using exec. Complex python code could be run separating lines with ; To use numpy you could do import numpy; item._resolution.set(numpy.random.randint(10)) If result is True, item will be transferred to the output set

getTopRankItems(attribute, iSet, finalNumber, direc='ASC')[source]
parseTopRankParam()[source]
rankingStep()[source]

Goes through all items in the input set and takes the number/proportion of items with a higher/lower value of the chosen attribute