Skip to content
Snippets Groups Projects
Commit 206d2e52 authored by Kipp Cannon's avatar Kipp Cannon
Browse files

snglinspiraltable: flatten SnglInspiral definition

- recognizing that nothing uses the trigger class defined in
  snglinspiraltable except the trigger generator and its coincidence
  machinery, flatten the inheritence tree by one to improve attribute
  look-up performance
parent e2fa2574
No related branches found
No related tags found
No related merge requests found
......@@ -33,8 +33,30 @@ class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral):
spin1 = lsctables.SnglInspiral.spin1
spin2 = lsctables.SnglInspiral.spin2
#
# comparison is defined specifically for the coincidence code,
# allowing a bisection search of a sorted trigger list to be used
# to identify the subset of triggers that fall within a time
# interval
#
def __eq__(self, other):
return (self.ifo, self.end, self.template_id) == (other.ifo, other.end, other.template_id)
return self.end == other
def __ne__(self, other):
return self.end != other
def __lt__(self, other):
return self.end < other
def __le__(self, other):
return self.end <= other
def __gt__(self, other):
return self.end > other
def __ge__(self, other):
return self.end >= other
@property
def process_id(self):
......
......@@ -47,7 +47,7 @@ import time
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from gstlal import snglinspiraltable
from gstlal.snglinspiraltable import GSTLALSnglInspiral as SnglInspiral
import lal
from lalburst import snglcoinc
from lalinspiral import thinca
......@@ -55,28 +55,6 @@ from ligo import segments
from ligo.segments import utils as segmentsUtils
#
# =============================================================================
#
# lalinspiral.thinca Customizations
#
# =============================================================================
#
#
# Custom trigger class that defines comparison the way we need
#
class SnglInspiral(snglinspiraltable.GSTLALSnglInspiral):
# copied from thinca.SnglInspiral
__slots__ = ()
def __cmp__(self, other):
return cmp(self.end, other)
#
# =============================================================================
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment