コード例 #1
0
def test_if_xy_concatenated_sequence_is_identity():
    """
    Tests if the product of the pulses in an XY concatenated sequence with pre/post
    pi/2-pulses is an identity.
    """
    xy_concat_sequence = new_xy_concatenated_sequence(
        duration=10.0,
        concatenation_order=4,
        pre_post_rotation=True,
    )

    assert _pulses_produce_identity(xy_concat_sequence)
コード例 #2
0
def test_xy_concatenated_sequence():
    """
    Tests the XY-concatenated sequence.
    """

    duration = 10.0
    concatenation_order = 2

    sequence = new_xy_concatenated_sequence(
        duration=duration,
        concatenation_order=concatenation_order,
    )

    _spacing = duration / (2**(concatenation_order * 2))
    _offsets = np.array([
        _spacing,
        2 * _spacing,
        3 * _spacing,
        4 * _spacing,
        5 * _spacing,
        6 * _spacing,
        7 * _spacing,
        9 * _spacing,
        10 * _spacing,
        11 * _spacing,
        12 * _spacing,
        13 * _spacing,
        14 * _spacing,
        15 * _spacing,
    ])
    _rabi_rotations = np.array([
        np.pi,
        np.pi,
        np.pi,
        0.0,
        np.pi,
        np.pi,
        np.pi,
        np.pi,
        np.pi,
        np.pi,
        0,
        np.pi,
        np.pi,
        np.pi,
    ])
    _azimuthal_angles = np.array([
        0,
        np.pi / 2,
        0,
        0,
        0,
        np.pi / 2,
        0,
        0,
        np.pi / 2,
        0,
        0,
        0,
        np.pi / 2,
        0,
    ])
    _detuning_rotations = np.array(
        [0, 0, 0, np.pi, 0, 0, 0, 0, 0, 0, np.pi, 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_xy_concatenated_sequence(
        duration=duration,
        concatenation_order=concatenation_order,
        pre_post_rotation=True,
    )

    _offsets = np.insert(
        _offsets,
        [0, _offsets.shape[0]],
        [0, duration],
    )
    _rabi_rotations = np.insert(
        _rabi_rotations,
        [0, _rabi_rotations.shape[0]],
        [np.pi / 2, np.pi / 2],
    )
    _azimuthal_angles = np.insert(
        _azimuthal_angles,
        [0, _azimuthal_angles.shape[0]],
        [0, np.pi],
    )
    _detuning_rotations = np.insert(
        _detuning_rotations,
        [0, _detuning_rotations.shape[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)