def test_spin_echo_sequence(): """ Test the spin echo sequence. """ duration = 10.0 sequence = new_spin_echo_sequence(duration=duration) _offsets = np.array([duration / 2.0]) _rabi_rotations = np.array([np.pi]) _azimuthal_angles = np.array([0]) _detuning_rotations = np.array([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_spin_echo_sequence(duration=duration, pre_post_rotation=True) _offsets = np.array([0, duration / 2.0, duration]) _rabi_rotations = np.array([np.pi / 2, np.pi, np.pi / 2]) _azimuthal_angles = np.array([0, 0, 0]) _detuning_rotations = np.array([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)
def test_if_spin_echo_sequence_is_identity(): """ Tests if the product of the pulses in a Spin Echo sequence with pre/post pi/2-pulses is an identity. """ spin_echo_sequence = new_spin_echo_sequence(duration=10.0, pre_post_rotation=True) assert _pulses_produce_identity(spin_echo_sequence)