コード例 #1
0
def check_json_roundtrip(ensemble):
    ensemble2 = coldatoms.json_to_ensemble(
        coldatoms.ensemble_to_json(ensemble))
    assert (arrays_close(ensemble.x, ensemble2.x))
    assert (arrays_close(ensemble.v, ensemble2.v))
    assert (set(ensemble.ensemble_properties.keys()) == set(
        ensemble2.ensemble_properties.keys()))
    for k in ensemble.ensemble_properties.keys():
        assert (np.abs(ensemble.ensemble_properties[k] -
                       ensemble2.ensemble_properties[k]) < 1.0e-12)
    assert (set(ensemble.particle_properties.keys()) == set(
        ensemble2.particle_properties.keys()))
    for k in ensemble.particle_properties.keys():
        assert (ensemble.particle_properties[k].shape ==
                ensemble2.particle_properties[k].shape)
        assert (arrays_close(ensemble.particle_properties[k],
                             ensemble2.particle_properties[k]))
コード例 #2
0
                                                Vwall=v_wall,
                                                frot=1.0e-3 * frot)
mode_analysis.run()
trap_potential = TrapPotential(2.0 * mode_analysis.Coeff[2], mode_analysis.Cw,
                               mode_analysis.wrot, np.pi / 2.0)

forces = [coulomb_force, trap_potential]


def evolve_ensemble(dt, t_max, ensemble, Bz, forces):
    num_steps = int(t_max / dt)
    coldatoms.bend_kick(dt, Bz, ensemble, forces, num_steps=num_steps)
    coldatoms.bend_kick(t_max - dt * num_steps, Bz, ensemble, forces)


initial_state = coldatoms.json_to_ensemble(
    open('initial_state_180kHz.txt').read())

# Now specify the cooling laser configuration
amu = 1.66057e-27
m_Be = 9.012182 * amu
initial_state.ensemble_properties['mass'] = m_Be
wavelength = 313.0e-9
k = 2.0 * np.pi / wavelength
gamma = 2.0 * np.pi * 18.0e6
hbar = 1.0e-34
sigma = 3.0e-5
axial_S0 = 0.1
in_plane_S0 = 0.1


class UniformBeam(object):
コード例 #3
0
import visualization
import coldatoms
import matplotlib.pyplot as plt

ensemble = coldatoms.json_to_ensemble(open('initial_state_180kHz.txt').read())
ref_solution = coldatoms.json_to_ensemble(
    open('reference_solution_180kHz.txt').read())
plt.clf()
visualization.top_view(ensemble.x[:, 0], ensemble.x[:, 1])
visualization.top_view(ref_solution.x[:, 0], ref_solution.x[:, 1], 'ro')
plt.savefig('initial_state_top_view.pdf')