コード例 #1
0
def get_slide_coincs_from_cache(cachefile, pattern, match, verb, coinc_stat):
  full_coinc_table = []
  cache = cachefile.sieve(description=pattern, exact_match=match)
  found, missed = cache.checkfilesexist()
  files = found.pfnlist()
  if not len(files):
    print >>sys.stderr, "cache contains no files with " + pattern + " description"
    return None
  # split the time slide files into 105 groups to aid with I/O
  num_files=len(files)

  #Changed by Tristan Miller as a memory fix
  #groups_of_files = split_seq(files,105)
  groups_of_files = split_seq(files,50)
  for filegroup in groups_of_files:
    if filegroup:  
      # extract the coinc table
      coinc_table = SnglInspiralUtils.ReadSnglInspiralFromFiles(filegroup, mangle_event_id=False, verbose=verb, non_lsc_tables_ok=False)
      segDict = SearchSummaryUtils.GetSegListFromSearchSummaries(filegroup)
      rings = segments.segmentlist(iterutils.flatten(segDict.values()))
      rings.sort()
      for k,ring in enumerate(rings):
        rings[k] = segments.segment(rings[k][0], rings[k][1] + 10**(-9))
      shift_vector = {"H1": 0, "H2": 0, "L1": 5, "V1": 5}
      if coinc_table:
        SnglInspiralUtils.slideTriggersOnRingWithVector(coinc_table, shift_vector, rings)
        full_coinc_table.extend(CoincInspiralUtils.coincInspiralTable(coinc_table,coinc_stat))
  return full_coinc_table