Skip to content

Commit 633e421

Browse files
authored
[Feat] Add the ability to customize the pulse (#44)
1 parent 0bcd97f commit 633e421

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

qek/data/graphs.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,26 @@ def compute_register(self) -> pl.Register:
197197
assert pos is not None
198198
return pl.Register.from_coordinates(coords=pos)
199199

200-
def compute_sequence(self) -> pl.Sequence:
200+
# Default values for the sequence.
201+
#
202+
# See the companion paper for an explanation.
203+
SEQUENCE_DEFAULT_AMPLITUDE_RAD_PER_US = 1.0 * 2 * np.pi
204+
SEQUENCE_DEFAULT_DURATION_NS = 660
205+
206+
def compute_sequence(
207+
self,
208+
amplitude: float = SEQUENCE_DEFAULT_AMPLITUDE_RAD_PER_US,
209+
duration: int = SEQUENCE_DEFAULT_DURATION_NS,
210+
) -> pl.Sequence:
201211
"""
202-
Compile a Quantum Sequence from a graph for a specific device.
212+
Compile a Quantum Sequence from a graph for a specific device,
213+
using the geometry provided by `compute_register`.
214+
215+
Arguments:
216+
amplitude: The amplitude for the laser pulse, in rad per microseconds.
217+
By default, use the value demonstrated in the companion paper.
218+
duration: The duration of the laser pulse, in nanoseconds.
219+
By default, use the value demonstrated in the companion paper.
203220
204221
Raises:
205222
ValueError if the graph cannot be embedded on the given device.
@@ -212,9 +229,8 @@ def compute_sequence(self) -> pl.Sequence:
212229

213230
seq = pl.Sequence(register=reg, device=self.device)
214231

215-
# See the companion paper for an explanation on these constants.
216-
Omega_max = 1.0 * 2 * np.pi
217-
t_max = 660
232+
Omega_max = amplitude
233+
t_max = duration
218234
pulse = pl.Pulse.ConstantAmplitude(
219235
amplitude=Omega_max,
220236
detuning=pl.waveforms.RampWaveform(t_max, 0, 0),

0 commit comments

Comments
 (0)