-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Full support for Local Detuning #86
Merged
kshyatt-aws
merged 11 commits into
amazon-braket:ksh/feature_bump
from
Fe-r-oz:LocalDetuning
Aug 28, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
63a4224
[Feature]: Full support for local detuning
7a14d44
[Feature]: Full support for local detuning, Adding Mock Methods for D…
9092587
[Feature]: Full support for local detuning - Adding basic tests
e47b78e
[Feature]: Adding full support for local detuning - Discretize Mock T…
c831f86
[Feature]: Full support for local detuning - codereview suggestions
0871a73
[Feature] - Full support for local detuning - formatting
036c7dd
[Feature] - Full support for local detuning - cleanup
1f0df77
adding codereview suggestions
8340038
Minor Cleanup
c215b53
CI doc fix
eba9e13
Merge branch 'amazon-braket:main' into LocalDetuning
Fe-r-oz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Braket, Test, JSON3, StructTypes, Mocking, UUIDs, DecFP | ||
|
||
Mocking.activate() | ||
|
||
struct MockRydbergLocal | ||
kshyatt-aws marked this conversation as resolved.
Show resolved
Hide resolved
|
||
timeResolution::Dec128 | ||
commonDetuningResolution::Dec128 | ||
localDetuningResolution::Dec128 | ||
end | ||
|
||
struct MockRydberg | ||
c6coefficient::Dec128 | ||
rydbergGlobal::Braket.RydbergGlobal | ||
rydbergLocal::MockRydbergLocal | ||
end | ||
|
||
@testset "AHS.LocalDetuning" begin | ||
|
||
@testset "LocalDetuning" begin | ||
times₁ = [0, 0.1, 0.2, 0.3] | ||
times₂ = [0.3, 0.1, 0.2, 0] | ||
glob_amplitude₁ = [0.5, 0.8, 0.9, 1.0] | ||
pattern₁ = [0.3, 0.7, 0.6, -0.5, 0, 1.6] | ||
s₁ = LocalDetuning(times₁, glob_amplitude₁, pattern₁) | ||
s₂ = LocalDetuning(times₂, glob_amplitude₁, pattern₁) | ||
@test s₁.magnitude.pattern.series == [0.3, 0.7, 0.6, -0.5, 0, 1.6] | ||
@test s₁.magnitude.time_series.sorted == true | ||
@test s₂.magnitude.time_series.sorted == false | ||
end | ||
|
||
@testset "LocalDetuning Stitch: Mean, Left, Right" begin | ||
times₁ = [0, 0.1, 0.2, 0.3] | ||
glob_amplitude₁ = [0.5, 0.8, 0.9, 1.0] | ||
pattern₁ = [0.3, 0.7, 0.6, -0.5, 0, 1.6] | ||
times₂ = [0, 0.1, 0.2, 0.3] | ||
glob_amplitude₂ = [0.5, 0.8, 0.9, 1.0] | ||
pattern₂ = pattern₁ | ||
s₂ = LocalDetuning(times₂, glob_amplitude₂, pattern₂) | ||
s₁ = LocalDetuning(times₁, glob_amplitude₁, pattern₁) | ||
stitchedₗ = stitch(s₁, s₂, :left) | ||
@test stitchedₗ.magnitude.pattern == s₁.magnitude.pattern | ||
end | ||
|
||
@testset "LocalDetuning: Discretize" begin | ||
times₅ = [0, 0.1, 0.2] | ||
values₅ = [0.2, 0.5, 0.7] | ||
pattern₅ = [0.1, 0.3, 0.5] | ||
ld = LocalDetuning(times₅, values₅, pattern₅) | ||
properties = Braket.DiscretizationProperties( | ||
Braket.Lattice( | ||
Braket.Area(Dec128("1e-3"), Dec128("1e-3")), | ||
Braket.Geometry(Dec128("1e-7"), Dec128("1e-7"), Dec128("1e-7"), 200) | ||
), | ||
MockRydberg( | ||
Dec128("1e-6"), | ||
Braket.RydbergGlobal( | ||
(Dec128("1.0"), Dec128("1e6")), | ||
Dec128("400.0"), | ||
Dec128("0.2"), | ||
(Dec128("1.0"), Dec128("1e6")), | ||
Dec128("0.2"), | ||
Dec128("0.2"), | ||
(Dec128("1.0"), Dec128("1e6")), | ||
Dec128("5e-7"), | ||
Dec128("1e-9"), | ||
Dec128("1e-5"), | ||
Dec128("0.0"), | ||
Dec128("100.0") | ||
), | ||
MockRydbergLocal(Dec128("1e-9"), Dec128("2000.0"), Dec128("0.01")) | ||
) | ||
) | ||
discretized_ld = discretize(ld, properties) | ||
@test discretized_ld isa LocalDetuning | ||
end | ||
|
||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should follow the proper doctest format like: