2727import logging
2828import numpy as np
2929
30+ from .eventmgr_cython import get_coinc_indexes_cython_twodet_twocoinc
31+
3032logger = logging .getLogger ('pycbc.events.coherent' )
3133
34+ def get_coinc_indexes_twodet_twocoinc (idxarr1 , idxarr2 , offset1 , offset2 , output ):
35+ num_idxs = get_coinc_indexes_cython_twodet_twocoinc (
36+ idxarr1 ,
37+ idxarr2 ,
38+ offset1 ,
39+ offset2 ,
40+ output
41+ )
42+ return num_idxs
43+
3244
3345def get_coinc_indexes (idx_dict , time_delay_idx , min_nifos ):
3446 """Return the indexes corresponding to coincident triggers. If only one
@@ -53,6 +65,20 @@ def get_coinc_indexes(idx_dict, time_delay_idx, min_nifos):
5365 List of indexes for triggers in geocent time that appear in
5466 multiple detectors
5567 """
68+ if min_nifos == 2 and len (idx_dict ) == 2 :
69+ ifos = list (idx_dict .keys ())
70+ # Could cache an output array if needed
71+ idxarr1 = idx_dict [ifos [0 ]]
72+ idxarr2 = idx_dict [ifos [1 ]]
73+ outarr = np .zeros (max (len (idxarr1 ), len (idxarr2 )), dtype = idxarr1 .dtype )
74+ num_idxs = get_coinc_indexes_twodet_twocoinc (
75+ idxarr1 ,
76+ idxarr2 ,
77+ time_delay_idx [ifos [0 ]],
78+ time_delay_idx [ifos [1 ]],
79+ outarr
80+ )
81+ return outarr [:num_idxs ]
5682 coinc_list = np .array ([], dtype = int )
5783 for ifo in idx_dict .keys ():
5884 # Create list of indexes above single detector threshold, in geocent
0 commit comments