All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
ICARUSgeometryChecker.SimpleProximityClusterer Class Reference

Public Member Functions

def __init__
 
def __call__
 

Static Public Member Functions

def cluster
 

Public Attributes

 keyFunc
 
 tolerance
 

Private Member Functions

def _compareKeys
 

Detailed Description

Definition at line 556 of file ICARUSgeometryChecker.py.

Constructor & Destructor Documentation

def ICARUSgeometryChecker.SimpleProximityClusterer.__init__ (   self,
  keyFunc = None,
  tolerance = None 
)

Definition at line 557 of file ICARUSgeometryChecker.py.

558  def __init__(self, keyFunc = None, tolerance = None):
559  self.keyFunc = (lambda obj: obj) if keyFunc is None else keyFunc
self.tolerance = tolerance

Member Function Documentation

def ICARUSgeometryChecker.SimpleProximityClusterer.__call__ (   self,
  objects 
)

Definition at line 561 of file ICARUSgeometryChecker.py.

562  def __call__(self, objects):
563  groups = []
564  refKey = None
565  for obj in objects:
566  key = self.keyFunc(obj)
567  withPrevious = refKey is not None and self._compareKeys(key, refKey)
568  if not withPrevious:
569  refKey = key
570  groups.append(list())
571  groups[-1].append(obj)
572  # for objects
return groups
list
Definition: file_to_url.sh:28
def ICARUSgeometryChecker.SimpleProximityClusterer._compareKeys (   self,
  a,
  b 
)
private

Definition at line 574 of file ICARUSgeometryChecker.py.

575  def _compareKeys(self, a, b):
return (abs(b - a) < self.tolerance) if self.tolerance else (a == b)
T abs(T value)
def ICARUSgeometryChecker.SimpleProximityClusterer.cluster (   objs,
  keyFunc = None,
  tolerance = None 
)
static

Definition at line 577 of file ICARUSgeometryChecker.py.

578  def cluster(objs, keyFunc = None, tolerance = None):
579  return SimpleProximityClusterer(keyFunc=keyFunc, tolerance=tolerance)(objs)
580 # class SimpleProximityClusterer

Member Data Documentation

ICARUSgeometryChecker.SimpleProximityClusterer.keyFunc

Definition at line 558 of file ICARUSgeometryChecker.py.

ICARUSgeometryChecker.SimpleProximityClusterer.tolerance

Definition at line 559 of file ICARUSgeometryChecker.py.


The documentation for this class was generated from the following file: