Skip to content

Commit

Permalink
fix: update paradigm_properties to reflect new schema (#228)
Browse files Browse the repository at this point in the history
* fix: update paradigm_properties to reflect new schema

* ran linter to fix formatting issue

---------

Co-authored-by: Angela Guo <gmanminu@amazon.com>
  • Loading branch information
guomanmin and Angela Guo committed Jan 26, 2024
1 parent 63d0a29 commit a99d7da
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 9 deletions.
19 changes: 13 additions & 6 deletions src/braket/pennylane_plugin/braket_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class BraketQubitDevice(QubitDevice):
Default: True.
`**run_kwargs`: Variable length keyword arguments for ``braket.devices.Device.run()``.
"""

name = "Braket PennyLane plugin"
pennylane_requires = ">=0.30.0"
version = __version__
Expand Down Expand Up @@ -287,9 +288,11 @@ def _braket_to_pl_result(self, braket_result, circuit):
# to submit another result type alongside adjoint gradient, this logic will need to
# change.
results_list = [
np.asarray(result, dtype="object")
if isinstance(result, collections.abc.Sequence)
else result
(
np.asarray(result, dtype="object")
if isinstance(result, collections.abc.Sequence)
else result
)
for result in results
]
return results_list[0]
Expand Down Expand Up @@ -538,6 +541,7 @@ class BraketAwsQubitDevice(BraketQubitDevice):
supports the native gate set of the device. Default False.
`**run_kwargs`: Variable length keyword arguments for ``braket.devices.Device.run()``.
"""

name = "Braket AwsDevice for PennyLane"
short_name = "braket.aws.qubit"

Expand Down Expand Up @@ -629,9 +633,11 @@ def batch_execute(self, circuits, **run_kwargs):
max_connections=self._max_connections,
poll_timeout_seconds=self._poll_timeout_seconds,
poll_interval_seconds=self._poll_interval_seconds,
inputs=[{f"p_{k}": v for k, v in trainable.items()} for trainable in all_trainable]
if self._parametrize_differentiable
else [],
inputs=(
[{f"p_{k}": v for k, v in trainable.items()} for trainable in all_trainable]
if self._parametrize_differentiable
else []
),
**self._run_kwargs,
)
# Call results() to retrieve the Braket results in parallel.
Expand Down Expand Up @@ -993,6 +999,7 @@ class BraketLocalQubitDevice(BraketQubitDevice):
Default: None
`**run_kwargs`: Variable length keyword arguments for ``braket.devices.Device.run()``.
"""

name = "Braket LocalSimulator for PennyLane"
short_name = "braket.local.qubit"

Expand Down
8 changes: 8 additions & 0 deletions src/braket/pennylane_plugin/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class CPhaseShift00(Operation):
id (str, optional): String representing the operation. Default: None
"""

num_params = 1
num_wires = 2
grad_method = "A"
Expand Down Expand Up @@ -148,6 +149,7 @@ class CPhaseShift01(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 1
num_wires = 2
grad_method = "A"
Expand Down Expand Up @@ -209,6 +211,7 @@ class CPhaseShift10(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 1
num_wires = 2
grad_method = "A"
Expand Down Expand Up @@ -269,6 +272,7 @@ class PSWAP(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 1
num_wires = 2
grad_method = "A"
Expand Down Expand Up @@ -316,6 +320,7 @@ class GPi(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 1
num_wires = 1
grad_method = "F"
Expand Down Expand Up @@ -358,6 +363,7 @@ class GPi2(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 1
num_wires = 1
grad_method = "F"
Expand Down Expand Up @@ -404,6 +410,7 @@ class MS(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 2
num_wires = 2
grad_method = "F"
Expand Down Expand Up @@ -455,6 +462,7 @@ class AAMS(Operation):
wires (int): the subsystem the gate acts on
id (str or None): String representing the operation (optional)
"""

num_params = 3
num_wires = 2
grad_method = "F"
Expand Down
50 changes: 47 additions & 3 deletions test/unit_tests/test_ahs_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,54 @@ def dummy_cfunc(t):
},
},
"performance": {
"lattice": {"positionErrorAbs": 1.47e-7},
"rydberg": {"rydbergGlobal": {"rabiFrequencyErrorRel": 0.02}},
"lattice": {
"positionErrorAbs": 1.47e-7,
"sitePositionError": 0.025e-6,
"atomPositionError": 0.025e-6,
"fillingErrorTypical": 0.005,
"fillingErrorWorst": 0.01,
"vacancyErrorTypical": 0.005,
"vacancyErrorWorst": 0.005,
"atomLossProbabilityTypical": 0.01,
"atomLossProbabilityWorst": 0.01,
"atomCaptureProbabilityTypical": 0.01,
"atomCaptureProbabilityWorst": 0.01,
"atomDetectionErrorFalsePositiveTypical": 0.01,
"atomDetectionErrorFalsePositiveWorst": 0.01,
"atomDetectionErrorFalseNegativeTypical": 0.01,
"atomDetectionErrorFalseNegativeWorst": 0.01,
},
"rydberg": {
"rydbergGlobal": {
"rabiFrequencyErrorRel": 0.02,
"rabiFrequencyGlobalErrorRel": 0.01,
"rabiFrequencyInhomogeneityRel": 0.01,
"groundDetectionError": 0.01,
"rydbergDetectionError": 0.1,
"groundPrepError": 0.01,
"rydbergPrepErrorBest": 0.05,
"rydbergPrepErrorWorst": 0.05,
"T1Single": 100e-6,
"T1Ensemble": 100e-6,
"T2StarSingle": 5e-6,
"T2StarEnsemble": 5e-6,
"T2EchoSingle": 5e-6,
"T2EchoEnsemble": 5e-6,
"T2RabiSingle": 5e-6,
"T2RabiEnsemble": 5e-6,
"T2BlockadedRabiSingle": 5e-6,
"T2BlockadedRabiEnsemble": 5e-6,
"detuningError": 1e6,
"detuningInhomogeneity": 1e6,
"rabiAmplitudeRampCorrection": [
{"rampTime": 50e-9, "rabiCorrection": 0.92},
{"rampTime": 75e-9, "rabiCorrection": 0.97},
{"rampTime": 100e-9, "rabiCorrection": 1.00},
],
},
},
},
}
},
)
)

Expand Down

0 comments on commit a99d7da

Please sign in to comment.