Skip to content

Commit

Permalink
feat: add rigetti device properties v2 schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
Coull committed Jan 14, 2025
1 parent 70f8622 commit 65c6bfc
Show file tree
Hide file tree
Showing 6 changed files with 582 additions and 17 deletions.
22 changes: 11 additions & 11 deletions src/braket/device_schema/quera/quera_ahs_paradigm_properties_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class RydbergGlobal(BaseModel):
timeDeltaMin(Decimal): Minimum time step with which times for global Rydberg drive
parameters can be specified (measured in s)
timeMin (Decimal): Minimum duration of Rydberg drive (measured in s)
timeMax (Decimal): Maximum duration of Rydberg drive (measured in s) Note: This may be
timeMax (Decimal): Maximum duration of Rydberg drive (measured in s) Note: This may be
longer than the T2 coherence time.
"""

Expand Down Expand Up @@ -159,12 +159,12 @@ class PerformanceLattice(BaseModel):
Uncertainties of atomic site arrangements
Attributes:
positionErrorAbs (Decimal): Total error of the atom position during coherent evolution
relative to the lab frame over the course of a 4-microsecond quantum program; it
relative to the lab frame over the course of a 4-microsecond quantum program; it
combines lattice site position and thermal atom position errors. (measured in meters)
sitePositionError (Decimal): Systematic, pattern-dependent error between specified and
actual lattice site positions. (measured in meters)
atomPositionError (Decimal): Random error in the atom position during coherent evolution as
a result of thermal motion over the course of a 4-microsecond quantum program.
a result of thermal motion over the course of a 4-microsecond quantum program.
(measured in meters)
fillingErrorTypical (Annotated[Decimal, Field(ge=0, le=1)]): Typical probability of failing
to occupy a site specified by user as 'filled'. These probabilities are dependent on
Expand All @@ -180,25 +180,25 @@ class PerformanceLattice(BaseModel):
erroneously filling a site specified by user as 'unfilled'. Upper bound that includes
the pattern-dependence, site position dependence and time-variation of this
probability. Normalized to 1.
atomLossProbabilityTypical (Annotated[Decimal, Field(ge=0, le=1)]): Typical probability of
atomLossProbabilityTypical (Annotated[Decimal, Field(ge=0, le=1)]): Typical probability of
atom loss from a filled site over the course of a 4-microsecond quantum program between
the first (“pre-sequence”) and second (“post-sequence”) image. These probabilities can
be dependent on the pattern and site position within the pattern, and can change
be dependent on the pattern and site position within the pattern, and can change
slightly with time. Normalized to 1.
atomLossProbabilityWorst (Annotated[Decimal, Field(ge=0, le=1)]): Worst-case probability of
atom loss from a filled site over the course of a 4-microsecond quantum program between
the first (“pre-sequence”) and second (“post-sequence”) image. Upper bound that
includes the pattern-dependence, site position dependence and time-varition of this
the first (“pre-sequence”) and second (“post-sequence”) image. Upper bound that
includes the pattern-dependence, site position dependence and time-varition of this
probability. Normalized to 1.
atomCaptureProbabilityTypical (Annotated[Decimal, Field(ge=0, le=1)]): Typical probability
of atom capture into an empty site over the course of a 4-microsecond quantum program
between the first (“pre-sequence”) and second (“post-sequence”) image. These
atomCaptureProbabilityTypical (Annotated[Decimal, Field(ge=0, le=1)]): Typical probability
of atom capture into an empty site over the course of a 4-microsecond quantum program
between the first (“pre-sequence”) and second (“post-sequence”) image. These
probabilities can be dependent on the pattern and site position within the pattern, and
can change slightly with time. Normalized to 1.
atomCaptureProbabilityWorst (Annotated[Decimal, Field(ge=0, le=1)]): Worst-case probability
of atom capture into an empty site over the course of a 4-microsecond quantum program
between the first (“pre-sequence”) and second (“post-sequence”) image. Upper bound that
includes the pattern-dependence, site position dependence and time-variation of this
includes the pattern-dependence, site position dependence and time-variation of this
probability. Normalized to 1.
atomDetectionErrorFalsePositiveTypical (Annotated[Decimal, Field(ge=0, le=1)]): Typical
probability of a false-positive atom detection error. These probabilities can be
Expand Down
18 changes: 12 additions & 6 deletions src/braket/device_schema/rigetti/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License

from braket.device_schema.rigetti.rigetti_device_capabilities_v1 import ( # noqa: F401
RigettiDeviceCapabilities,
from braket.device_schema.rigetti.rigetti_device_capabilities_v1 import (
RigettiDeviceCapabilities as RigettiDeviceCapabilities,
)
from braket.device_schema.rigetti.rigetti_device_parameters_v1 import ( # noqa: F401
RigettiDeviceParameters,
from braket.device_schema.rigetti.rigetti_device_capabilities_v2 import ( # noqa: F401
RigettiDeviceCapabilities as RigettiDeviceCapabilitiesV2,
)
from braket.device_schema.rigetti.rigetti_provider_properties_v1 import ( # noqa: F401
RigettiProviderProperties,
from braket.device_schema.rigetti.rigetti_device_parameters_v1 import (
RigettiDeviceParameters as RigettiDeviceParameters,
)
from braket.device_schema.rigetti.rigetti_provider_properties_v1 import (
RigettiProviderProperties as RigettiProviderProperties,
)
from braket.device_schema.rigetti.rigetti_provider_properties_v2 import ( # noqa: F401
RigettiProviderProperties as RigettiProviderPropertiesV2,
)
125 changes: 125 additions & 0 deletions src/braket/device_schema/rigetti/rigetti_device_capabilities_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from typing import Dict, Optional, Union

from pydantic.v1 import Field

from braket.device_schema.device_action_properties import DeviceActionType
from braket.device_schema.device_capabilities import DeviceCapabilities
from braket.device_schema.gate_model_qpu_paradigm_properties_v1 import (
GateModelQpuParadigmProperties,
)
from braket.device_schema.jaqcd_device_action_properties import JaqcdDeviceActionProperties
from braket.device_schema.openqasm_device_action_properties import OpenQASMDeviceActionProperties
from braket.device_schema.pulse.pulse_device_action_properties_v1 import PulseDeviceActionProperties
from braket.device_schema.rigetti.rigetti_provider_properties_v2 import RigettiProviderProperties
from braket.device_schema.standardized_gate_model_qpu_device_properties_v1 import (
StandardizedGateModelQpuDeviceProperties,
)
from braket.schema_common import BraketSchemaBase, BraketSchemaHeader


class RigettiDeviceCapabilities(BraketSchemaBase, DeviceCapabilities):
"""
This defines the capabilities of a Rigetti device.
Attributes:
action(Dict[Union[DeviceActionType, str],
Union[OpenQASMDeviceActionProperties, JaqcdDeviceActionProperties]]): Actions that a
Rigetti device can support
paradigm(GateModelQpuParadigmProperties): Paradigm properties of a Rigetti
provider(Optional[RigettiProviderProperties]): Rigetti provider specific properties
standardized
(StandardizedGateModelQpuDeviceProperties): Braket standarized device
properties for Rigetti
pulse(PulseDeviceActionProperties): Hardware device details for pulse control
Examples:
>>> import json
>>> input_json = {
... "braketSchemaHeader": {
... "name": "braket.device_schema.rigetti.rigetti_device_capabilities",
... "version": "2",
... },
... "service": {
... "braketSchemaHeader": {
... "name": "braket.device_schema.device_service_properties",
... "version": "1",
... },
... "executionWindows": [
... {
... "executionDay": "Everyday",
... "windowStartHour": "09:00",
... "windowEndHour": "10:00",
... }
... ],
... "shotsRange": [1, 10],
... "deviceCost": {
... "price": 0.25,
... "unit": "minute"
... },
... "deviceDocumentation": {
... "imageUrl": "image_url",
... "summary": "Summary on the device",
... "externalDocumentationUrl": "exter doc link",
... },
... "deviceLocation": "us-west-1",
... "updatedAt": "2020-06-16T19:28:02.869136"
... },
... "action": {
... "braket.ir.jaqcd.program": {
... "actionType": "braket.ir.jaqcd.program",
... "version": ["1"],
... "supportedOperations": ["x", "y"],
... "supportedResultTypes": [{
... "name": "resultType1",
... "observables": ["observable1"],
... "minShots": 0,
... "maxShots": 4,
... }],
... }
... },
... "paradigm": {
... "braketSchemaHeader": {
... "name": "braket.device_schema.gate_model_qpu_paradigm_properties",
... "version": "1",
... },
... "qubitCount": 32,
... "nativeGateSet": ["ccnot", "cy"],
... "connectivity": {
... "fullyConnected": False,
... "connectivityGraph": {"1": ["2", "3"]},
... },
... },
... "deviceParameters": {RigettiDeviceParameters.schema_json()},
... "standardized": \
... {StandardizedGateModelQpuDeviceProperties.schema_json()},
... "pulse": {PulseDeviceActionProperties.schema_json()},
... }
>>> RigettiDeviceCapabilities.parse_raw_schema(json.dumps(input_json))
"""

_PROGRAM_HEADER = BraketSchemaHeader(
name="braket.device_schema.rigetti.rigetti_device_capabilities", version="2"
)
braketSchemaHeader: BraketSchemaHeader = Field(default=_PROGRAM_HEADER, const=_PROGRAM_HEADER)
action: Dict[
Union[DeviceActionType, str],
Union[OpenQASMDeviceActionProperties, JaqcdDeviceActionProperties],
]
paradigm: GateModelQpuParadigmProperties
provider: Optional[RigettiProviderProperties]
standardized: Optional[StandardizedGateModelQpuDeviceProperties]
pulse: Optional[PulseDeviceActionProperties]
159 changes: 159 additions & 0 deletions src/braket/device_schema/rigetti/rigetti_provider_properties_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from typing import Dict, List, Union

from pydantic.v1 import Field

from braket.schema_common import BraketSchemaBase, BraketSchemaHeader


class RigettiProviderProperties(BraketSchemaBase):
"""
This defines the parameters common to all Rigetti devices.
Attributes:
specs (Dict[str, Union[str, List, Dict[str, Union[str,List]]]): Basic specifications for the device,
such as gate fidelities and coherence times. More details at
https://docs.api.qcs.rigetti.com/#operation/GetInstructionSetArchitecture
Examples:
>>> import json
>>> input_json = {
... "braketSchemaHeader": {
... "name": "braket.device_schema.rigetti.rigetti_provider_properties",
... "version": "2",
... },
... "specs": {
... "instructionSetArchitectures": [
... {
... "architecture": {
... "edges": [
... {
... "node_ids": [
... 0,
... 0
... ]
... }
... ],
... "family": "None",
... "nodes": [
... {
... "node_id": 0
... }
... ]
... },
... "benchmarks": [
... {
... "characteristics": [
... {
... "error": 0,
... "name": "string",
... "node_ids": [
... 0
... ],
... "parameter_values": [
... 0
... ],
... "timestamp": "2025-01-03T00:13:25Z",
... "value": 0
... }
... ],
... "name": "string",
... "node_count": 0,
... "parameters": [
... {
... "name": "string"
... }
... ],
... "sites": [
... {
... "characteristics": [
... {
... "error": 0,
... "name": "string",
... "node_ids": [
... 0
... ],
... "parameter_values": [
... 0
... ],
... "timestamp": "2025-01-03T00:13:25Z",
... "value": 0
... }
... ],
... "node_ids": [
... 0
... ]
... }
... ]
... }
... ],
... "instructions": [
... {
... "characteristics": [
... {
... "error": 0,
... "name": "string",
... "node_ids": [
... 0
... ],
... "parameter_values": [
... 0
... ],
... "timestamp": "2025-01-03T00:13:25Z",
... "value": 0
... }
... ],
... "name": "string",
... "node_count": 0,
... "parameters": [
... {
... "name": "string"
... }
... ],
... "sites": [
... {
... "characteristics": [
... {
... "error": 0,
... "name": "string",
... "node_ids": [
... 0
... ],
... "parameter_values": [
... 0
... ],
... "timestamp": "2025-01-03T00:13:25Z",
... "value": 0
... }
... ],
... "node_ids": [
... 0
... ]
... }
... ]
... }
... ],
... "name": "string"
... }
... ],
... }
>>> RigettiProviderProperties.parse_raw_schema(json.dumps(input_json))
"""

_PROGRAM_HEADER = BraketSchemaHeader(
name="braket.device_schema.rigetti.rigetti_provider_properties", version="2"
)
braketSchemaHeader: BraketSchemaHeader = Field(default=_PROGRAM_HEADER, const=_PROGRAM_HEADER)
specs: Dict[str, Union[str, List, Dict[str, Union[str, List]]]]
Loading

0 comments on commit 65c6bfc

Please sign in to comment.