3.1.2. qupulse._program.seqc

This module contains the ZI HDAWG compatible description of programs. There is no code in here that interacts with hardware directly.

The public interface to all functionality is given by HDAWGProgramManager. This class can create seqc source code which contains multiple programs and allows switching between these with the user registers of a device,

Furthermore: - SEQCNode: AST of a subset of sequencing C - loop_to_seqc: conversion of Loop objects to this subset in a clever way - BinaryWaveform: Bundles functionality of handling segments in a native way. - WaveformMemory: Functionality to sync waveforms to the device (via the LabOne user folder) - ProgramWaveformManager and HDAWGProgramEntry: Program wise handling of waveforms and seqc-code classes that convert Loop objects

class qupulse._program.seqc.HDAWGProgramManager[source]

Bases: object

This class contains everything that is needed to create the final seqc program and provides an interface to write the required waveforms to the file system. It does not talk to the device.

class Constants[source]

Bases: object

IDLE_WAIT_CYCLES = 300
INVERTED_PROG_SEL_MASK = '0b11000000000000000000000000000000'
NO_RESET_MASK = '0b10000000000000000000000000000000'
PLAYBACK_FINISHED_MASK = '0b1000000000000000000000000000000'
PROG_SEL_MASK = '0b111111111111111111111111111111'
PROG_SEL_NONE = 0
PROG_SEL_REGISTER = UserRegister(zero_based_value=0)
TRIGGER_REGISTER = UserRegister(zero_based_value=1)
TRIGGER_RESET_MASK = '0b10000000000000000000000000000000'
classmethod as_dict()[source]
Return type

Dict[str, Any]

DEFAULT_COMPILER_SETTINGS = {'indentation': '  ', 'min_repetitions_for_for_loop': 20, 'min_repetitions_for_shared_wf': 1000, 'trigger_wait_code': 'waitForSoftwareTrigger();'}
class GlobalVariables[source]

Bases: object

Global variables of the program together with their (multiline) doc string. The python names are uppercase.

NEW_PROG_SEL = (('Value that gets written back to program selection register.', 'Used to signal that at least one program was played completely.'), 0)
PLAYBACK_FINISHED = (("Is OR'ed to new_prog_sel.", 'Set to PLAYBACK_FINISHED_MASK if a program was played completely.'), 0)
PROG_SEL = (['Selected program index (0 -> None)'], 0)
classmethod as_dict()[source]
Return type

Dict[str, Tuple[Sequence[str], int]]

classmethod get_init_block()[source]
Return type

str

SOFTWARE_WAIT_FOR_TRIGGER_FUNCTION_DEFINITION = 'void waitForSoftwareTrigger() {\n  while (true) {\n    var trigger_register = getUserReg(TRIGGER_REGISTER);\n    if (trigger_register & TRIGGER_RESET_MASK) setUserReg(TRIGGER_REGISTER, 0);\n    if (trigger_register) return;\n  }\n}\n'
WAIT_FOR_SOFTWARE_TRIGGER = 'waitForSoftwareTrigger();'
add_program(name, loop, channels, markers, amplitudes, offsets, voltage_transformations, sample_rate)[source]

Register the given program and translate it to seqc.

TODO: Add an interface to change the trigger mode

Parameters
  • name (str) – Human readable name of the program (used f.i. for the function name)

  • loop (Loop) – The program to upload

  • channels (Tuple[Union[str, int, None], …]) – see AWG.upload

  • markers (Tuple[Union[str, int, None], …]) – see AWG.upload

  • amplitudes (Tuple[float, …]) – Used to sample the waveforms

  • offsets (Tuple[float, …]) – Used to sample the waveforms

  • voltage_transformations (Tuple[Optional[Callable], …]) – see AWG.upload

  • sample_rate (TimeType) – Used to sample the waveforms

clear()[source]
Return type

None

classmethod get_program_function_name(program_name)[source]
get_register_values(name)[source]
Return type

Mapping[UserRegister, int]

get_register_values_to_update_volatile_parameters(name, parameters)[source]
Parameters
  • name (str) – Program name

  • parameters (Mapping[str, Number]) – new values for volatile parameters

Return type

Mapping[UserRegister, int]

Returns

A dict user_register->value that reflects the new parameter values

name_to_index(name)[source]
Return type

int

property programs: Mapping[str, qupulse._program.seqc.HDAWGProgramEntry]
Return type

Mapping[str, HDAWGProgramEntry]

remove(name)[source]
Return type

None

to_seqc_program()[source]
Return type

str

property waveform_memory