92 lines
4.6 KiB
Plaintext
92 lines
4.6 KiB
Plaintext
---
|
|
title: TwirlingOptions (v0.33)
|
|
description: API reference for qiskit_ibm_runtime.options.TwirlingOptions in qiskit-ibm-runtime v0.33
|
|
in_page_toc_min_heading_level: 1
|
|
python_api_type: class
|
|
python_api_name: qiskit_ibm_runtime.options.TwirlingOptions
|
|
---
|
|
|
|
# TwirlingOptions
|
|
|
|
<Class id="qiskit_ibm_runtime.options.TwirlingOptions" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.33/qiskit_ibm_runtime/options/twirling_options.py#L28-L99" signature="TwirlingOptions(enable_gates=Unset, enable_measure=Unset, num_randomizations=Unset, shots_per_randomization=Unset, strategy=Unset)" modifiers="class">
|
|
Bases: `object`
|
|
|
|
Twirling options.
|
|
|
|
## Attributes
|
|
|
|
**Parameters**
|
|
|
|
* **enable\_gates** (*UnsetType | bool*)
|
|
* **enable\_measure** (*UnsetType | bool*)
|
|
* **num\_randomizations** (*UnsetType | int | Literal\['auto']*)
|
|
* **shots\_per\_randomization** (*UnsetType | int | Literal\['auto']*)
|
|
* **strategy** (*UnsetType | Literal\['active', 'active-accum', 'active-circuit', 'all']*)
|
|
|
|
### enable\_gates
|
|
|
|
<Attribute id="qiskit_ibm_runtime.options.TwirlingOptions.enable_gates" attributeTypeHint="UnsetType | bool" attributeValue="Unset">
|
|
Whether to apply 2-qubit Clifford gate twirling. Default: False.
|
|
</Attribute>
|
|
|
|
### enable\_measure
|
|
|
|
<Attribute id="qiskit_ibm_runtime.options.TwirlingOptions.enable_measure" attributeTypeHint="UnsetType | bool" attributeValue="Unset">
|
|
Whether to enable twirling of measurements.
|
|
|
|
Twirling will only be applied to those measurement registers not involved within a conditional logic. Default: True for Estimator, false for Sampler.
|
|
</Attribute>
|
|
|
|
### num\_randomizations
|
|
|
|
<Attribute id="qiskit_ibm_runtime.options.TwirlingOptions.num_randomizations" attributeTypeHint="UnsetType | int | Literal['auto']" attributeValue="Unset">
|
|
The number of random samples to use when twirling or peforming sampled mitigation.
|
|
|
|
If `num_randomizations` is “auto”, for every pub executed `shots` times:
|
|
|
|
> * If `shots_per_randomization` is also “auto”, `shots_per_randomization` is set first as described below, then `num_randomizations` is set as `ceil(shots/shots_per_randomization)`, where `ceil` is the ceiling function.
|
|
> * Otherwise, the value is set to `ceil(shots/shots_per_randomization)`.
|
|
>
|
|
> Default: “auto”.
|
|
|
|
<Admonition title="Note" type="note">
|
|
The `shots` value specified in a PUB or in the `run()` method is considered part of the primitive execution interface and therefore is always obeyed. `default_shots`, on the other hand, is considered a Qiskit Runtime specific option. Therefore, the product of `num_randomizations` and `shots_per_randomization` takes precedence over `default_shots`.
|
|
</Admonition>
|
|
</Attribute>
|
|
|
|
### shots\_per\_randomization
|
|
|
|
<Attribute id="qiskit_ibm_runtime.options.TwirlingOptions.shots_per_randomization" attributeTypeHint="UnsetType | int | Literal['auto']" attributeValue="Unset">
|
|
The number of shots to run for each random sample.
|
|
|
|
If “auto”, for every pub executed `shots` times:
|
|
|
|
> * If `num_randomizations` is also “auto”, the value is set to `64` for PEC mitigation or to `max(64, ceil(shots / 32))` in all other cases, where `ceil` is the ceiling function.
|
|
> * Otherwise, the value is set to `ceil(shots/num_randomizations)`.
|
|
>
|
|
> Default: “auto”.
|
|
|
|
<Admonition title="Note" type="note">
|
|
The `shots` value specified in a PUB or in the `run()` method is considered part of the primitive execution interface and therefore is always obeyed. `default_shots`, on the other hand, is considered a Qiskit Runtime specific option. Therefore, the product of `num_randomizations` and `shots_per_randomization` takes precedence over `default_shots`.
|
|
</Admonition>
|
|
</Attribute>
|
|
|
|
### strategy
|
|
|
|
<Attribute id="qiskit_ibm_runtime.options.TwirlingOptions.strategy" attributeTypeHint="UnsetType | Literal['active', 'active-accum', 'active-circuit', 'all']" attributeValue="Unset">
|
|
Specify the strategy of twirling qubits in identified layers of 2-qubit twirled gates.
|
|
|
|
Allowed values are:
|
|
|
|
> * If `"active"` only the instruction qubits in each individual twirled layer will be twirled.
|
|
> * If `"active-circuit"` the union of all instruction qubits in the circuit will be twirled in each twirled layer.
|
|
> * If `"active-accum"` the union of instructions qubits in the circuit up to the current twirled layer will be twirled in each individual twirled layer.
|
|
> * If `"all"` all qubits in the input circuit will be twirled in each twirled layer.
|
|
>
|
|
> Default: “active-accum”.
|
|
</Attribute>
|
|
|
|
## Methods
|
|
</Class>
|
|
|