11 frag_magic_word = bytes.fromhex(
"22221111")
12 trh_magic_word = bytes.fromhex(
"44443333")
15 with open(fname,
"rb")
as f:
18 while (byte := f.read(4)):
19 if byte == trh_magic_word:
23 if byte == frag_magic_word:
24 frag_loc[nrec-1].append(iloc)
27 print(19*
'=',
" Location of records in the binary file ", 19*
'=')
29 for i
in range(len(trh_loc)):
32 print(
"trigger {:<8} header - {:<16}".format(i+1, trh_loc[i]),
33 "fragments: ", frag_loc[i])
34 return (trh_loc, frag_loc)
39 frag_magic_word = bytes.fromhex(
"22221111")
40 trh_magic_word = bytes.fromhex(
"44443333")
41 tsl_magic_word = bytes.fromhex(
"66665555")
42 with open(fname,
"rb")
as f:
43 bytesbuffer = bytearray()
47 while (byte := f.read(4)):
49 if byte == trh_magic_word:
50 record_type =
"TriggerRecord"
51 if byte == tsl_magic_word:
52 record_type =
"TimeSlice"
53 if byte == trh_magic_word
or byte == tsl_magic_word:
55 if ntrh !=0
and k_print_out
in [
'both',
'fragment']:
56 print(31*
"-",
"Fragment Header ", 31*
"-")
57 print_fragment_header(bytesbuffer, clock_speed_hz)
58 bytesbuffer = bytearray()
60 if ntrh > k_n_request
and k_n_request != 0:
break
61 if byte == frag_magic_word:
62 if nfrag == 0
and ntrh != 0
and k_print_out
in [
'both',
64 print(24*
"=",
"TriggerRecord/TimeSlice Header", 24*
"=")
65 print_header(bytesbuffer, record_type, clock_speed_hz,
67 if nfrag != 0
and k_print_out
in [
'both',
'fragment']:
68 print(31*
"-",
"Fragment Header ", 31*
"-")
69 print_fragment_header(bytesbuffer, clock_speed_hz)
70 bytesbuffer = bytearray()
72 bytesbuffer.extend(byte)