qat.ir.instructions module
- class Assign(**data)
Bases:
Instruction
Assigns a value to a variable.
This is used to assign some value (e.g. the results from an acquisition) to a variable. In the legacy instructions, Assign could be given a Variable that declares the value as another variable. It could also be given more complex structures, should as a list of Variables, or an IndexAccessor. For example, this could be used to assign each of the qubit acquisitions to a single register,
In general, declarations and allocations could be improved in future iterations, and functionality may change with improvements to the front end. For now, Assign has been adapted to support the required front end behaviour. The value is allowed to be a list (with recurssions supported) of strings that declare what Variable to point to, or a tuple for IndexAccessor.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['Assign']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- value: Any
- class Delay(**data)
Bases:
QuantumInstruction
Instructs a quantum target to do nothing for a fixed time.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['Delay']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class FrequencyShift(**data)
Bases:
QuantumInstruction
Change the frequency of a pulse channel.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- frequency: float
- inst: Literal['FrequencyShift']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property target
- targets: ValidatedSet[str]
- class Instruction(**data)
Bases:
NoExtraFieldsModel
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- property head
- inst: Literal['Instruction']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property number_of_instructions
- property tail
- class InstructionBlock(**data)
Bases:
Instruction
,Iterable
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- add(*instructions, flatten=False)
- property head
- inst: Literal['InstructionBlock']
- instructions: ValidatedList[Instruction]
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property number_of_instructions
- property tail
- class PhaseReset(**data)
Bases:
QuantumInstruction
Reset the phase shift of given pulse channels, or the pulse channels of given qubits.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['PhaseReset']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class PhaseShift(**data)
Bases:
QuantumInstruction
A PhaseShift instruction is used to change the phase of waveforms sent down the pulse channel.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['PhaseShift']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- phase: float
- property target
- targets: ValidatedSet[str]
- class QuantumInstruction(**data)
Bases:
Instruction
Any node that deals particularly with quantum operations. All quantum operations must have some sort of target on the quantum computer, such as a qubit, channel, or another form of component.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- duration: float
- inst: Literal['QuantumInstruction']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- targets: ValidatedSet[str]
- classmethod validate_targets(data, field_name='targets')
- class QuantumInstructionBlock(**data)
Bases:
QuantumInstruction
,InstructionBlock
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- add(*instructions)
- inst: Literal['QuantumInstructionBlock']
- instructions: ValidatedList[QuantumInstruction]
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Return type:
None
- Args:
self: The BaseModel instance. context: The context.
- targets: ValidatedSet[str]
- class Repeat(**data)
Bases:
Instruction
Global meta-instruction that applies to the entire list of instructions. Repeat value of the current operations, also known as shots.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['Repeat']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- repeat_count: Optional[int]
- repetition_period: Optional[float]
- class Reset(**data)
Bases:
QuantumInstruction
Resets this qubit to its starting state.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['Reset']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- qubit_targets: Union[QubitId, set[QubitId]]
- targets: ValidatedSet[str]
- validate_targets()
- class ResultsProcessing(**data)
Bases:
Instruction
A meta-instruction that stores how the results are processed.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['ResultsProcessing']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- results_processing: InlineResultsProcessing
- variable: str
- class Return(**data)
Bases:
Instruction
A statement defining what to return from a quantum execution.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['Return']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- variables: List[str]
- class Synchronize(**data)
Bases:
QuantumInstruction
Tells the QPU to wait for all the target channels to be free before continuing execution on any of them.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- inst: Literal['Synchronize']
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Variable(**data)
Bases:
NoExtraFieldsModel
States that this value is actually a variable that should be fetched instead.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- value: Any
- var_type: Optional[type]
- static with_random_name()