Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TDM to metafile info #152

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions QGL/Compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def compile_to_hardware(seqs,
num_measurements = count_measurements(wireSeqs)
wire_measurements = count_measurements_per_wire(wireSeqs)

# map logical to physical channels, physWires is a list of
# map logical to physical channels, physWires is a list of
# PhysicalQuadratureChannels and PhysicalMarkerChannels
# for the APS, the naming convention is:
# ASPName-12, or APSName-12m1
Expand All @@ -391,7 +391,7 @@ def compile_to_hardware(seqs,
old_wire_names[wire] = wire.label
old_wire_instrs[wire] = wire.instrument
wire.instrument = wire.label
wire.label = chan_name
wire.label = chan_name
files[inst_name] = {}

# construct channel delay map
Expand Down Expand Up @@ -431,7 +431,10 @@ def compile_to_hardware(seqs,
files[label_to_inst[awgName]][label_to_chan[awgName]] = fullFileName
else:
files[awgName] = fullFileName

# add TDM sequence, if any
for tdm in config.tdm_list:
files[tdm] = os.path.normpath(os.path.join(
config.AWGDir, str.replace(fileName, 'aps', 'tdm') + '-' + next(iter(awgData)) + suffix + '.h5'))
# create meta output
if not axis_descriptor:
axis_descriptor = [{
Expand Down
10 changes: 8 additions & 2 deletions QGL/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# CNOT in your gate set, e.g. CNOT_simple or CNOT_CR)
cnot_implementation = "CNOT_simple"

# used to add the tdm sequence in the metafile
tdm_list = []

class LoaderMeta(type):
def __new__(metacls, __name__, __bases__, __dict__):
"""Add include constructer to class."""
Expand Down Expand Up @@ -67,7 +70,7 @@ def find_meas_file():
raise Exception("Could not find the measurement file in the environment variables or the auspex globals.")

def load_config(filename=None):
global meas_file, AWGDir, plotBackground, gridColor, pulse_primitives_lib, cnot_implementation
global meas_file, AWGDir, plotBackground, gridColor, pulse_primitives_lib, cnot_implementation, tdm_list

if filename:
meas_file = filename
Expand All @@ -94,4 +97,7 @@ def load_config(filename=None):
pulse_primitives_lib = cfg['config'].get('PulsePrimitivesLibrary', 'standard')
cnot_implementation = cfg['config'].get('cnot_implementation', 'CNOT_simple')

return meas_file
if 'instruments' in cfg:
tdm_list = [k for (k, v) in cfg['instruments'].items() if (v['type'] == 'TDM' and v['enabled'] == True)]

return meas_file
4 changes: 2 additions & 2 deletions QGL/n.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def setUp():
# same sequence twice can FAIL (or give weird results).
# So copy the input sequence each time we use it...

aps_metafile = compile_to_hardware([copy.copy(seq)], '/tmp/aps')
aps_metafile = compile_to_hardware([copy.copy(seq)], 'tmp/aps')
aps_metadata = json.loads(open(aps_metafile).read())

tdm_metafile = compile_to_hardware([copy.copy(seq)], '/tmp/tdm')
tdm_metafile = compile_to_hardware([copy.copy(seq)], 'tmp/tdm')
tdm_metadata = json.loads(open(tdm_metafile).read())

tdm_instr = QGL.drivers.APS2TDMPattern.tdm_instructions(seq)
Expand Down