Skip to content

Commit

Permalink
fix: remove optional discretization fields (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
math411 committed Apr 16, 2024
1 parent 9388a25 commit f69c824
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 0 additions & 4 deletions src/braket/ahs/local_detuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ def discretize(self, properties: DiscretizationProperties) -> LocalDetuning:
"""
local_detuning_parameters = properties.rydberg.rydbergLocal
time_resolution = local_detuning_parameters.timeResolution
value_resolution = local_detuning_parameters.commonDetuningResolution
pattern_resolution = local_detuning_parameters.localDetuningResolution
discretized_magnitude = self.magnitude.discretize(
time_resolution=time_resolution,
value_resolution=value_resolution,
pattern_resolution=pattern_resolution,
)
return LocalDetuning(discretized_magnitude)
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ def test_discretize(register, driving_field, local_detuning):
device.properties.paradigm.rydberg.rydbergGlobal.phaseResolution = Decimal("5E-7")

device.properties.paradigm.rydberg.rydbergLocal.timeResolution = Decimal("1E-9")
device.properties.paradigm.rydberg.rydbergLocal.commonDetuningResolution = Decimal("2000.0")
device.properties.paradigm.rydberg.rydbergLocal.localDetuningResolution = Decimal("0.01")

discretized_ahs = ahs.discretize(device)
discretized_ir = discretized_ahs.to_ir()
Expand Down Expand Up @@ -179,10 +177,10 @@ def test_discretize(register, driving_field, local_detuning):
}
local_detuning = discretized_json["hamiltonian"]["localDetuning"][0]["magnitude"]
assert local_detuning == {
"pattern": ["0.50", "1.00", "0.50", "0.50", "0.50", "0.50"],
"pattern": ["0.5", "1", "0.5", "0.5", "0.5", "0.5"],
"time_series": {
"times": ["0E-9", "0.000003000"],
"values": ["-125664000.0", "125664000.0"],
"values": ["-125664000", "125664000"],
},
}

Expand Down
2 changes: 0 additions & 2 deletions test/unit_tests/braket/ahs/test_local_detuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ def test_discretize():
discretized_field = field.discretize(mock_properties)
magnitude_mock.discretize.assert_called_with(
time_resolution=mock_properties.rydberg.rydbergLocal.timeResolution,
value_resolution=mock_properties.rydberg.rydbergLocal.commonDetuningResolution,
pattern_resolution=mock_properties.rydberg.rydbergLocal.localDetuningResolution,
)
assert field is not discretized_field
assert discretized_field.magnitude == magnitude_mock.discretize.return_value
Expand Down

0 comments on commit f69c824

Please sign in to comment.