Skip to main contentIBM Quantum Documentation Mirror

QuantumProgramModel

pydantic model QuantumProgramModel

GitHub

Bases: BaseModel

Model to store a quantum program.

circuits

field

Type: QpyDataV13ToV17Model[QuantumCircuit] [Required]

One quantum circuit for every element of items.

These are stored outside of items to cosituate them inside of one QPY blob.

Validated by

  • check_chunk_sizes_are_consistent
  • check_circuit_count_is_consistent

items

field

Type: list[Annotated[CircuitItemModel | SamplexItemModel, Field(discriminator

Default value: 'item_type')]] [Required]

Items of the program.

Validated by

  • check_chunk_sizes_are_consistent
  • check_circuit_count_is_consistent

meas_level

field

Type: Literal['classified', 'kerneled', 'avg_kerneled', 'both']

Default value: 'classified'

The level at which to return all classical register measurement results.

This option sets the return type of all classical registers in all quantum program items and determines whether the raw complex data from low-level measurement devices is discriminated into bits or not.

  • “classified”: Classical register data is returned as boolean arrays with the intrinsic shape

    (num_shots, creg_size).

  • “kerneled”: Classical register data is returned as a complex array with the intrinsic shape

    (num_shots, creg_size), where each entry represents an IQ data point (resulting from kerneling the measurement trace) in arbitrary units.

  • “avg_kerneled”: Classical register data is returned as a complex array with the intrinsic

    shape (creg_size,), where data is equivalent to “kerneled” except additionally averaged over shots.

  • “both”: Both classified and kerneled data is returned for every classical register.

Validated by

  • check_chunk_sizes_are_consistent
  • check_circuit_count_is_consistent

passthrough_data

field

Type: DataTree

Default value: None

Arbitrary nested data passed through execution without modification.

Validated by

  • check_chunk_sizes_are_consistent
  • check_circuit_count_is_consistent

semantic_role

field

Type: str | None

Default value: None

Semantic role indicating how execution results may be post-processed by runtime clients.

Reserved system values include ‘sampler-v2’ and ‘estimator-v2’, and are subject to change without notice. Third party clients should not set or depend on this value.

Validated by

  • check_chunk_sizes_are_consistent
  • check_circuit_count_is_consistent

shots

field

Type: int [Required]

The number of shots for each individually bound circuit.

Constraints

  • ge = 1

Validated by

  • check_chunk_sizes_are_consistent
  • check_circuit_count_is_consistent

check_chunk_sizes_are_consistent

validator check_chunk_sizes_are_consistent

GitHub

Check that all program items set chunk sizes consistently.

check_circuit_count_is_consistent

validator check_circuit_count_is_consistent

GitHub

Check that there is one circuit for every item.