Skip to content

Commit

Permalink
some convenience tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
meeg committed Sep 18, 2024
1 parent 53f76bc commit 63d06a4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions qick_lib/qick/asm_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,8 @@ def preprocess(self, prog):

for ro in self.ros:
rocfg = prog.soccfg['readouts'][ro]
if ro not in prog.ro_chs:
raise RuntimeError("RO channel %d is triggered but never declared"%(ro))
if rocfg['trigger_type'] == 'dport':
self.outdict[rocfg['trigger_port']] |= (1 << rocfg['trigger_bit'])
else:
Expand Down
27 changes: 23 additions & 4 deletions qick_lib/qick/qick_asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,25 @@ def check_pfb_collisions(self, rocfg, cfg1, cfgs):
if np.abs(cfg1['f_folded'] - cfg2['pfb_center']) < rocfg['f_dds']/2:
logger.warning("The readout at %.3f MHz may see some crosstalk from the tone at %.3f MHz." % (cfg2['f_rounded'], cfg1['f_rounded']))

def get_maxv(self, gen_ch):
"""Convenience method for looking up a generator's maximum allowed envelope value.
The absolute value of the idata/qdata should not exceed this.
Typically you will want to normalize your envelope's maximum range to this value.
Parameters
----------
gen_ch : int
generator channel (index in 'gens' list)
Returns
-------
int
max allowed value
"""
gencfg = self['gens'][gen_ch]
return int(np.floor(gencfg['maxv']*gencfg['maxv_scale']))


class DummyIp:
"""Stores the configuration constants for a firmware IP block.
"""
Expand Down Expand Up @@ -1306,7 +1325,7 @@ def add_cosine(self, ch, name, length, maxv=None, even_length=False):
This is useful for flat_top pulses, where the envelope gets split into two halves.
"""
gencfg = self.soccfg['gens'][ch]
if maxv is None: maxv = gencfg['maxv']*gencfg['maxv_scale']
if maxv is None: maxv = self.soccfg.get_maxv(ch)
samps_per_clk = gencfg['samps_per_clk']

# convert to integer number of fabric clocks
Expand Down Expand Up @@ -1344,7 +1363,7 @@ def add_gauss(self, ch, name, sigma, length, maxv=None, even_length=False):
This is useful for flat_top pulses, where the envelope gets split into two halves.
"""
gencfg = self.soccfg['gens'][ch]
if maxv is None: maxv = gencfg['maxv']*gencfg['maxv_scale']
if maxv is None: maxv = self.soccfg.get_maxv(ch)
samps_per_clk = gencfg['samps_per_clk']

if self.GAUSS_BUG:
Expand Down Expand Up @@ -1392,7 +1411,7 @@ def add_DRAG(self, ch, name, sigma, length, delta, alpha=0.5, maxv=None, even_le
This is useful for flat_top pulses, where the envelope gets split into two halves.
"""
gencfg = self.soccfg['gens'][ch]
if maxv is None: maxv = gencfg['maxv']*gencfg['maxv_scale']
if maxv is None: maxv = self.soccfg.get_maxv(ch)
samps_per_clk = gencfg['samps_per_clk']
f_fabric = gencfg['f_fabric']

Expand Down Expand Up @@ -1440,7 +1459,7 @@ def add_triangle(self, ch, name, length, maxv=None, even_length=False):
This is useful for flat_top pulses, where the envelope gets split into two halves.
"""
gencfg = self.soccfg['gens'][ch]
if maxv is None: maxv = gencfg['maxv']*gencfg['maxv_scale']
if maxv is None: maxv = self.soccfg.get_maxv(ch)
samps_per_clk = gencfg['samps_per_clk']

# convert to integer number of fabric clocks
Expand Down

0 comments on commit 63d06a4

Please sign in to comment.