From 69ba21b1e6794912e95508cf46369e1c7c22d605 Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Mon, 27 Feb 2023 20:25:07 +0100 Subject: [PATCH] Included code snippet to investigate the origin of the deviation of alphas and verified if the potential for the full crossed dipole trap is correct. --- calculateDipoleTrapPotential.py | 271 +++++++++++++++++++++----------- 1 file changed, 180 insertions(+), 91 deletions(-) diff --git a/calculateDipoleTrapPotential.py b/calculateDipoleTrapPotential.py index 344753c..7d29bb7 100644 --- a/calculateDipoleTrapPotential.py +++ b/calculateDipoleTrapPotential.py @@ -198,20 +198,20 @@ def convert_modulation_depth_to_alpha(modulation_depth): fin_mod_dep = [0, 0.5, 0.3, 0.7, 0.9, 0.8, 1.0, 0.6, 0.4, 0.2, 0.1] fx = [3.135, 0.28, 0.690, 0.152, 0.102, 0.127, 0.099, 0.205, 0.404, 1.441, 2.813] dfx = [0.016, 0.006, 0.005, 0.006, 0.003, 0.002, 0.002,0.002, 0.003, 0.006, 0.024] - fy = [2.746, 1.278, 1.719, 1.058, 0.923, 0.994, 0.911, 1.157, 1.446, 2.191, 2.643] - dfy = [0.014, 0.007, 0.009, 0.007, 0.005, 0.004, 0.004, 0.005, 0.007, 0.009, 0.033] + fz = [2.746, 1.278, 1.719, 1.058, 0.923, 0.994, 0.911, 1.157, 1.446, 2.191, 2.643] + dfz = [0.014, 0.007, 0.009, 0.007, 0.005, 0.004, 0.004, 0.005, 0.007, 0.009, 0.033] alpha_x = [(fx[0]/x)**(2/3) for x in fx] dalpha_x = [alpha_x[i] * np.sqrt((dfx[0]/fx[0])**2 + (dfx[i]/fx[i])**2) for i in range(len(fx))] - alpha_y = [(fy[0]/y)**2 for y in fy] - dalpha_y = [alpha_y[i] * np.sqrt((dfy[0]/fy[0])**2 + (dfy[i]/fy[i])**2) for i in range(len(fy))] + alpha_z = [(fz[0]/z)**2 for z in fz] + dalpha_z = [alpha_z[i] * np.sqrt((dfz[0]/fz[0])**2 + (dfz[i]/fz[i])**2) for i in range(len(fz))] - avg_alpha = [(g + h) / 2 for g, h in zip(alpha_x, alpha_y)] + avg_alpha = [(g + h) / 2 for g, h in zip(alpha_x, alpha_z)] sorted_fin_mod_dep, sorted_avg_alpha = zip(*sorted(zip(fin_mod_dep, avg_alpha))) f = interpolate.interp1d(sorted_fin_mod_dep, sorted_avg_alpha) - return f(modulation_depth), fin_mod_dep, alpha_x, alpha_y, dalpha_x, dalpha_y + return f(modulation_depth), fin_mod_dep, alpha_x, alpha_z, dalpha_x, dalpha_z def convert_modulation_depth_to_temperature(modulation_depth): fin_mod_dep = [1.0, 0.8, 0.6, 0.4, 0.2, 0.0, 0.9, 0.7, 0.5, 0.3, 0.1] @@ -231,22 +231,22 @@ def convert_modulation_depth_to_temperature(modulation_depth): # POTENTIALS # ##################################################################### -def gravitational_potential(positions: "np.ndarray|u.quantity.Quantity", m:"float|u.quantity.Quantity"): +def gravitational_potential(positions, m): return m * ac.g0 * positions -def single_gaussian_beam_potential(positions: "np.ndarray|u.quantity.Quantity", waists: "np.ndarray|u.quantity.Quantity", alpha:"float|u.quantity.Quantity", P:"float|u.quantity.Quantity"=1, wavelength:"float|u.quantity.Quantity"=1.064*u.um)->np.ndarray: +def single_gaussian_beam_potential(positions, waists, alpha, P=1, wavelength=1.064*u.um): A = 2*P/(np.pi*w(positions[1,:], waists[0], wavelength)*w(positions[1,:], waists[1], wavelength)) U_tilde = (1 / (2 * ac.eps0 * ac.c)) * alpha * (4 * np.pi * ac.eps0 * ac.a0**3) U = - U_tilde * A * np.exp(-2 * ((positions[0,:]/w(positions[1,:], waists[0], wavelength))**2 + (positions[2,:]/w(positions[1,:], waists[1], wavelength))**2)) return U -def astigmatic_single_gaussian_beam_potential(positions: "np.ndarray|u.quantity.Quantity", waists: "np.ndarray|u.quantity.Quantity", del_y:"float|u.quantity.Quantity", alpha:"float|u.quantity.Quantity", P:"float|u.quantity.Quantity"=1, wavelength:"float|u.quantity.Quantity"=1.064*u.um)->np.ndarray: +def astigmatic_single_gaussian_beam_potential(positions, waists, del_y, alpha, P=1, wavelength=1.064*u.um): A = 2*P/(np.pi*w(positions[1,:] - (del_y/2), waists[0], wavelength)*w(positions[1,:] + (del_y/2), waists[1], wavelength)) U_tilde = (1 / (2 * ac.eps0 * ac.c)) * alpha * (4 * np.pi * ac.eps0 * ac.a0**3) U = - U_tilde * A * np.exp(-2 * ((positions[0,:]/w(positions[1,:] - (del_y/2), waists[0], wavelength))**2 + (positions[2,:]/w(positions[1,:] + (del_y/2), waists[1], wavelength))**2)) return U -def modulated_single_gaussian_beam_potential(positions: "np.ndarray|u.quantity.Quantity", waists: "np.ndarray|u.quantity.Quantity", alpha:"float|u.quantity.Quantity", P:"float|u.quantity.Quantity"=1, wavelength:"float|u.quantity.Quantity"=1.064*u.um, mod_amp:"float|u.quantity.Quantity"=1)->np.ndarray: +def modulated_single_gaussian_beam_potential(positions, waists, alpha, P=1, wavelength=1.064*u.um, mod_amp=1): mod_amp = mod_amp * waists[0] n_points = len(positions[0,:]) dx, x_mod = modulation_function(mod_amp, n_points, func = 'arccos') @@ -287,7 +287,7 @@ def crossed_beam_potential(positions, theta, waists, P, alpha, wavelength=1.064* # COMPUTE/EXTRACT TRAP POTENTIAL AND PARAMETERS # ##################################################################### -def trap_depth(w_1:"float|u.quantity.Quantity", w_2:"float|u.quantity.Quantity", P:"float|u.quantity.Quantity", alpha:float)->"float|u.quantity.Quantity": +def trap_depth(w_1, w_2, P, alpha): return 2*P/(np.pi*w_1*w_2) * (1 / (2 * ac.eps0 * ac.c)) * alpha * (4 * np.pi * ac.eps0 * ac.a0**3) def calculateTrapFrequency(w_x, w_z, Power, Polarizability, m = 164*u.u, dir = 'x'): @@ -306,11 +306,11 @@ def extractTrapFrequency(Positions, TrappingPotential, axis): tmp_pos = Positions[axis, :] tmp_pot = TrappingPotential[axis] center_idx = np.argmin(tmp_pot) - lb = int(round(center_idx - len(tmp_pot)/150, 1)) - ub = int(round(center_idx + len(tmp_pot)/150, 1)) + lb = int(round(center_idx - len(tmp_pot)/500, 1)) + ub = int(round(center_idx + len(tmp_pot)/500, 1)) xdata = tmp_pos[lb:ub] Potential = tmp_pot[lb:ub] - p0=[1e3, tmp_pos[center_idx].value, np.argmin(tmp_pot.value)] + p0=[1e3, tmp_pos[center_idx].value, -100] popt, pcov = curve_fit(harmonic_potential, xdata, Potential, p0) v = popt[0] dv = pcov[0][0]**0.5 @@ -348,9 +348,9 @@ def computeTrapPotential(w_x, w_z, Power, Polarizability, options): else: projection_axis = np.array([1, 1, 1]) # vertical direction (Z-axis) - x_Positions = np.arange(-extent, extent, 1)*u.um - y_Positions = np.arange(-extent, extent, 1)*u.um - z_Positions = np.arange(-extent, extent, 1)*u.um + x_Positions = np.arange(-extent, extent, 0.05)*u.um + y_Positions = np.arange(-extent, extent, 0.05)*u.um + z_Positions = np.arange(-extent, extent, 0.05)*u.um Positions = np.vstack((x_Positions, y_Positions, z_Positions)) * projection_axis[:, np.newaxis] if not crossed: @@ -359,7 +359,7 @@ def computeTrapPotential(w_x, w_z, Power, Polarizability, options): IdealTrappingPotential = (IdealTrappingPotential/ac.k_B).to(u.uK) else: - theta = options['theta'] + theta = options['delta'] waists = np.vstack((np.asarray([w_x[0].value, w_z[0].value])*u.um, np.asarray([w_x[1].value, w_z[1].value])*u.um)) IdealTrappingPotential = crossed_beam_potential(Positions, theta, waists, P = Power, alpha = Polarizability) IdealTrappingPotential = IdealTrappingPotential * (np.ones((3, len(IdealTrappingPotential))) * projection_axis[:, np.newaxis]) @@ -430,7 +430,7 @@ def computeTrapPotential(w_x, w_z, Power, Polarizability, options): return Positions, IdealTrappingPotential, TrappingPotential, TrapDepthsInKelvin, CalculatedTrapFrequencies, ExtractedTrapFrequencies else: - return TrappingPotential + return Positions, TrappingPotential def extractWaist(Positions, TrappingPotential): tmp_pos = Positions.value @@ -671,13 +671,14 @@ def plotAlphas(): Alphas, fin_mod_dep, alpha_x, alpha_y, dalpha_x, dalpha_y = convert_modulation_depth_to_alpha(modulation_depth) plt.figure() - plt.errorbar(fin_mod_dep, alpha_x, yerr = dalpha_x, fmt= 'ob', markersize=5, capsize=5) - plt.errorbar(fin_mod_dep, alpha_y, yerr = dalpha_y, fmt= 'or', markersize=5, capsize=5) + plt.errorbar(fin_mod_dep, alpha_x, yerr = dalpha_x, fmt= 'ob', label = 'From Horz TF', markersize=5, capsize=5) + plt.errorbar(fin_mod_dep, alpha_y, yerr = dalpha_y, fmt= 'or', label = 'From Vert TF', markersize=5, capsize=5) plt.plot(modulation_depth, Alphas, '--g') plt.xlabel('Modulation depth', fontsize= 12, fontweight='bold') plt.ylabel('$\\alpha$', fontsize= 12, fontweight='bold') plt.tight_layout() plt.grid(visible=1) + plt.legend(prop={'size': 12, 'weight': 'bold'}) plt.show() def plotTemperatures(w_x, w_z, plot_against_mod_depth = True): @@ -690,13 +691,13 @@ def plotTemperatures(w_x, w_z, plot_against_mod_depth = True): plt.figure() if plot_against_mod_depth: - plt.errorbar(fin_mod_dep, T_x, yerr = dT_x, fmt= 'ob', markersize=5, capsize=5) - plt.errorbar(fin_mod_dep, T_y, yerr = dT_y, fmt= 'or', markersize=5, capsize=5) + plt.errorbar(fin_mod_dep, T_x, yerr = dT_x, fmt= 'ob', label = 'Horz direction', markersize=5, capsize=5) + plt.errorbar(fin_mod_dep, T_y, yerr = dT_y, fmt= 'or', label = 'Vert direction', markersize=5, capsize=5) plt.plot(modulation_depth, Temperatures, '--g') xlabel = 'Modulation depth' else: - plt.errorbar(measured_aspect_ratio, T_x, yerr = dT_x, fmt= 'ob', markersize=5, capsize=5) - plt.errorbar(measured_aspect_ratio, T_y, yerr = dT_y, fmt= 'or', markersize=5, capsize=5) + plt.errorbar(measured_aspect_ratio, T_x, yerr = dT_x, fmt= 'ob', label = 'Horz direction', markersize=5, capsize=5) + plt.errorbar(measured_aspect_ratio, T_y, yerr = dT_y, fmt= 'or', label = 'Vert direction', markersize=5, capsize=5) plt.plot(new_aspect_ratio, Temperatures, '--g') xlabel = 'Aspect Ratio' @@ -704,29 +705,30 @@ def plotTemperatures(w_x, w_z, plot_against_mod_depth = True): plt.ylabel('Temperature (uK)', fontsize= 12, fontweight='bold') plt.tight_layout() plt.grid(visible=1) + plt.legend(prop={'size': 12, 'weight': 'bold'}) plt.show() def plotTrapFrequencies(v_x, v_y, v_z, modulation_depth, new_aspect_ratio, plot_against_mod_depth = True): fig, ax3 = plt.subplots(figsize=(8, 6)) if plot_against_mod_depth: - ln1 = ax3.plot(modulation_depth, v_x, '-ob', label = 'v_x') + ln1 = ax3.plot(modulation_depth, v_x, '-or', label = 'v_x') ln2 = ax3.plot(modulation_depth, v_z, '-^b', label = 'v_z') ax4 = ax3.twinx() - ln3 = ax4.plot(modulation_depth, v_y, '-*r', label = 'v_y') + ln3 = ax4.plot(modulation_depth, v_y, '-*g', label = 'v_y') xlabel = 'Modulation depth' else: - ln1 = ax3.plot(new_aspect_ratio, v_x, '-ob', label = 'v_x') + ln1 = ax3.plot(new_aspect_ratio, v_x, '-or', label = 'v_x') ln2 = ax3.plot(new_aspect_ratio, v_z, '-^b', label = 'v_z') ax4 = ax3.twinx() - ln3 = ax4.plot(new_aspect_ratio, v_y, '-*r', label = 'v_y') + ln3 = ax4.plot(new_aspect_ratio, v_y, '-*g', label = 'v_y') xlabel = 'Aspect Ratio' ax3.set_xlabel(xlabel, fontsize= 12, fontweight='bold') ax3.set_ylabel('Trap Frequency (Hz)', fontsize= 12, fontweight='bold') ax3.tick_params(axis="y", labelcolor='b') ax4.set_ylabel('Trap Frequency (Hz)', fontsize= 12, fontweight='bold') - ax4.tick_params(axis="y", labelcolor='r') + ax4.tick_params(axis="y", labelcolor='g') plt.tight_layout() plt.grid(visible=1) lns = ln1+ln2+ln3 @@ -764,10 +766,10 @@ def plotMeasuredTrapFrequencies(w_x, w_z, plot_against_mod_depth = True): ax1.set_ylabel('Trap Frequency (kHz)', fontsize= 12, fontweight='bold') ax1.tick_params(axis="y", labelcolor='b') ax2.set_ylabel('Trap Frequency (Hz)', fontsize= 12, fontweight='bold') - ax2.tick_params(axis="y", labelcolor='r') + ax2.tick_params(axis="y", labelcolor='g') h1, l1 = ax1.get_legend_handles_labels() h2, l2 = ax2.get_legend_handles_labels() - ax1.legend(h1+h2, l1+l2, loc=0) + ax1.legend(h1+h2, l1+l2, loc=0, prop={'size': 12, 'weight': 'bold'}) else: plt.figure() plt.errorbar(new_aspect_ratio, fx, yerr = dfx, fmt= 'or', label = 'v_x', markersize=5, capsize=5) @@ -821,8 +823,8 @@ def plotRatioOfTrapFrequencies(plot_against_mod_depth = True): plt.legend(prop={'size': 12, 'weight': 'bold'}) plt.show() -def plotScatteringLengths(): - BField = np.arange(0, 2.59, 1e-3) * u.G +def plotScatteringLengths(B_range = [0, 2.59]): + BField = np.arange(B_range[0], B_range[1], 1e-3) * u.G a_s_array = np.zeros(len(BField)) * ac.a0 for idx in range(len(BField)): a_s_array[idx], a_bkg = scatteringLength(BField[idx]) @@ -872,30 +874,30 @@ def plotCollisionRatesAndPSD(Gamma_elastic, PSD, modulation_depth, new_aspect_ra if __name__ == '__main__': - Power = 40*u.W - Polarizability = 184.4 # in a.u, most precise measured value of Dy polarizability - Wavelength = 1.064*u.um - w_x, w_z = 27.5*u.um, 33.8*u.um # Beam Waists in the x and y directions + # Power = 40*u.W + # Polarizability = 184.4 # in a.u, most precise measured value of Dy polarizability + # Wavelength = 1.064*u.um + # w_x, w_z = 27.5*u.um, 33.8*u.um # Beam Waists in the x and y directions # Power = 11*u.W # Polarizability = 184.4 # in a.u, most precise measured value of Dy polarizability # w_x, w_z = 54.0*u.um, 54.0*u.um # Beam Waists in the x and y directions - - # options = { - # 'axis': 0, # axis referenced to the beam along which you want the dipole trap potential - # 'extent': 3e2, # range of spatial coordinates in one direction to calculate trap potential over - # 'crossed': False, - # 'theta': 0, - # 'modulation': True, - # 'aspect_ratio': 3.67, - # 'gravity': False, - # 'tilt_gravity': False, - # 'theta': 5, # in degrees - # 'tilt_axis': [1, 0, 0], # lab space coordinates are rotated about x-axis in reference frame of beam - # 'astigmatism': False, - # 'disp_foci': 3 * z_R(w_0 = np.asarray([30]), lamb = 1.064)[0]*u.um # difference in position of the foci along the propagation direction (Astigmatism) - # } - + """ + options = { + 'axis': 2, # axis referenced to the beam along which you want the dipole trap potential + 'extent': 3e2, # range of spatial coordinates in one direction to calculate trap potential over + 'crossed': False, + 'theta': 0, + 'modulation': True, + 'aspect_ratio': 1, + 'gravity': True, + 'tilt_gravity': True, + 'theta': 0.5, # in degrees + 'tilt_axis': [1, 0, 0], # lab space coordinates are rotated about x-axis in reference frame of beam + 'astigmatism': True, + 'disp_foci': 0.9 * z_R(w_0 = np.asarray([30]), lamb = 1.064)[0]*u.um # difference in position of the foci along the propagation direction (Astigmatism) + } + """ """Plot ideal trap potential resulting for given parameters only""" # ComputedPotentials = [] # Params = [] @@ -979,15 +981,15 @@ if __name__ == '__main__': """Calculate relevant parameters for evaporative cooling for different modulation depths, temperatures""" - AtomNumber = 1.00 * 1e7 - BField = 1.4 * u.G - # modulation_depth = np.arange(0, 1.0, 0.02) + # AtomNumber = 1.00 * 1e7 + # BField = 1.4 * u.G + # modulation_depth = np.arange(0, 1.0, 0.08) # w_xs = w_x * convert_modulation_depth_to_alpha(modulation_depth)[0] # new_aspect_ratio = w_xs / w_z # Temperatures = convert_modulation_depth_to_temperature(modulation_depth)[0] * u.uK - plot_against_mod_depth = True + # plot_against_mod_depth = True # # n = np.zeros(len(modulation_depth)) # Gamma_elastic = np.zeros(len(modulation_depth)) @@ -1019,11 +1021,11 @@ if __name__ == '__main__': # plotMeasuredTrapFrequencies(w_x, w_z, plot_against_mod_depth = plot_against_mod_depth) - plotRatioOfTrapFrequencies(plot_against_mod_depth = plot_against_mod_depth) + # plotRatioOfTrapFrequencies(plot_against_mod_depth = plot_against_mod_depth) """Plot Feshbach Resonances""" - # plotScatteringLengths() + # plotScatteringLengths(B_range = [0, 3.6]) """Plot Collision Rates and PSD""" @@ -1031,43 +1033,129 @@ if __name__ == '__main__': """Plot Collision Rates and PSD from only measured trap frequencies""" - pd, dpd, T, dT, new_aspect_ratio, modulation_depth = particleDensity(w_x, w_z, Power, Polarizability, AtomNumber, 0, m = 164*u.u, use_measured_tf = True) + # pd, dpd, T, dT, new_aspect_ratio, modulation_depth = particleDensity(w_x, w_z, Power, Polarizability, AtomNumber, 0, m = 164*u.u, use_measured_tf = True) - Gamma_elastic = [(pd[i] * scatteringCrossSection(BField) * meanThermalVelocity(T[i]) / (2 * np.sqrt(2))).decompose() for i in range(len(pd))] - Gamma_elastic_values = [(Gamma_elastic[i]).value for i in range(len(Gamma_elastic))] - dGamma_elastic = [(Gamma_elastic[i] * ((dpd[i]/pd[i]) + (dT[i]/(2*T[i])))).decompose() for i in range(len(Gamma_elastic))] - dGamma_elastic_values = [(dGamma_elastic[i]).value for i in range(len(dGamma_elastic))] + # Gamma_elastic = [(pd[i] * scatteringCrossSection(BField) * meanThermalVelocity(T[i]) / (2 * np.sqrt(2))).decompose() for i in range(len(pd))] + # Gamma_elastic_values = [(Gamma_elastic[i]).value for i in range(len(Gamma_elastic))] + # dGamma_elastic = [(Gamma_elastic[i] * ((dpd[i]/pd[i]) + (dT[i]/(2*T[i])))).decompose() for i in range(len(Gamma_elastic))] + # dGamma_elastic_values = [(dGamma_elastic[i]).value for i in range(len(dGamma_elastic))] - PSD = [((pd[i] * thermaldeBroglieWavelength(T[i])**3).decompose()).value for i in range(len(pd))] - dPSD = [((PSD[i] * ((dpd[i]/pd[i]) - (1.5 * dT[i]/T[i]))).decompose()).value for i in range(len(Gamma_elastic))] + # PSD = [((pd[i] * thermaldeBroglieWavelength(T[i])**3).decompose()).value for i in range(len(pd))] + # dPSD = [((PSD[i] * ((dpd[i]/pd[i]) - (1.5 * dT[i]/T[i]))).decompose()).value for i in range(len(Gamma_elastic))] - fig, ax1 = plt.subplots(figsize=(8, 6)) - ax2 = ax1.twinx() - ax1.errorbar(modulation_depth, Gamma_elastic_values, yerr = dGamma_elastic_values, fmt = 'ob', markersize=5, capsize=5) - ax2.errorbar(modulation_depth, PSD, yerr = dPSD, fmt = '-^r', markersize=5, capsize=5) - ax2.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.1e')) - ax1.set_xlabel('Modulation depth', fontsize= 12, fontweight='bold') - ax1.set_ylabel('Elastic Collision Rate (' + str(Gamma_elastic[0].unit) + ')', fontsize= 12, fontweight='bold') - ax1.tick_params(axis="y", labelcolor='b') - ax2.set_ylabel('Phase Space Density', fontsize= 12, fontweight='bold') - ax2.tick_params(axis="y", labelcolor='r') + # fig, ax1 = plt.subplots(figsize=(8, 6)) + # ax2 = ax1.twinx() + # ax1.errorbar(modulation_depth, Gamma_elastic_values, yerr = dGamma_elastic_values, fmt = 'ob', markersize=5, capsize=5) + # ax2.errorbar(modulation_depth, PSD, yerr = dPSD, fmt = '-^r', markersize=5, capsize=5) + # ax2.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.1e')) + # ax1.set_xlabel('Modulation depth', fontsize= 12, fontweight='bold') + # ax1.set_ylabel('Elastic Collision Rate (' + str(Gamma_elastic[0].unit) + ')', fontsize= 12, fontweight='bold') + # ax1.tick_params(axis="y", labelcolor='b') + # ax2.set_ylabel('Phase Space Density', fontsize= 12, fontweight='bold') + # ax2.tick_params(axis="y", labelcolor='r') + # plt.tight_layout() + # plt.grid(visible=1) + # plt.show() + + """ Investigate deviation in alpha""" + + Power = 40*u.W + Polarizability = 184.4 # in a.u, most precise measured value of Dy polarizability + Wavelength = 1.064*u.um + w_x, w_z = 27.5*u.um, 33.8*u.um + + options = { + 'axis': 0, # axis referenced to the beam along which you want the dipole trap potential + 'extent': 3e2, # range of spatial coordinates in one direction to calculate trap potential over + 'crossed': False, + 'theta': 0, + 'modulation': False, + 'gravity': True, + 'tilt_gravity': True, + 'theta': 10, # in degrees + 'tilt_axis': [1, 0, 0], # lab space coordinates are rotated about x-axis in reference frame of beam + 'astigmatism': True, + 'disp_foci': 0.9 * z_R(w_0 = np.asarray([30]), lamb = 1.064)[0]*u.um # difference in position of the foci along the propagation direction (Astigmatism) + } + + modulation_depth = np.arange(0, 1.1, 0.1) + Alphas, fin_mod_dep, meas_alpha_x, meas_alpha_z, dalpha_x, dalpha_z = convert_modulation_depth_to_alpha(modulation_depth) + meas_alpha_deviation = [(g - h) for g, h in zip(meas_alpha_x, meas_alpha_z)] + sorted_fin_mod_dep, sorted_meas_alpha_deviation = zip(*sorted(zip(fin_mod_dep, meas_alpha_deviation))) + avg_alpha = [(g + h) / 2 for g, h in zip(meas_alpha_x, meas_alpha_z)] + sorted_fin_mod_dep, new_aspect_ratio = zip(*sorted(zip(fin_mod_dep, (w_x * avg_alpha) / w_z))) + + current_ar = w_x/w_z + aspect_ratio = np.arange(current_ar, 10*current_ar, 0.8) + w_x = w_x * (aspect_ratio / current_ar) + + v_x = np.zeros(len(w_x)) + #v_y = np.zeros(len(w_x)) + v_z = np.zeros(len(w_x)) + + for i in range(len(w_x)): + options['axis'] = 0 + ExtractedTrapFrequencies = computeTrapPotential(w_x[i], w_z, Power, Polarizability, options)[5] + tmp = ExtractedTrapFrequencies[1][0] + v_x[i] = tmp if not np.isinf(tmp) else np.nan + #options['axis'] = 1 + #ExtractedTrapFrequencies = computeTrapPotential(w_x[i], w_z, Power, Polarizability, options)[5] + #tmp = ExtractedTrapFrequencies[1][0] + #v_y[i] = tmp if not np.isinf(tmp) else np.nan + options['axis'] = 2 + ExtractedTrapFrequencies = computeTrapPotential(w_x[i], w_z, Power, Polarizability, options)[5] + tmp = ExtractedTrapFrequencies[1][0] + v_z[i] = tmp if not np.isinf(tmp) else np.nan + + #v_x[i] = calculateTrapFrequency(w_x[i], w_z, Power, Polarizability, dir = 'x').value + #v_y[i] = calculateTrapFrequency(w_x[i], w_z, Power, Polarizability, dir = 'y').value + #v_z[i] = calculateTrapFrequency(w_x[i], w_z, Power, Polarizability, dir = 'z').value + + alpha_x = [(v_x[0]/v)**(2/3) for v in v_x] + alpha_z = [(v_z[0]/v)**2 for v in v_z] + + calc_alpha_deviation = [(g - h) for g, h in zip(alpha_x, alpha_z)] + + plt.figure() + plt.plot(aspect_ratio, alpha_x, '-o', label = 'From horz TF') + plt.plot(aspect_ratio, alpha_z, '-^', label = 'From vert TF') + plt.xlabel('Aspect Ratio', fontsize= 12, fontweight='bold') + plt.ylabel('$\\alpha$', fontsize= 12, fontweight='bold') plt.tight_layout() plt.grid(visible=1) + plt.legend(prop={'size': 12, 'weight': 'bold'}) + plt.show() + + plt.figure() + plt.plot(aspect_ratio, calc_alpha_deviation, '--ob', label = 'Extracted') + plt.plot(new_aspect_ratio, sorted_meas_alpha_deviation, '-or', label = 'Measured') + plt.xlabel('Aspect Ratio', fontsize= 12, fontweight='bold') + plt.ylabel('$\\Delta \\alpha$', fontsize= 12, fontweight='bold') + plt.ylim([-0.5, 1]) + plt.tight_layout() + plt.grid(visible=1) + plt.legend(prop={'size': 12, 'weight': 'bold'}) plt.show() """Plot ideal crossed beam trap potential resulting for given parameters only""" - # Powers = [40, 11] * u.W + # Powers = [40, 10] * u.W # Polarizability = 184.4 # in a.u, most precise measured value of Dy polarizability # Wavelength = 1.064*u.um # w_x = [27.5, 54]*u.um # Beam Waists in the x direction # w_z = [33.8, 54]*u.um # Beam Waists in the y direction + + # Powers = [30, 8] * u.W + # Polarizability = 136 # in a.u, most precise measured value of Dy polarizability + # Wavelength = 1.064*u.um + # w_x = [20.5, 101.3]*u.um # Beam Waists in the x direction + # w_z = [20.5, 95.0]*u.um # Beam Waists in the y direction # options = { - # 'axis': 3, # axis referenced to the beam along which you want the dipole trap potential - # 'extent': 1e2, # range of spatial coordinates in one direction to calculate trap potential over + # 'axis': 1, # axis referenced to the beam along which you want the dipole trap potential + # 'extent': 2e3, # range of spatial coordinates in one direction to calculate trap potential over # 'crossed': True, - # 'theta': 70, + # 'delta': 70, # 'modulation': False, # 'aspect_ratio': 5, # 'gravity': False, @@ -1078,19 +1166,20 @@ if __name__ == '__main__': # 'disp_foci': 3 * z_R(w_0 = np.asarray([30]), lamb = 1.064)[0]*u.um # difference in position of the foci along the propagation direction (Astigmatism) # } - # TrapPotential = computeTrapPotential(w_x, w_z, Powers, Polarizability, options) + # Positions, TrapPotential = computeTrapPotential(w_x, w_z, Powers, Polarizability, options) - # # plt.rcParams["figure.figsize"] = [7.00, 3.50] - # # plt.rcParams["figure.autolayout"] = True - # # fig = plt.figure() - # # ax = fig.add_subplot(111, projection='3d') - # # ax.scatter(TrapPotential[0], TrapPotential[1], TrapPotential[2], c=TrapPotential[2], alpha=1) - # # plt.show() + # plt.rcParams["figure.figsize"] = [7.00, 3.50] + # plt.rcParams["figure.autolayout"] = True + # fig = plt.figure() + # ax = fig.add_subplot(111, projection='3d') + # ax.scatter(TrapPotential[0], TrapPotential[1], TrapPotential[2], c=TrapPotential[2], alpha=1) + # plt.show() # plt.figure() - # plt.plot(TrapPotential[0]) + # plt.plot(Positions[options['axis']], TrapPotential[options['axis']], label = 'Crossed beam potential') + # plt.xlim([-500, 500]) + # plt.ylim([-1800, -200]) + # plt.legend() # plt.show() - - \ No newline at end of file