qiskit_qm_provider.backend.backend_utils.assign_struct_with_table

assign_struct_with_table(struct: Any, table: ParameterTable) None[source][source]

QUA macro: copy declared parameter values into a matching OPNIC struct.

Call inside the same with program(): block after both sides are ready: the ParameterTable parameters must already be declared (via declare() or OPNIC initialize_in_qua()), and struct must be a Quarc QuaStructHandle returned by module.add_struct(...) with QuaStructHandle.initialize_in_qua() already invoked.

For each field, this macro assigns the table parameter’s QUA variable onto the corresponding struct field using qm.qua.assign. Field names and shapes (scalar vs. array length) must match exactly between the struct spec and the table.

Parameters:
  • struct – A Quarc QuaStructHandle bound to the destination OPNIC struct. The type is validated at runtime via a lazy quarc import; it is not imported for static type checking in this module.

  • table – Source ParameterTable whose declared QUA variables are copied field-by-field into struct.

Raises:
  • ImportError – If quarc is not installed.

  • TypeError – If struct is not a Quarc QuaStructHandle.

  • ValueError – If field names or sizes differ, parameters are undeclared, or struct was not initialized in QUA.