Skip to content

Commit

Permalink
Remove Chadoq2 and IroiseMVP (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri authored Oct 8, 2024
1 parent 3046a3d commit a47f0a9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 77 deletions.
6 changes: 0 additions & 6 deletions pulser-core/pulser/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@
from pulser.devices._device_datacls import Device, VirtualDevice
from pulser.devices._devices import (
AnalogDevice,
Chadoq2,
DigitalAnalogDevice,
IroiseMVP,
)
from pulser.devices._mock_device import MockDevice

# Registers which devices can be used to avoid definition of custom devices
_mock_devices: tuple[VirtualDevice, ...] = (MockDevice,)
_valid_devices: tuple[Device, ...] = (
Chadoq2,
IroiseMVP,
AnalogDevice,
DigitalAnalogDevice,
)
Expand All @@ -41,6 +37,4 @@
"AnalogDevice",
"DigitalAnalogDevice",
"MockDevice",
"Chadoq2",
"IroiseMVP",
]
32 changes: 0 additions & 32 deletions pulser-core/pulser/devices/_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Examples of realistic devices."""
import dataclasses

import numpy as np

from pulser.channels import DMM, Raman, Rydberg
Expand Down Expand Up @@ -99,33 +97,3 @@
),
pre_calibrated_layouts=(TriangularLatticeLayout(61, 5),),
)

# Legacy devices (deprecated, should not be used in new sequences)

Chadoq2 = dataclasses.replace(DigitalAnalogDevice, name="Chadoq2")

IroiseMVP = Device(
name="IroiseMVP",
dimensions=2,
rydberg_level=60,
max_atom_num=100,
max_radial_distance=60,
min_atom_distance=5,
channel_objects=(
Rydberg.Global(
max_abs_detuning=2 * np.pi * 4,
max_amp=2 * np.pi * 3,
clock_period=4,
min_duration=16,
max_duration=2**26,
mod_bandwidth=4,
eom_config=RydbergEOM(
limiting_beam=RydbergBeam.RED,
max_limiting_amp=40 * 2 * np.pi,
intermediate_detuning=700 * 2 * np.pi,
mod_bandwidth=24,
controlled_beams=(RydbergBeam.BLUE,),
),
),
),
)
20 changes: 0 additions & 20 deletions pulser-core/pulser/sequence/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from numpy.typing import ArrayLike

import pulser
import pulser.devices as devices
import pulser.math as pm
import pulser.sequence._decorators as seq_decorators
from pulser.channels.base_channel import Channel, States, get_states_from_bases
Expand Down Expand Up @@ -124,25 +123,6 @@ def __init__(
f"'device' must be of type 'BaseDevice', not {type(device)}."
)

with warnings.catch_warnings():
warnings.simplefilter("always")
if device == devices.Chadoq2:
warnings.warn(
"The 'Chadoq2' device has been deprecated. For a "
"similar device combining global and local addressing, "
"consider using `DigitalAnalogDevice`.",
category=DeprecationWarning,
stacklevel=2,
)

if device == devices.IroiseMVP:
warnings.warn(
"The 'IroiseMVP' device has been deprecated. For a "
"similar analog device consider using `AnalogDevice`.",
category=DeprecationWarning,
stacklevel=2,
)

# Checks if register is compatible with the device
if isinstance(register, MappableRegister):
device.validate_layout(register.layout)
Expand Down
26 changes: 7 additions & 19 deletions tests/test_abstract_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
from pulser.channels.eom import RydbergBeam, RydbergEOM
from pulser.devices import (
AnalogDevice,
Chadoq2,
Device,
DigitalAnalogDevice,
IroiseMVP,
MockDevice,
VirtualDevice,
)
Expand Down Expand Up @@ -76,7 +74,9 @@
DigitalAnalogDevice,
name="phys_Chadoq2",
dmm_objects=(
replace(Chadoq2.dmm_objects[0], total_bottom_detuning=-2000),
replace(
DigitalAnalogDevice.dmm_objects[0], total_bottom_detuning=-2000
),
),
default_noise_model=NoiseModel(
p_false_pos=0.02,
Expand Down Expand Up @@ -2658,24 +2658,12 @@ def test_unknow_waveform(self):
with patch("jsonschema.validate"):
Sequence.from_abstract_repr(json.dumps(s))

@pytest.mark.parametrize(
"device, deprecated",
[(Chadoq2, True), (IroiseMVP, True), (MockDevice, False)],
)
def test_legacy_device(self, device, deprecated):
def test_legacy_device(self):
s = _get_serialized_seq(
device=device.name, channels={"global": "rydberg_global"}
device="MockDevice", channels={"global": "rydberg_global"}
)
if deprecated:
# This is necessary because warnings.catch_warnings (being
# used in Sequence) overrides pytest.mark.filterwarnings
with pytest.warns(
DeprecationWarning, match="device has been deprecated"
):
seq = Sequence.from_abstract_repr(json.dumps(s))
else:
seq = Sequence.from_abstract_repr(json.dumps(s))
assert seq.device == device
seq = Sequence.from_abstract_repr(json.dumps(s))
assert seq.device == MockDevice

def test_bad_type(self):
s = _get_serialized_seq()
Expand Down

0 comments on commit a47f0a9

Please sign in to comment.