Sequence#

class Sequence(code: Optional[str] = None, *, constants: Optional[Dict[str, float]] = None, waveforms: Optional[Waveforms] = None, command_table: Optional[CommandTable] = None)[source]#

Bases: object

A representation of a ZI sequencer code.

This class enables a compact representation of a sequence for a Zurich Instruments device. Although a sequencer code can be represented by a simple string this class offers the following advantages:

  • Define a constants dictionary. The constants will be added automatically to the top of the resulting sequencer code and helps to prevent the use of fstrings (which require the escaping of {})

  • Link Waveforms to the sequence. This adds the waveform placeholder definitions to the top of the resulting sequencer code.

Note

This class is only for convenience. The same functionality can be achieved with a simple string.

Parameters:
  • code (str) – Sequencer code (default = None).

  • constants (Dict[str, float]) – A dictionary of constants to be added to the top of the resulting sequencer code. (default = None).

  • waveforms (Waveforms) – Waveforms that will be used in the sequence.

  • command_table (CommandTable) –

Example

>>> waveforms = Waveforms()
>>> waveforms[0] = (0.5*np.ones(1008), -0.2*np.ones(1008), np.ones(1008))
>>> sequencer = Sequence()
>>> sequencer.constants["PULSE_WIDTH"] = 10e-9 #ns
>>> sequencer.waveforms = waveforms
>>> sequencer.code = \"\"\"\
    // Hello World
    repeat(5)
    ...
    \"\"\"
>>> str(sequencer)
    // Constants
    const PULSE_WIDTH = 10e-9;
    // Waveforms declaration
    assignWaveIndex(placeholder(1008, true, false), placeholder(1008, \
        false, false), 0);
    assignWaveIndex(placeholder(1008, false, false), placeholder(1008, \
        false, false), 2);
    // Hello World
    repeat(5)
    ...

Methods

to_string(*[, waveform_snippet])

Convert the object into a string.

Attributes

code

Code of the Sequence.

command_table

Command table of the Sequence.

constants

Constants of the Sequence.

waveforms

Waveforms of the Sequence.