-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding dmm, draw to DetuningMap * Testing avoiding circular import * Refactoring to avoid circular imports * Fix broken UTs * Import sorting * Fixing plot DetuningMap * Serialization/Deserialization of DMM in device * Fixing typos * Testing DMM and DetuningMap * Fixing typo * adding xfails, fixing type * Remove DMM from devices and finish UTs * Take into account review comments * Add annotations * Error in Global and Local * Defining _DMMSchedule * Fixing nits * Fixing typo --------- Co-authored-by: HGSilveri <[email protected]>
- Loading branch information
Showing
18 changed files
with
677 additions
and
35 deletions.
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
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,74 @@ | ||
# Copyright 2023 Pulser Development Team | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Defines the detuning map modulator.""" | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass, field | ||
from typing import Literal, Optional | ||
|
||
from pulser.channels.base_channel import Channel | ||
|
||
|
||
@dataclass(init=True, repr=False, frozen=True) | ||
class DMM(Channel): | ||
"""Defines a Detuning Map Modulator (DMM) Channel. | ||
A Detuning Map Modulator can be used to define `Global` detuning Pulses | ||
(of zero amplitude and phase). These Pulses are locally modulated by the | ||
weights of a `DetuningMap`, thus providing a local control over the | ||
detuning. The detuning of the pulses added to a DMM has to be negative, | ||
between 0 and `bottom_detuning`. Channel targeting the transition between | ||
the ground and rydberg states, thus encoding the 'ground-rydberg' basis. | ||
Note: | ||
The protocol to add pulses to the DMM Channel is by default | ||
"no-delay". | ||
Args: | ||
bottom_detuning: Minimum possible detuning (in rad/µs), must be below | ||
zero. | ||
clock_period: The duration of a clock cycle (in ns). The duration of a | ||
pulse or delay instruction is enforced to be a multiple of the | ||
clock cycle. | ||
min_duration: The shortest duration an instruction can take. | ||
max_duration: The longest duration an instruction can take. | ||
min_avg_amp: The minimum average amplitude of a pulse (when not zero). | ||
mod_bandwidth: The modulation bandwidth at -3dB (50% reduction), in | ||
MHz. | ||
""" | ||
|
||
bottom_detuning: Optional[float] = field(default=None, init=True) | ||
addressing: Literal["Global"] = field(default="Global", init=False) | ||
max_abs_detuning: Optional[float] = field(init=False, default=None) | ||
max_amp: float = field(default=1e-16, init=False) # can't be 0 | ||
min_retarget_interval: Optional[int] = field(init=False, default=None) | ||
fixed_retarget_t: Optional[int] = field(init=False, default=None) | ||
max_targets: Optional[int] = field(init=False, default=None) | ||
|
||
def __post_init__(self) -> None: | ||
super().__post_init__() | ||
if self.bottom_detuning and self.bottom_detuning > 0: | ||
raise ValueError("bottom_detuning must be negative.") | ||
|
||
@property | ||
def basis(self) -> Literal["ground-rydberg"]: | ||
"""The addressed basis name.""" | ||
return "ground-rydberg" | ||
|
||
def _undefined_fields(self) -> list[str]: | ||
optional = [ | ||
"bottom_detuning", | ||
"max_duration", | ||
] | ||
return [field for field in optional if getattr(self, field) is None] |
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
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
Oops, something went wrong.