def prop_unitarity_tester(n_pulses, pi_half_time): # create initial state ket [1,0,0,...,0] with length 2*n_pulses init_state = [1] for i in range(1, 2 * n_pulses): init_state.append(0) atoms = create_random_thermal_atoms(100, state_kets=init_state) intensity_profile = ais.IntensityProfile(1, 1) wf = ais.gen_wavefront(10) wave_vectors = ais.Wavevectors() for n_pulse in range(n_pulses): prop = ais.SpatialSuperpositionTransitionPropagator( 1, intensity_profile, n_pulses, n_pulse + 1, wave_vectors, wf=wf) matrices = prop._prop_matrix(atoms) for matrix in matrices: multiplied = np.matmul(matrix, np.conjugate(matrix.T)) np.testing.assert_almost_equal(multiplied, np.eye(2 * n_pulses))
def test_intensity_profile(): r_beam = 1 pos1 = np.array([[0, 0, 0]]) pos2 = np.array([[0, 1, 0]]) intensity_profile = ais.IntensityProfile(r_beam, 1) rabi1 = intensity_profile.get_rabi_freq(pos1) rabi2 = intensity_profile.get_rabi_freq(pos2) ratio = rabi2 / rabi1 # test that Rabi frequency has dropped to 1/e**2 of center value np.testing.assert_almost_equal(ratio[0], 1 / np.e**2)
def prop_time_reversal_tester(n_pulses, pi_half_time): # create initial state ket [1,0,0,...,0] with length 2*n_pulses init_state = [1] for i in range(1, 2 * n_pulses): init_state.append(0) atoms = create_random_thermal_atoms(100, state_kets=init_state) atoms0 = atoms # create Raman beam r_beam = 29.5e-3 / 2 # 1/e^2 beam radius in m wave_vectors = ais.Wavevectors(k1=8.052945514e6, k2=-8.052802263e6) center_rabi_freq = 2 * np.pi / 4 / pi_half_time intensity_profile = ais.IntensityProfile(r_beam, center_rabi_freq) for n_pulse in range(0, n_pulses): propagator = ais.SpatialSuperpositionTransitionPropagator( pi_half_time, intensity_profile, n_pulses, n_pulse + 1, wave_vectors) atoms = propagator.propagate(atoms) # check if trace is one for atomic ensembles density matrix np.testing.assert_array_almost_equal( np.trace(atoms.density_matrix), 1) # check if rho^2 = rho for pure states np.testing.assert_array_almost_equal( np.matmul(atoms.density_matrices, atoms.density_matrices), atoms.density_matrices) # check for time-reversibility (unitarity) for n_pulse in range(0, n_pulses): # change counting direction to descending, e.g. 3, 2, ... n_pulse = n_pulses - n_pulse propagator = ais.SpatialSuperpositionTransitionPropagator( -pi_half_time, intensity_profile, n_pulses, n_pulse, wave_vectors) atoms = propagator.propagate(atoms) # check if trace is one for atomic ensembles density matrix np.testing.assert_array_almost_equal( np.trace(atoms.density_matrix), 1) # check if rho^2 = rho for pure states np.testing.assert_array_almost_equal( np.matmul(atoms.density_matrices, atoms.density_matrices), atoms.density_matrices) # check if final state is initial state np.testing.assert_array_almost_equal(atoms0.density_matrices, atoms.density_matrices)
def test_two_level_transition_propagator(): pos_params = { 'mean_x': 1.0, 'std_x': 1.0, 'mean_y': 1.0, 'std_y': 1.0, 'mean_z': 1.0, 'std_z': 1.0, } vel_params = { 'mean_vx': 1.0, 'std_vx': ais.convert.vel_from_temp(3.0e-6), 'mean_vy': 1.0, 'std_vy': ais.convert.vel_from_temp(3.0e-6), 'mean_vz': 1.0, 'std_vz': ais.convert.vel_from_temp(0.2e-6), } atoms = ais.create_random_ensemble_from_gaussian_distribution(pos_params, vel_params, 100, seed=0) intensity_profile = ais.IntensityProfile(1, 1) wf = ais.gen_wavefront(10) wave_vectors = ais.Wavevectors() prop1 = ais.TwoLevelTransitionPropagator( time_delta=1, intensity_profile=intensity_profile) prop2 = ais.TwoLevelTransitionPropagator( time_delta=1, intensity_profile=intensity_profile, wf=wf, wave_vectors=wave_vectors, phase_scan=np.pi) matrices = prop1._prop_matrix(atoms) for prop in [prop1, prop2]: matrices = prop._prop_matrix(atoms) for matrix in matrices: np.testing.assert_almost_equal( np.matmul(matrix, np.conjugate(matrix.T)), np.eye(2))
def test_two_level_transition_propagator_unitarity(): atoms = create_random_thermal_atoms(100) intensity_profile = ais.IntensityProfile(1, 1) wf = ais.gen_wavefront(10) wave_vectors = ais.Wavevectors() prop1 = ais.TwoLevelTransitionPropagator( time_delta=1, intensity_profile=intensity_profile) prop2 = ais.TwoLevelTransitionPropagator( time_delta=1, intensity_profile=intensity_profile, wf=wf, wave_vectors=wave_vectors, phase_scan=np.pi) matrices = prop1._prop_matrix(atoms) for prop in [prop1, prop2]: matrices = prop._prop_matrix(atoms) for matrix in matrices: np.testing.assert_almost_equal( np.matmul(matrix, np.conjugate(matrix.T)), np.eye(2))