def test_x_concatenated_sequence(): """ Tests the X-concatenated sequence. """ duration = 10.0 concatenation_order = 3 sequence = new_x_concatenated_sequence( duration=duration, concatenation_order=concatenation_order, ) _spacing = duration / (2**concatenation_order) _offsets = [ _spacing, 3 * _spacing, 4 * _spacing, 5 * _spacing, 7 * _spacing ] _offsets = np.array(_offsets) _rabi_rotations = np.pi * np.ones(_offsets.shape) _azimuthal_angles = np.zeros(_offsets.shape) _detuning_rotations = np.zeros(_offsets.shape) 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_x_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.zeros(_offsets.shape) _detuning_rotations = np.zeros(_offsets.shape) 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)
def test_if_x_concatenated_sequence_is_identity(): """ Tests if the product of the pulses in an X concatenated sequence with pre/post pi/2-pulses is an identity. """ x_concat_sequence = new_x_concatenated_sequence( duration=10.0, concatenation_order=4, pre_post_rotation=True, ) assert _pulses_produce_identity(x_concat_sequence)