Skip to content

Commit

Permalink
Merge pull request #218 from BBN-Q/feature/aps3-amc599
Browse files Browse the repository at this point in the history
APS3Pattern
  • Loading branch information
Diego Ristè committed Aug 29, 2019
2 parents 0843f7c + 7a81a43 commit 2e9ff3e
Show file tree
Hide file tree
Showing 5 changed files with 1,649 additions and 4 deletions.
15 changes: 14 additions & 1 deletion QGL/ChannelLibraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ def build_connectivity_graph(self):
self.connectivityG.add_edge(chan.source, chan.target)
self.connectivityG[chan.source][chan.target]['channel'] = chan

@check_for_duplicates
def new_APS3(self, label, address, serial_port, **kwargs):
chan1 = Channels.PhysicalQuadratureChannel(label=f"{label}-1", channel=0, instrument=label, translator="APS3Pattern", sampling_rate=2.5e9, channel_db=self.channelDatabase)
chan2 = Channels.PhysicalQuadratureChannel(label=f"{label}-2", channel=1, instrument=label, translator="APS3Pattern", sampling_rate=2.5e9, channel_db=self.channelDatabase)
m1 = Channels.PhysicalMarkerChannel(label=f"{label}-m1", channel=0, instrument=label, translator="APS3Pattern", sampling_rate=2.5e9, channel_db=self.channelDatabase)

this_transmitter = Channels.Transmitter(label=label, model="APS3", address=address, serial_port=serial_port, channels=[chan1, chan2, m1], channel_db=self.channelDatabase, **kwargs)
this_transmitter.trigger_source = 'external' if 'trigger_source' not in kwargs else kwargs['trigger_source']

self.add_and_update_dict(this_transmitter)
return this_transmitter


@check_for_duplicates
def new_APS2(self, label, address, **kwargs):
chan1 = Channels.PhysicalQuadratureChannel(label=f"{label}-1", channel=0, instrument=label, translator="APS2Pattern", channel_db=self.channelDatabase)
Expand Down Expand Up @@ -623,7 +636,7 @@ def set_master(self, master_instrument, trig_channel=None, pulse_length=1e-7):
self.add_and_update_dict([st])

else:
raise ValueError(f"Could not determine which transmitter to set as master for {transmitter}:{trig_channel}")
raise ValueError(f"Could not determine which transmitter to set as master for {master_instrument}:{trig_channel}")

def QubitFactory(label):
''' Return a saved qubit channel'''
Expand Down
1 change: 1 addition & 0 deletions QGL/PatternUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def convert_lengths_to_samples(instructions, sampling_rate, quantization=1, wf_t
entry.length = int(round(entry.length * sampling_rate))
# TODO: warn when truncating?
entry.length -= entry.length % quantization

return instructions

def convert_length_to_samples(wf_length, sampling_rate, quantization=1):
Expand Down
2 changes: 1 addition & 1 deletion QGL/PulseSequencePlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def extract_waveforms(fileNames, nameDecorator='', time=False):

translator = resolve_translator(fileName, translators)
wfs = translator.read_sequence_file(fileName)
print(f"Sampling rate from extract_waveforms {translator.SAMPLING_RATE}")
sample_time = 1.0/translator.SAMPLING_RATE if time else 1

for (k, seqs) in sorted(wfs.items()):
if all_zero_seqs(seqs):
continue
Expand Down
5 changes: 3 additions & 2 deletions QGL/drivers/APS2Pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
MAX_REPEAT_COUNT = 2**16 - 1
MAX_TRIGGER_COUNT = 2**32 - 1

MODULATION_CLOCK = 300e6

# instruction encodings
WFM = 0x0
MARKER = 0x1
Expand Down Expand Up @@ -578,7 +580,6 @@ def to_instruction(self, write_flag=True, label=None):
#Modulator op codes
MODULATOR_OP_OFFSET = 44
NCO_SELECT_OP_OFFSET = 40
MODULATION_CLOCK = 300e6

op_code_map = {"MODULATE": 0x0,
"RESET_PHASE": 0x2,
Expand Down Expand Up @@ -1624,7 +1625,7 @@ def open_plotter(addr=None, I=self.waveforms[0][addr:addr+count], Q=self.wavefor
self.tableWidget.setItem(k, j, item)
self.tableWidget.move(0,0)
self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)

app = QApplication(sys.argv[:1])
ex = App(read_instructions(sys.argv[1]), read_waveforms(sys.argv[1]))
sys.exit(app.exec_())
Loading

0 comments on commit 2e9ff3e

Please sign in to comment.