Skip to content

compile_to_hardware mangles sequences #172

@matthewware

Description

@matthewware

Is there any danger in doing a deep copy of seqs before we get here:

QGL/QGL/Compiler.py

Lines 327 to 331 in 446ff4f

# all sequences should start with a WAIT for synchronization
for seq in seqs:
if not isinstance(seq[0], ControlFlow.Wait):
logger.debug("Adding a WAIT - first sequence element was %s", seq[0])
seq.insert(0, ControlFlow.Wait())

This mangles the seqs and even makes lines like

tomo_block = state_tomo([X(q1)], (q1,))
cals = create_cal_seqs((q1,), numRepeats=4)
seqs = tomo_block + cals

axis_descriptor = [{
    'name': 'segment num',
    'unit': None,
    'points': list(range(0,len(tomo_block))),
    'partition': 1
}]
axis_descriptor.append(cal_descriptor((q1,), 4))

metafile = compile_to_hardware(seqs, 'Tomo/Tomo', axis_descriptor=axis_descriptor, 
                               extra_meta = {'sequences':tomo_block})

crash hard since the metadata construction is happening after this initial loop. This seems to work for me with minor changes to QGL's Pulse object:

compiler_seqs = copy.deepcopy(seqs)
metafile = compile_to_hardware(compiler_seqs, 'Tomo/Tomo', axis_descriptor=axis_descriptor, 
                               extra_meta = {'sequences':str(tomo_block)})

Assuming we're not doing something like GST (a case we can work around) is there any reason not to do this? Seems this would be an issue anytime you needed seqs or adata about them after you'd run compile_to_hardware

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions