lowering
Lowering
dataclass
Lowering()
lower
lower(
sym_name: str,
noise_model: NoiseModel,
return_qreg: bool = False,
) -> ir.Method
Lower the noise model to a method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the method to generate. |
required |
return_qreg
|
bool
|
Use the quantum register as the return value. |
False
|
Returns:
Name | Type | Description |
---|---|---|
Method |
Method
|
The generated kirin method. |
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/lowering.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
schema
CZ
Bases: Operation
A CZ gate operation.
Fields
op_type (str): The type of operation (Literal["CZ"]). participants (Tuple[Union[Tuple[int], Tuple[int, int]], ...]): The qubit indices that are participating in the CZ gate.
CZError
Bases: ErrorOperation[ErrorModelType]
CZError operation.
Fields
survival_prob (Tuple[float, ...]): The survival probabilities for each qubit. error_type (str): The type of error (Literal["CZError"]). storage_error (ErrorModelType): The error model for storage. entangled_error (ErrorModelType): The error model for entangled qubits. single_error (ErrorModelType): The error model for single qubits.
ErrorModel
Bases: BaseModel
Base class for error models.
ErrorOperation
Bases: BaseModel
, Generic[ErrorModelType]
Base class for error operations.
GateEvent
Bases: BaseModel
, Generic[ErrorModelType]
A gate event.
Fields
error (Union[SingleQubitError[ErrorModelType], CZError[ErrorModelType]]): The error model for the gate event. operation (OperationType): The operation for the gate event.
GlobalRz
Bases: Operation
GlobalRz operation.
Fields
op_type (str): The type of operation (Literal["GlobalRz"]). phi (float): The angle of rotation.
GlobalW
Bases: Operation
GlobalW operation.
Fields
op_type (str): The type of operation (Literal["GlobalW"]). theta (float): The angle of rotation. phi (float): The angle of rotation.
LocalRz
Bases: Operation
LocalRz operation.
Fields
op_type (str): The type of operation (Literal["LocalRz"]). participants (Tuple[int, ...]): The qubit indices that are participating in the local Rz gate. phi (float): The angle of rotation.
LocalW
Bases: Operation
LocalW operation.
Fields
op_type (str): The type of operation (Literal["LocalW"]). participants (Tuple[int, ...]): The qubit indices that are participating in the local W gate. theta (float): The angle of rotation. phi (float): The angle of rotation.
Measurement
Bases: Operation
Measurement operation.
Fields
op_type (str): The type of operation (Literal["Measurement"]). measure_tag (str): The tag to use for the measurement. participants (Tuple[int, ...]): The qubit indices that are participating in the measurement.
NoiseModel
Bases: BaseModel
, Generic[ErrorModelType]
Noise model for a circuit.
Fields
all_qubits (Tuple[int, ...]): The qubit indices for the noise model. gate_events (List[GateEvent[ErrorModelType]]): The gate events for the noise model.
num_qubits
property
num_qubits: int
Return the number of qubits in the noise model.
decompiled_circuit
decompiled_circuit() -> str
Clean the circuit of noise.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The decompiled circuit from hardware execution. |
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/schema.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|
lower_noise_model
lower_noise_model(sym_name: str, return_qreg: bool = False)
Lower the noise model to a method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sym_name
|
str
|
The name of the method to generate. |
required |
return_qreg
|
bool
|
Whether to return the quantum register after the method has completed execution. Useful for obtaining the full state vector. |
False
|
Returns:
Name | Type | Description |
---|---|---|
Method |
The generated kirin method. |
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/schema.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
Operation
Bases: BaseModel
Base class for operations.
PauliErrorModel
Bases: ErrorModel
Pauli error model.
Fields
error_model_type (str): The type of error model (Literal["PauliNoise"]). errors (Tuple[Tuple[int, Tuple[float, float, float]], ...]): The qubit indices and the error rates for each qubit.
SingleQubitError
Bases: ErrorOperation[ErrorModelType]
SingleQubitError operation.
Fields
survival_prob (Tuple[float, ...]): The survival probabilities for each qubit. error_type (str): The type of error (Literal["SingleQubitError"]). operator_error (ErrorModelType): The error model for the single qubit.
simulation_result
QuEraSimulationResult
dataclass
QuEraSimulationResult(
flair_visual_version: str,
counts: dict[str, int],
logs: DataFrame,
atom_animation_state: AnimateQPUState,
noise_model: NoiseModel,
)
Results of the QuEra hardware model simulation.
Fields
flair_visual_version (str): The version of the Flair Visual package used to generate the simulation result. counts (dict[str, int]): The measurement bitstrings of the simulation. logs (DataFrame): Grainular logs events of what happened to each atom during the simulation. atom_animation_state (vis_qpustate.AnimateQPUState): Object used to play back atom trajectories and events during the simulation. noise_model (NoiseModel): The noise model used in the simulation.
animate
animate(
dilation_rate: float = 0.05,
fps: int = 30,
gate_display_dilation: float = 1.0,
save_mpeg: bool = False,
filename: str = "vqpu_animation",
start_block: int = 0,
n_blocks: Optional[int] = None,
)
animate the qpu state
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dilation_rate
|
float
|
Conversion factor from the qpu time to animation time units. when dilation_rate=1.0, 1 (us) of qpu exec time corresponds to 1 second of animation time. |
0.05
|
fps
|
int
|
frame per second. Defaults to 30. |
30
|
gate_display_dilation
|
float
|
relative dilation rate of a gate event. Defaults to 1. When setting higher value, the gate event will be displayed longer. |
1.0
|
save_mpeg
|
bool
|
Save as mpeg. Defaults to False. |
False
|
filename
|
str
|
The file name of saved mpeg file. Defaults to "vqpu_animation". When |
'vqpu_animation'
|
start_block
|
int
|
The start block to animate. Defaults to 0. |
0
|
n_blocks
|
int
|
number of blocks to animate. Defaults to None. When None, animate all blocks after |
None
|
Returns: ani: matplotlib animation object
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/simulation_result.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
from_json
classmethod
from_json(json: dict) -> QuEraSimulationResult
deserialize the object from a JSON serializable dictionary.
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/simulation_result.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
to_json
to_json() -> Dict[str, Any]
Turn the object into a JSON serializable dictionary.
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/simulation_result.py
54 55 56 57 58 59 60 61 62 |
|
target
qBraid
qBraid(
*,
allow_parallel: bool = False,
allow_global: bool = False,
provider: QbraidProvider,
qelib1: bool = True
)
qBraid target for Bloqade kernels.
qBraid target that accepts a Bloqade kernel and submits the kernel to the QuEra simulator hosted on qBraid. A QbraidJob
is obtainable
that then lets you query the status of the submitted program on the simulator as well
as obtain results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_parallel
|
bool
|
Allow parallel gate in the resulting QASM2 AST. Defaults to |
False
|
allow_global
|
bool
|
Allow global gate in the resulting QASM2 AST. Defaults to |
False
|
provider
|
QbraidProvider
|
Qbraid-provided object to allow submission of the kernel to the QuEra simulator. |
required |
qelib1
|
bool
|
Include the |
True
|
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/target.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
emit
emit(
method: Method,
shots: Optional[int] = None,
tags: Optional[dict[str, str]] = None,
) -> Union[QbraidJob, list[QbraidJob]]
Submit the Bloqade kernel to the QuEra simulator on qBraid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method
|
Method
|
The kernel to submit to qBraid. |
required |
shots
|
Optional[int]
|
(Optional[int]): Number of times to run the kernel. Defaults to None. |
None
|
tags
|
Optional[dict[str, str]]
|
(Optional[dict[str,str]]): A dictionary of tags to associate with the Job. |
None
|
Returns:
Type | Description |
---|---|
Union[QbraidJob, list[QbraidJob]]
|
Union[QbraidJob, list[QbraidJob]]: An object you can query for the status of your submission as well as obtain simulator results from. |
Source code in .venv/lib/python3.12/site-packages/bloqade/qbraid/target.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|