Skip to content

Commit

Permalink
Add marker factory for unattached markers.
Browse files Browse the repository at this point in the history
  • Loading branch information
gribeill committed Aug 14, 2017
1 parent d44f15b commit 3bb4b12
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
21 changes: 21 additions & 0 deletions QGL/ChannelLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ def load_from_library(self):
channel_dict[params["label"]] = params
channel_dict[name]["gate_chan"] = params["label"]

if "triggers" in qubit.keys():
for trig_name, trigger in qubit["triggers"].items():
phys_instr, phys_marker = trigger.split()
params = {}
params["label"] = trig_name
params["phys_chan"] = phys_instr + "-" + phys_marker
if params["phys_chan"] in marker_lens.keys():
length = marker_lens[params["phys_chan"]]
else:
length = 1e-7
params["__module__"] = "QGL.Channels"
params["__class__"] = "LogicalMarkerChannel"
channel_dict[params["label"]] = params

# for k, c in channel_dict.items():
# print("Channel {: <30} phys_chan {: <30} class {: <30} instr {: <30}".format(k, c["phys_chan"] if "phys_chan" in c else "None", c["__class__"] if "__class__" in c else "None", c["instrument"] if "instrument" in c else "None"))

Expand Down Expand Up @@ -439,6 +453,13 @@ def on_awg_change(self, oldName, newName):
print("Changing {0} to {1}".format(chName, newLabel))
self.physicalChannelManager.name_changed(chName, newLabel)

def MarkerFactory(label, **kwargs):
if channelLib and label in channelLib and isinstance(channelLib[label],
Channels.LogicalMarkerChannel):
return channelLib[label]
else:
raise ValueError("Marker channel {} not found in channel library.".format(label))

def QubitFactory(label, **kwargs):
''' Return a saved qubit channel or create a new one. '''
if channelLib and label in channelLib and isinstance(channelLib[label],
Expand Down
4 changes: 3 additions & 1 deletion QGL/PulsePrimitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ def MeasEcho(qM, qD, delay, piShift=None, phase=0):
measEcho.label = 'MEAS' #to generate the digitizer trigger
return measEcho


# Gating/blanking pulse primitives
def BLANK(chan, length):
return TAPulse("BLANK", chan.gate_chan, length, 1, 0, 0)

def TRIG(marker_chan, length):
return TAPulse("TRIG", marker_chan, length, 1.0, 0., 0.)
2 changes: 1 addition & 1 deletion QGL/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .Channels import Qubit, Measurement, Edge
from .ChannelLibrary import QubitFactory, MeasFactory, EdgeFactory
from .ChannelLibrary import QubitFactory, MeasFactory, EdgeFactory, MarkerFactory
from .PulsePrimitives import *
from .Compiler import compile_to_hardware, set_log_level
from .PulseSequencer import align
Expand Down

0 comments on commit 3bb4b12

Please sign in to comment.