Package glue :: Module VnPublish
[hide private]
[frames] | no frames]

Source Code for Module glue.VnPublish

 1  #!/usr/bin/python 
 2   
 3  from __future__ import print_function 
 4  import sys 
 5  from glue.segments import segment, segmentlist 
 6  from glue.ligolw import utils as ligolw_utils 
 7  from glue.segmentdb import segmentdb_utils 
 8   
 9   
10 -def vn_ldas_gap_check(vn_xml_file,vn_flag,ldas_gap_xml_file):
11 # read in summary intervals of vn_flag 12 vndoc = ligolw_utils.load_url(vn_xml_file, gz = (vn_xml_file or "stdin").endswith(".gz")) 13 vn_sums=segmentdb_utils.find_segments(vndoc,"%s" % vn_flag,use_segment_table=False) 14 15 # read in segment and summary intervals of LDAS allowed gaps 16 ldasdoc = ligolw_utils.load_url(ldas_gap_xml_file, gz = (ldas_gap_xml_file or "stdin").endswith(".gz")) 17 ldas_gaps=segmentdb_utils.find_segments(ldasdoc,'H1:RESULT:1') 18 ldas_sums=segmentdb_utils.find_segments(ldasdoc,'H1:DCH-MISSING_LDAS_C02_L2:1',use_segment_table=False) 19 if len(ldas_sums) == 0: 20 message = "no LDAS info was found within the specified time in the database!" 21 print(message) 22 return 23 24 # if valid Vn file and ldas files both found, do further testings: 25 if len(vn_sums) > 1 : 26 vn_sum_gaps=segmentlist([segment(vn_sums[0][0],vn_sums[-1][1])]) - vn_sums 27 if vn_sum_gaps == ldas_gaps: 28 message = "" 29 else: 30 message = "test failed. Found unexpected gaps in LDAS frames: %s \n" % vn_sum_gaps - ldas_gaps 31 print(message) 32 return 33 else: 34 if (len(vn_sums & ldas_gaps) == 0): 35 message = "" 36 else: 37 message = "test failed. Found overlap between %s summary intervals and LDAS allowed gaps: \n" % (vn_flag, vn_sums - ldas_gaps) 38 print(message) 39 return 40 print(message)
41 42 43 if __name__ == "__main__": 44 vn_ldas_gap_check() 45 sys.exit(0) 46