Skip to content

fix: raise DiscretizationError when rydbergLocal params missing#1265

Merged
peterkomar-aws merged 1 commit into
mainfrom
feature/discretize-local-detuning-check
Jun 3, 2026
Merged

fix: raise DiscretizationError when rydbergLocal params missing#1265
peterkomar-aws merged 1 commit into
mainfrom
feature/discretize-local-detuning-check

Conversation

@peterkomar-aws
Copy link
Copy Markdown
Contributor

The discretize() function on LocalDetuning previously silently fell through with no time resolution when rydbergLocal was unavailable from GetDevice, producing invalid output that failed downstream validation. Now raises DiscretizationError with a clear message.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The discretize() function on LocalDetuning previously silently fell
through with no time resolution when rydbergLocal was unavailable from
GetDevice, producing invalid output that failed downstream validation.
Now raises DiscretizationError with a clear message.
@peterkomar-aws peterkomar-aws requested a review from a team as a code owner June 2, 2026 19:05
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ea3ebb4) to head (526da18).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1265   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          169       169           
  Lines        10963     10964    +1     
  Branches      1412      1413    +1     
=========================================
+ Hits         10963     10964    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@krneta krneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me. Just wondering how you tested it. Were you able to test it end-to-end?

@peterkomar-aws
Copy link
Copy Markdown
Contributor Author

Thank you. Aquila returns the rydbergLocal attribute in the device properties for all accounts, So this is the closest I could get:

from braket.devices import Devices
from braket.aws import AwsDevice

aquila = AwsDevice(Devices.QuEra.Aquila)
aquila.properties.paradigm.rydberg.rydbergLocal = None

ahs_program = ... # [from example https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/analog_hamiltonian_simulation/00_Introduction_of_Analog_Hamiltonian_Simulation_with_Rydberg_Atoms.ipynb]
ahs_program_discretized = ahs_program.discretize(aquila)

# raising `DiscretizationError: Local detuning parameters (rydbergLocal) are not available from the device properties. Ensure that the device supports local detuning and that the rydbergLocal capability data is returned by GetDevice.`

@peterkomar-aws peterkomar-aws merged commit 7ba13a6 into main Jun 3, 2026
21 checks passed
@peterkomar-aws peterkomar-aws deleted the feature/discretize-local-detuning-check branch June 3, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants