Skip to content

Commit

Permalink
Merge branch 'main' into tox_parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeCoull authored Apr 15, 2024
2 parents bda8887 + 5ed6590 commit 960943e
Show file tree
Hide file tree
Showing 54 changed files with 3,654 additions and 822 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # release/v1
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # release/v1
with:
password: ${{ secrets.pypi_token }}
4 changes: 3 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ jobs:
run: |
tox -e unit-tests
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ strategy.job-index }} == 0
123 changes: 123 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,128 @@
# Changelog

## v1.77.3.post0 (2024-04-15)

### Documentation Changes

* correct gphase matrix representation

## v1.77.3 (2024-04-11)

### Bug Fixes and Other Changes

* measure target qubits are required

## v1.77.2 (2024-04-10)

### Bug Fixes and Other Changes

* remove shifting field from testing

## v1.77.1 (2024-04-10)

### Bug Fixes and Other Changes

* add measure qubit targets in braket_program_context

## v1.77.0 (2024-04-10)

### Features

* rename shifting field to local detuning

## v1.76.3 (2024-04-09)

### Bug Fixes and Other Changes

* Replace pkg_resources with importlib.metadata

### Documentation Changes

* Improve gphase unitary matrix definition in docstring

## v1.76.2 (2024-04-08)

### Bug Fixes and Other Changes

* backwards compatiblity for local detuning

## v1.76.1 (2024-04-08)

### Bug Fixes and Other Changes

* Support single-register measurements in `from_ir`
* prevent repeated measurements on a qubit

## v1.76.0 (2024-04-01)

### Features

* add support for OpenQASM measure on a subset of qubits

### Bug Fixes and Other Changes

* restore the dependent test back to pennylane

### Documentation Changes

* fix GPI2 gate matrix representation

## v1.75.0 (2024-03-28)

### Features

* upgrade to pydantic 2.x

### Bug Fixes and Other Changes

* change schemas constraint

## v1.74.1 (2024-03-27)

### Bug Fixes and Other Changes

* temporarily pin the schemas version

## v1.74.0 (2024-03-21)

### Features

* Allow sets of calibrations in batches

### Bug Fixes and Other Changes

* batch tasking passing lists to single tasks

## v1.73.3 (2024-03-18)

### Bug Fixes and Other Changes

* store account id if already accessed

## v1.73.2 (2024-03-13)

### Bug Fixes and Other Changes

* increase tol value for our integ tests

## v1.73.1 (2024-03-11)

### Bug Fixes and Other Changes

* allow for braket endpoint to be set within the jobs

## v1.73.0 (2024-03-07)

### Features

* update circuit drawing

## v1.72.2 (2024-03-04)

### Bug Fixes and Other Changes

* validate FreeParameter name

## v1.72.1 (2024-02-28)

### Bug Fixes and Other Changes
Expand Down
5 changes: 2 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""Sphinx configuration."""

import datetime

import pkg_resources
from importlib.metadata import version

# Sphinx configuration below.
project = "amazon-braket-sdk"
version = pkg_resources.require(project)[0].version
version = version(project)
release = version
copyright = "{}, Amazon.com".format(datetime.datetime.now().year)

Expand Down
Binary file added model.tar.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
packages=find_namespace_packages(where="src", exclude=("test",)),
package_dir={"": "src"},
install_requires=[
"amazon-braket-schemas>=1.20.2",
"amazon-braket-default-simulator>=1.19.1",
"amazon-braket-schemas>=1.21.3",
"amazon-braket-default-simulator>=1.21.4",
"oqpy~=0.3.5",
"setuptools",
"backoff",
"boltons",
"boto3>=1.28.53",
Expand All @@ -41,6 +40,7 @@
"openpulse",
"openqasm3",
"sympy",
"backports.entry-points-selectable",
],
extras_require={
"test": [
Expand Down
2 changes: 1 addition & 1 deletion src/braket/_sdk/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "1.72.2.dev0"
__version__ = "1.77.4.dev0"
1 change: 1 addition & 0 deletions src/braket/ahs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
from braket.ahs.driving_field import DrivingField # noqa: F401
from braket.ahs.field import Field # noqa: F401
from braket.ahs.hamiltonian import Hamiltonian # noqa: F401
from braket.ahs.local_detuning import LocalDetuning # noqa: F401
from braket.ahs.pattern import Pattern # noqa: F401
from braket.ahs.shifting_field import ShiftingField # noqa: F401
10 changes: 5 additions & 5 deletions src/braket/ahs/analog_hamiltonian_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
from braket.ahs.discretization_types import DiscretizationError, DiscretizationProperties
from braket.ahs.driving_field import DrivingField
from braket.ahs.hamiltonian import Hamiltonian
from braket.ahs.shifting_field import ShiftingField
from braket.ahs.local_detuning import LocalDetuning
from braket.device_schema import DeviceActionType


class AnalogHamiltonianSimulation:
SHIFTING_FIELDS_PROPERTY = "shifting_fields"
LOCAL_DETUNING_PROPERTY = "local_detuning"
DRIVING_FIELDS_PROPERTY = "driving_fields"

def __init__(self, register: AtomArrangement, hamiltonian: Hamiltonian) -> None:
Expand Down Expand Up @@ -74,7 +74,7 @@ def _hamiltonian_to_ir(self) -> ir.Hamiltonian:
terms[term_type].append(term_ir)
return ir.Hamiltonian(
drivingFields=terms[AnalogHamiltonianSimulation.DRIVING_FIELDS_PROPERTY],
shiftingFields=terms[AnalogHamiltonianSimulation.SHIFTING_FIELDS_PROPERTY],
localDetuning=terms[AnalogHamiltonianSimulation.LOCAL_DETUNING_PROPERTY],
)

def discretize(self, device: AwsDevice) -> AnalogHamiltonianSimulation: # noqa
Expand Down Expand Up @@ -116,8 +116,8 @@ def _get_term_ir(


@_get_term_ir.register
def _(term: ShiftingField) -> tuple[str, ir.ShiftingField]:
return AnalogHamiltonianSimulation.SHIFTING_FIELDS_PROPERTY, ir.ShiftingField(
def _(term: LocalDetuning) -> tuple[str, ir.LocalDetuning]:
return AnalogHamiltonianSimulation.LOCAL_DETUNING_PROPERTY, ir.LocalDetuning(
magnitude=ir.PhysicalField(
time_series=ir.TimeSeries(
times=term.magnitude.time_series.times(),
Expand Down
12 changes: 9 additions & 3 deletions src/braket/ahs/driving_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,23 @@ def discretize(self, properties: DiscretizationProperties) -> DrivingField:
"""
driving_parameters = properties.rydberg.rydbergGlobal
time_resolution = driving_parameters.timeResolution

amplitude_value_resolution = driving_parameters.rabiFrequencyResolution
discretized_amplitude = self.amplitude.discretize(
time_resolution=time_resolution,
value_resolution=driving_parameters.rabiFrequencyResolution,
value_resolution=amplitude_value_resolution,
)

phase_value_resolution = driving_parameters.phaseResolution
discretized_phase = self.phase.discretize(
time_resolution=time_resolution,
value_resolution=driving_parameters.phaseResolution,
value_resolution=phase_value_resolution,
)

detuning_value_resolution = driving_parameters.detuningResolution
discretized_detuning = self.detuning.discretize(
time_resolution=time_resolution,
value_resolution=driving_parameters.detuningResolution,
value_resolution=detuning_value_resolution,
)
return DrivingField(
amplitude=discretized_amplitude, phase=discretized_phase, detuning=discretized_detuning
Expand Down
16 changes: 4 additions & 12 deletions src/braket/ahs/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from decimal import Decimal
from typing import Optional

from braket.ahs.discretization_types import DiscretizationError
from braket.ahs.pattern import Pattern
from braket.timings.time_series import TimeSeries

Expand Down Expand Up @@ -44,33 +43,26 @@ def pattern(self) -> Optional[Pattern]:

def discretize(
self,
time_resolution: Decimal,
value_resolution: Decimal,
time_resolution: Optional[Decimal] = None,
value_resolution: Optional[Decimal] = None,
pattern_resolution: Optional[Decimal] = None,
) -> Field:
"""Creates a discretized version of the field,
where time, value and pattern are rounded to the
closest multiple of their corresponding resolutions.
Args:
time_resolution (Decimal): Time resolution
value_resolution (Decimal): Value resolution
time_resolution (Optional[Decimal]): Time resolution
value_resolution (Optional[Decimal]): Value resolution
pattern_resolution (Optional[Decimal]): Pattern resolution
Returns:
Field: A new discretized field.
Raises:
ValueError: if pattern_resolution is None, but there is a Pattern
"""
discretized_time_series = self.time_series.discretize(time_resolution, value_resolution)
if self.pattern is None:
discretized_pattern = None
else:
if pattern_resolution is None:
raise DiscretizationError(
f"{self.pattern} is defined but has no pattern_resolution defined"
)
discretized_pattern = self.pattern.discretize(pattern_resolution)
discretized_field = Field(time_series=discretized_time_series, pattern=discretized_pattern)
return discretized_field
Loading

0 comments on commit 960943e

Please sign in to comment.