Esempio n. 1
0
def test_carr_purcell_sequence():
    """
    Test the Carr-Purcell sequence.
    """

    duration = 10.0
    offset_count = 4

    sequence = new_carr_purcell_sequence(duration=duration, offset_count=offset_count)

    _spacing = duration / offset_count
    _offsets = np.array(
        [
            _spacing * 0.5,
            _spacing * 0.5 + _spacing,
            _spacing * 0.5 + 2 * _spacing,
            _spacing * 0.5 + 3 * _spacing,
        ]
    )
    _rabi_rotations = np.array([np.pi, np.pi, np.pi, np.pi])
    _azimuthal_angles = np.array([0, 0, 0, 0])
    _detuning_rotations = np.array([0, 0, 0, 0])

    assert np.allclose(_offsets, sequence.offsets)
    assert np.allclose(_rabi_rotations, sequence.rabi_rotations)
    assert np.allclose(_azimuthal_angles, sequence.azimuthal_angles)
    assert np.allclose(_detuning_rotations, sequence.detuning_rotations)

    sequence = new_carr_purcell_sequence(
        duration=duration,
        offset_count=offset_count,
        pre_post_rotation=True,
    )

    _offsets = np.array(
        [
            0,
            _spacing * 0.5,
            _spacing * 0.5 + _spacing,
            _spacing * 0.5 + 2 * _spacing,
            _spacing * 0.5 + 3 * _spacing,
            duration,
        ]
    )
    _rabi_rotations = np.array([np.pi / 2, np.pi, np.pi, np.pi, np.pi, np.pi / 2])
    _azimuthal_angles = np.array([0, 0, 0, 0, 0, np.pi])
    _detuning_rotations = np.array([0, 0, 0, 0, 0, 0])

    assert np.allclose(_offsets, sequence.offsets)
    assert np.allclose(_rabi_rotations, sequence.rabi_rotations)
    assert np.allclose(_azimuthal_angles, sequence.azimuthal_angles)
    assert np.allclose(_detuning_rotations, sequence.detuning_rotations)
Esempio n. 2
0
def test_if_carr_purcell_sequence_with_even_pulses_is_identity():
    """
    Tests if the product of the pulses in a Carr-Purcell sequence with pre/post
    pi/2-pulses is an identity, when the number of pulses is even.
    """
    even_carr_purcell_sequence = new_carr_purcell_sequence(
        duration=10.0, offset_count=8, pre_post_rotation=True)

    assert _pulses_produce_identity(even_carr_purcell_sequence)