Skip to content

AnalogDevice functions

dyn_pulse(sequence, duration, amplitude, detuning, phase, **_)

Dynamic pulse to simulate a specific time-dependent hamiltonian for neutral-atom devices.

PARAMETER DESCRIPTION
sequence

a pulser.sequence.Sequence instance

TYPE: Sequence

duration

duration of the pulse in dimensionless units

TYPE: VariableItem | float

amplitude

amplitude of the pulse in dimensionless units

TYPE: VariableItem | float

detuning

detuning of the pulse in dimensionless units

TYPE: VariableItem | float

phase

phase in radians

TYPE: VariableItem | float

Source code in qadence2_platforms/backends/analog/functions.py
def dyn_pulse(
    sequence: Sequence,
    duration: VariableItem | float,
    amplitude: VariableItem | float,
    detuning: VariableItem | float,
    phase: VariableItem | float,
    **_: Any,
) -> None:
    """
    Dynamic pulse to simulate a specific time-dependent hamiltonian for neutral-atom devices.

    Args:
        sequence: a `pulser.sequence.Sequence` instance
        duration: duration of the pulse in dimensionless units
        amplitude: amplitude of the pulse in dimensionless units
        detuning: detuning of the pulse in dimensionless units
        phase: phase in radians
    """
    max_amp = sequence.device.channels["rydberg_global"].max_amp or DEFAULT_AMPLITUDE
    max_abs_detuning = (
        sequence.device.channels["rydberg_global"].max_abs_detuning or DEFAULT_DETUNING
    )

    # FIXME: Centralize unit converions
    duration *= 1000 * 2 * np.pi / max_amp  # type: ignore
    amplitude *= max_amp  # type: ignore
    detuning *= max_abs_detuning  # type: ignore

    new_amplitude = ConstantWaveform(duration, amplitude)
    new_detuning = ConstantWaveform(duration, detuning)

    p = Pulse(new_amplitude, new_detuning, phase)
    sequence.add(p, channel="global")

piecewise_pulse(sequence, duration, amplitude, detuning, phase, **_)

Dynamic pulse to simulate a specific piecewise time-dependent hamiltonian for neutral-atom devices.

PARAMETER DESCRIPTION
sequence

a pulser.sequence.Sequence instance

TYPE: Sequence

duration

duration of the pulse in dimensionless units

TYPE: Variable | VariableItem

amplitude

amplitude of the pulse in dimensionless units

TYPE: Variable

detuning

detuning of the pulse in dimensionless units

TYPE: Variable

phase

phase in radians

TYPE: VariableItem | float

Source code in qadence2_platforms/backends/analog/functions.py
def piecewise_pulse(
    sequence: Sequence,
    duration: Variable | VariableItem,
    amplitude: Variable,
    detuning: Variable,
    phase: VariableItem | float,
    **_: Any,
) -> None:
    """
    Dynamic pulse to simulate a specific piecewise time-dependent hamiltonian for neutral-atom devices.

    Args:
        sequence: a `pulser.sequence.Sequence` instance
        duration: duration of the pulse in dimensionless units
        amplitude: amplitude of the pulse in dimensionless units
        detuning: detuning of the pulse in dimensionless units
        phase: phase in radians
    """
    max_amp = sequence.device.channels["rydberg_global"].max_amp or DEFAULT_AMPLITUDE
    max_abs_detuning = (
        sequence.device.channels["rydberg_global"].max_abs_detuning or DEFAULT_DETUNING
    )

    dur_factor = 1000 * 2 * np.pi / max_amp  # type: ignore
    amp_factor = max_amp  # type: ignore
    det_factor = max_abs_detuning  # type: ignore

    # Needed so a size = 1 variable is made iterable
    duration = [duration] if isinstance(duration, VariableItem) else duration

    for i, dur in enumerate(duration):
        amp_wf = RampWaveform(
            dur * dur_factor, amplitude[i] * amp_factor, amplitude[i + 1] * amp_factor
        )
        det_wf = RampWaveform(
            dur * dur_factor, detuning[i] * det_factor, detuning[i + 1] * det_factor
        )
        sequence.add(Pulse(amp_wf, det_wf, phase), "global")