Skip to content

Commit

Permalink
Modify schema, add deprecate warning
Browse files Browse the repository at this point in the history
  • Loading branch information
a-corni committed Nov 24, 2023
1 parent 67d9242 commit d310956
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pulser-core/pulser/devices/_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
min_duration=16,
max_duration=2**26,
bottom_detuning=-2 * np.pi * 20,
total_bottom_detuning=None, # -2 * np.pi * 2000
# TODO: total_bottom_detuning=-2 * np.pi * 2000
),
),
)
Expand Down
27 changes: 14 additions & 13 deletions pulser-core/pulser/json/abstract_repr/schemas/device-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@
"description": "Time taken to change the target (in ns).",
"type": "null"
},
"total_bottom_detuning": {
"description": "Minimum possible detuning of the whole DMM channel (in rad/µs), must be below zero.",
"type": [
"number",
"null"
]
},
"id": {
"$ref": "#/definitions/ChannelId",
"description": "The identifier of the channel within its device."
Expand Down Expand Up @@ -88,6 +81,13 @@
"number",
"null"
]
},
"total_bottom_detuning": {
"description": "Minimum possible detuning of the whole DMM channel (in rad/µs), must be below zero.",
"type": [
"number",
"null"
]
}
},
"required": [
Expand All @@ -97,7 +97,6 @@
"clock_period",
"eom_config",
"fixed_retarget_t",
"total_bottom_detuning",
"id",
"max_abs_detuning",
"max_amp",
Expand Down Expand Up @@ -1458,10 +1457,6 @@
"description": "Time taken to change the target (in ns).",
"type": "null"
},
"total_bottom_detuning": {
"description": "Minimum possible detuning of the whole DMM channel (in rad/µs), must be below zero.",
"type": "number"
},
"id": {
"$ref": "#/definitions/ChannelId",
"description": "The identifier of the channel within its device."
Expand Down Expand Up @@ -1501,6 +1496,13 @@
"number",
"null"
]
},
"total_bottom_detuning": {
"description": "Minimum possible detuning of the whole DMM channel (in rad/µs), must be below zero.",
"type": [
"number",
"null"
]
}
},
"required": [
Expand All @@ -1510,7 +1512,6 @@
"clock_period",
"eom_config",
"fixed_retarget_t",
"total_bottom_detuning",
"id",
"max_abs_detuning",
"max_amp",
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ src_paths = ["pulser-core", "pulser-simulation", "pulser-pasqal"]
filterwarnings = [
# All warnings are turned into errors
"error",
# Except this particular warnings, which is ignored
# Except these particular warnings, which are ignored
'ignore:A duration of \d+ ns is not a multiple of:UserWarning',
"ignore:`total_bottom_detuning` should be defined to:DeprecationWarning",
]
10 changes: 5 additions & 5 deletions tests/test_dmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ def test_validate_pulse(self, physical_dmm):
with pytest.raises(
ValueError,
match=re.escape(
"The applied detuning goes below the global bottom detuning "
"The applied detuning goes below the total bottom detuning "
f"of the DMM ({physical_dmm.total_bottom_detuning} rad/µs)"
),
):
# local detunings match bottom_detuning, global don't
physical_dmm.validate_pulse(too_low_pulse, det_map)

# Should be valid in a virtual DMM without global bottom detuning
virtual_dmm = DMM(bottom_detuning=-1)
assert virtual_dmm.is_virtual()
virtual_dmm.validate_pulse(too_low_pulse, det_map)
# Should be valid in a physical DMM without global bottom detuning
physical_dmm = DMM(bottom_detuning=-1)
assert not physical_dmm.is_virtual()
physical_dmm.validate_pulse(too_low_pulse, det_map)

0 comments on commit d310956

Please sign in to comment.