def print_timing_grid(self): print("Timing grid:") if len(self.timing_grid) == 0: print("Empty timing grid.") return if self.timing_grid[0].absolute_time is not None: absolute_time_generated = True else: absolute_time_generated = False if absolute_time_generated is True: print("{0: >6s} {1: <10s}" " Events".format("Idx", "absolute")) else: print("{0: >6s} {1: <10s} Events".format("Idx", "next wait")) i = 0 for tp in self.timing_grid: raw_print("{0:5d}:".format(i)) if absolute_time_generated is True: raw_print(" {0: <8d} ".format(tp.absolute_time)) else: raw_print(" {0: <8d} ".format(tp.following_waiting_time)) self._print_event_list(tp.parallel_events) raw_print('\n') i = i + 1 print("")
def print_timing_events(self): print("Timing events:") for i, timing_events in enumerate(self.timing_event_list): raw_print("{0:5d} : ".format(i)) for re in timing_events: raw_print("({}, {}, {})".format(re.event_type, re.name, re.params)) raw_print("\n") print("")
def print_hw_timing_grid(self): print("Hardware trigger timing grid:") if len(self.hw_timing_grid) == 0: print("Empty trigger timing grid.") return print("{0: >6s} {1: <10s}" " Events".format("Idx", "absolute")) i = 0 for tp in self.hw_timing_grid: raw_print("{0:5d}:".format(i)) raw_print(" {0: <8d} ".format(tp.absolute_time)) self._print_event_list(tp.parallel_events) raw_print('\n') i = i + 1 print("")
def _print_event_list(self, event_list): """ private method used for printing of the timing grid and hardware timing grid """ raw_print(" ") if event_list == []: raw_print('-') return if hasattr(event_list[0], 'event_type'): # qasm event list for e in event_list: raw_print(e.name) raw_print(" ") if len(e.params) == 2: raw_print(str(e.params[0])) raw_print(", ") raw_print(str(e.params[1])) else: raw_print(str(e.params[0])) if e.channel_latency != 0: raw_print("({})".format(e.channel_latency)) raw_print('; ') else: # qumis event list for e in event_list: raw_print(e.qumis_name) if e.codeword == -2: if e.awg_nr != -1: raw_print(" ") raw_print("awg") raw_print(str(e.awg_nr)) raw_print("(%s)" % str(e.codeword)) else: raw_print(" ") raw_print("bits:") raw_print("[{}]".format(str(e.trigger_bit))) raw_print(str(e.codeword_bit)) if e.qumis_name.lower() == "measure": pass elif e.qumis_name.lower() == "pulse": raw_print(" ") raw_print("awg") raw_print(str(e.awg_nr)) raw_print("(%s)" % str(e.codeword)) elif e.qumis_name.lower() == "trigger": raw_print(" ") raw_print("bits:") if e.set_bits != []: raw_print(str(e.set_bits)) if e.trigger_bit != -1: raw_print("[{}]".format(str(e.trigger_bit))) if e.codeword_bit != []: raw_print(str(e.codeword_bit)) if e.format != []: raw_print(" f:") raw_print(str(e.format)) else: raw_print(" d:") raw_print(str(e.duration)) if e.codeword != -1: raw_print(" cw: %s" % str(e.codeword)) raw_print('; ')
def print_op_dict(self): print("QASM operation dictionary:") for key, value in self.qasm_op_dict.items(): raw_print("{0: >10} : ".format(key)) print(value) print("\n")