def __init__(self,
                 N=127,
                 Vtrap=(0., -1750., -2000.),
                 Vwall=5.,
                 frot=180.,
                 B=4.4588):
        """
        Assumes many of the following parameters, each set as default in Freericks/
        Meiser codes.  Can be adjusted in later methods.
        """

        self.Nion = N
        self.Vtrap = Vtrap
        self.Vwall = Vwall
        self.frot = frot
        self.mode_analysis = mode_analysis_code.ModeAnalysis(N=self.Nion,
                                                             Vtrap=self.Vtrap,
                                                             Vwall=self.Vwall,
                                                             frot=self.frot)
        self.omega = omega
        self.trap_potential = coldatoms.HarmonicTrapPotential(
            self.kx, self.ky, self.kz)

    def reset_phase(self):
        self.phi = self.phi_0

    def force(self, dt, ensemble, f):
        self.phi += self.omega * 0.5 * dt
        self.trap_potential.phi = self.phi
        self.trap_potential.force(dt, ensemble, f)
        self.phi += self.omega * 0.5 * dt


mode_analysis = mode_analysis_code.ModeAnalysis(N=num_ions,
                                                Vtrap=(0.0, -1750.0, -1970.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(
示例#3
0

# From coldatoms lib, create a function to evolve the crystal


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 - num_steps * dt, Bz, ensemble, forces)


##############################################################
############### INSTANTIATE CRYSTAL & TRAP ###################

mode_analysis = mode_analysis_code.ModeAnalysis(N=127,
                                                Vtrap=(0.0, -1750.0, -2000.0),
                                                Vwall=5.0,
                                                frot=180.0)

mode_analysis.run()

trap_potential = TrapPotential(2.0 * mode_analysis.Coeff[2], mode_analysis.Cw,
                               mode_analysis.wrot, np.pi / 2.0)

##############################################################
####################### EVOLUTION  ###########################

x = mode_analysis.u[:mode_analysis.Nion]
y = mode_analysis.u[mode_analysis.Nion:]

dx = x.reshape((x.size, 1)) - x
dy = y.reshape((y.size, 1)) - y
示例#4
0
    'text.latex.preamble': [r'\usepackage{siunitx}', r'\usepackage{amsmath}'],
    'xtick.labelsize': 'medium',
    'ytick.labelsize': 'medium',
    'axes.labelsize': 'medium'
}
plt.rcParams.update(params)

line_width = 246.0 / 72.0
default_width = 0.95 * line_width
golden_ratio = 1.61803398875
default_height = default_width / golden_ratio

# Preparation for computation of frequency sweep

mode_analysis = mode_analysis_code.ModeAnalysis(N=127,
                                                Vtrap=(0.0, -1750.0, -1970.0),
                                                Vwall=1.0,
                                                frot=185.0)
mode_analysis.run()


def create_ensemble(uE, omega_z, mass, charge):
    num_ions = int(uE.size / 2)
    x = uE[:num_ions]
    y = uE[num_ions:]
    r = np.sqrt(x**2 + y**2)
    r_hat = np.transpose(np.array([x / r, y / r]))
    phi_hat = np.transpose(np.array([-y / r, x / r]))
    v = np.zeros([num_ions, 2], dtype=np.float64)
    for i in range(num_ions):
        v[i, 0] = omega_z * r[i] * phi_hat[i, 0]
        v[i, 1] = omega_z * r[i] * phi_hat[i, 1]
示例#5
0
import matplotlib.pyplot as plt
import matplotlib.lines
import numpy as np
import scipy.signal
import scipy.optimize
import mode_analysis_code
import argparse

plt.style.use('ggplot')
mode_analysis = mode_analysis_code.ModeAnalysis()
nu_z = np.sqrt(2 * mode_analysis.q * mode_analysis.Coeff[2] /
               mode_analysis.m_Be) / (2 * np.pi)


def lorentzian(x, A, FWHM, x0):  #(x, height, FWHM, x0):
    p = (x0 - x) / (FWHM / 2)
    L = A / (1 + p**2)
    #    A = np.pi * FWHM * height / 2
    #    L = (A / np.pi) * (0.5 * FWHM / ((x - x0)**2 + (0.5 * FWHM)**2))
    return L


def double_lorentzian(x, A, FWHM_A, x0_A, B, FWHM_B, x0_B, C):
    pA = (x0_A - x) / (FWHM_A / 2)
    pB = (x0_B - x) / (FWHM_B / 2)
    L = C * (A / (1 + pA**2) + B / (1 + pB**2))
    return L


def report_values(value, error):
    a = int(np.floor(np.log10(np.abs(error))))