def job_doppler_free(T): osci08_x1, osci08_y1, osci08_x2, osci08_y2 = trek.load_dir('0008') osci20_x1, osci20_y1, osci20_x2, osci20_y2 = trek.load_dir('0020') np.savetxt('_build/xy/doppler-free-pumping.tsv', np.column_stack([osci08_x1, osci08_y1])) np.savetxt('_build/xy/doppler-free-cooling.tsv', np.column_stack([osci20_x1, osci20_y1]))
def job_scan_pumping(T): osci17_x1, osci17_y1, osci17_x2, osci17_y2 = trek.load_dir("0017") osci18_x1, osci18_y1, osci18_x2, osci18_y2 = trek.load_dir("0018") np.savetxt("_build/xy/scan-pumping-mot-input.tsv", np.column_stack([osci18_x1, osci18_y1])) np.savetxt("_build/xy/scan-pumping-mot-output.tsv", np.column_stack([osci18_x2, osci18_y2])) np.savetxt("_build/xy/scan-pumping-no_mot-input.tsv", np.column_stack([osci17_x1, osci17_y1])) np.savetxt("_build/xy/scan-pumping-no_mot-output.tsv", np.column_stack([osci17_x2, osci17_y2])) np.savetxt("_build/xy/scan-pumping-difference-output.tsv", np.column_stack([osci17_x2, osci17_y2 - osci18_y2]))
def job_scan_cooling(T): osci19_x1, osci19_y1, osci19_x2, osci19_y2 = trek.load_dir("0019") osci20_x1, osci20_y1, osci20_x2, osci20_y2 = trek.load_dir("0020") np.savetxt("_build/xy/scan-cooling-mot-input.tsv", np.column_stack([osci20_x1, osci20_y1])) np.savetxt("_build/xy/scan-cooling-mot-output.tsv", np.column_stack([osci20_x2, osci20_y2])) np.savetxt("_build/xy/scan-cooling-no_mot-input.tsv", np.column_stack([osci19_x1, osci19_y1])) np.savetxt("_build/xy/scan-cooling-no_mot-output.tsv", np.column_stack([osci19_x2, osci19_y2])) np.savetxt("_build/xy/scan-cooling-difference-output.tsv", np.column_stack([osci19_x2, osci19_y2 - osci20_y2])) peaks_val = [] peaks_err = [] peak_val, peak_err = fit_osci_peak(osci20_x1, osci20_y1, -1.00, -0.65, "scan-cooling-mot-input-fit1.tsv") peaks_val.append(peak_val) peaks_err.append(peak_err) peak_val, peak_err = fit_osci_peak(osci20_x1, osci20_y1, -0.40, -0.10, "scan-cooling-mot-input-fit2.tsv") peaks_val.append(peak_val) peaks_err.append(peak_err) peak_val, peak_err = fit_osci_peak(osci20_x1, osci20_y1, 0.80, 1.07, "scan-cooling-mot-input-fit3.tsv") peaks_val.append(peak_val) peaks_err.append(peak_err) spacings = np.array([0, 31.7, 31.7 + 60.3]) spacings -= spacings[2] popt, pconv = op.curve_fit(linear, spacings, peaks_val, sigma=peaks_err) np.savetxt("_build/xy/scan-cooling-spacing-data.tsv", np.column_stack([spacings, peaks_val, peaks_err])) fit_x = np.linspace(min(spacings), max(spacings), 10) fit_y = linear(fit_x, *popt) np.savetxt("_build/xy/scan-cooling-spacing-data.tsv", np.column_stack([spacings, peaks_val, peaks_err])) np.savetxt("_build/xy/scan-cooling-spacing-fit.tsv", np.column_stack([fit_x, fit_y])) detuning_x = (osci19_x2 - popt[1]) / popt[0] detuning_y = osci19_y2 - osci20_y2 np.savetxt("_build/xy/scan-cooling-detuning.tsv", np.column_stack([detuning_x, detuning_y])) sel = (-18 < detuning_x) & (detuning_x < -9) p0 = [-15, 3, 1] popt, pconv = op.curve_fit(gauss, detuning_x[sel], detuning_y[sel], p0=p0) fit_x = np.linspace(-18, -9, 100) fit_y = gauss(fit_x, *popt) np.savetxt("_build/xy/scan-cooling-detuning-fit.tsv", np.column_stack([fit_x, fit_y])) perr = np.sqrt(pconv.diagonal()) T["detuning"] = siunitx(popt[0], perr[0]) return popt[0], perr[0]
def job_scan_pumping(T): osci17_x1, osci17_y1, osci17_x2, osci17_y2 = trek.load_dir('0017') osci18_x1, osci18_y1, osci18_x2, osci18_y2 = trek.load_dir('0018') np.savetxt('_build/xy/scan-pumping-mot-input.tsv', np.column_stack([osci18_x1, osci18_y1])) np.savetxt('_build/xy/scan-pumping-mot-output.tsv', np.column_stack([osci18_x2, osci18_y2])) np.savetxt('_build/xy/scan-pumping-no_mot-input.tsv', np.column_stack([osci17_x1, osci17_y1])) np.savetxt('_build/xy/scan-pumping-no_mot-output.tsv', np.column_stack([osci17_x2, osci17_y2])) np.savetxt('_build/xy/scan-pumping-difference-output.tsv', np.column_stack([osci17_x2, osci17_y2 - osci18_y2]))
def job_loading(T): res_max = [] res_slope = [] for i, directory in zip(itertools.count(), ["0002", "0003", "0004", "0005", "0006", "0007"]): data_x, data_y = trek.load_dir(directory) data_x, data_y = data_x[120:-500], data_y[120:-500] lower = np.where(data_y > 0.095)[0][0] fit_x = np.linspace(data_x[lower - 20], data_x[-1], 100) popt, pconv = op.curve_fit(loading, data_x[lower:], data_y[lower:]) res_max.append(popt[0]) res_slope.append(1 / popt[1]) fit_y = loading(fit_x, *popt) # pl.plot(data_x, data_y) # pl.plot(fit_x, fit_y) # pl.show() # pl.clf() avg_before = np.mean(data_y[:lower]) stretched_data = stretch(data_y, avg_before, 0, popt[0], 1) stretched_fit = stretch(fit_y, avg_before, 0, popt[0], 1) np.savetxt("_build/xy/loading-{}-data.tsv".format(i), np.column_stack([data_x - data_x[lower], stretched_data])) np.savetxt("_build/xy/loading-{}-fit.tsv".format(i), np.column_stack([fit_x - data_x[lower], stretched_fit])) maximum_val, maximum_err = np.mean(res_max), np.std(res_max) slope_val, slope_err = np.mean(res_slope), np.std(res_slope) T["loading_maximum"] = siunitx(maximum_val, maximum_err) T["loading_lifetime"] = siunitx(slope_val, slope_err) mass = 85 * 1.66e-27 pressure_dist = [1.1e-5, 1.5e-5] pressure_val = np.mean(pressure_dist) pressure_err = np.std(pressure_dist) temperature = 24 + 273 k_boltzmann = 1.3806e-23 velocity = np.sqrt(temperature * k_boltzmann / mass) density_val = pressure_val / (k_boltzmann * temperature) density_err = pressure_err / (k_boltzmann * temperature) cross_section_val = 1 / (slope_val * density_val * velocity) cross_section_err = np.sqrt( (slope_err / (slope_val ** 2 * density_val * velocity)) ** 2 + (density_err / (slope_val * density_val ** 2 * velocity)) ** 2 ) T["cross_section"] = siunitx(cross_section_val, cross_section_err) T["density"] = siunitx(density_val, density_err) T["pressure"] = siunitx(pressure_val, pressure_err) T["rubidium_mass"] = siunitx(mass) T["velocity"] = siunitx(velocity)
def job_loading(T): res_max = [] res_slope = [] for i, directory in zip(itertools.count(), ['0002', '0003', '0004', '0005', '0006', '0007']): data_x, data_y = trek.load_dir(directory) data_x, data_y = data_x[120:-500], data_y[120:-500] lower = np.where(data_y > .095)[0][0] fit_x = np.linspace(data_x[lower - 20], data_x[-1], 100) popt, pconv = op.curve_fit(loading, data_x[lower:], data_y[lower:]) res_max.append(popt[0]) res_slope.append(1 / popt[1]) fit_y = loading(fit_x, *popt) # pl.plot(data_x, data_y) # pl.plot(fit_x, fit_y) # pl.show() # pl.clf() avg_before = np.mean(data_y[:lower]) stretched_data = stretch(data_y, avg_before, 0, popt[0], 1) stretched_fit = stretch(fit_y, avg_before, 0, popt[0], 1) np.savetxt('_build/xy/loading-{}-data.tsv'.format(i), np.column_stack([data_x - data_x[lower], stretched_data])) np.savetxt('_build/xy/loading-{}-fit.tsv'.format(i), np.column_stack([fit_x - data_x[lower], stretched_fit])) maximum_val, maximum_err = np.mean(res_max), np.std(res_max) slope_val, slope_err = np.mean(res_slope), np.std(res_slope) T['loading_maximum'] = siunitx(maximum_val, maximum_err) T['loading_lifetime'] = siunitx(slope_val, slope_err) mass = 85 * 1.66e-27 pressure_dist = [1.1e-5, 1.5e-5] pressure_val = np.mean(pressure_dist) pressure_err = np.std(pressure_dist) temperature = 24 + 273 k_boltzmann = 1.3806e-23 velocity = np.sqrt(temperature * k_boltzmann / mass) density_val = pressure_val / (k_boltzmann * temperature) density_err = pressure_err / (k_boltzmann * temperature) cross_section_val = 1 / (slope_val * density_val * velocity) cross_section_err = np.sqrt((slope_err / (slope_val**2 * density_val * velocity))**2 + (density_err / (slope_val * density_val**2 * velocity))**2) T['cross_section'] = siunitx(cross_section_val, cross_section_err) T['density'] = siunitx(density_val, density_err) T['pressure'] = siunitx(pressure_val, pressure_err) T['rubidium_mass'] = siunitx(mass) T['velocity'] = siunitx(velocity)
def job_scan_cooling(T): osci19_x1, osci19_y1, osci19_x2, osci19_y2 = trek.load_dir('0019') osci20_x1, osci20_y1, osci20_x2, osci20_y2 = trek.load_dir('0020') np.savetxt('_build/xy/scan-cooling-mot-input.tsv', np.column_stack([osci20_x1, osci20_y1])) np.savetxt('_build/xy/scan-cooling-mot-output.tsv', np.column_stack([osci20_x2, osci20_y2])) np.savetxt('_build/xy/scan-cooling-no_mot-input.tsv', np.column_stack([osci19_x1, osci19_y1])) np.savetxt('_build/xy/scan-cooling-no_mot-output.tsv', np.column_stack([osci19_x2, osci19_y2])) np.savetxt('_build/xy/scan-cooling-difference-output.tsv', np.column_stack([osci19_x2, osci19_y2 - osci20_y2])) peaks_val = [] peaks_err = [] peak_val, peak_err = fit_osci_peak(osci20_x1, osci20_y1, -1.00, -0.65, 'scan-cooling-mot-input-fit1.tsv') peaks_val.append(peak_val) peaks_err.append(peak_err) peak_val, peak_err = fit_osci_peak(osci20_x1, osci20_y1, -0.40, -0.10, 'scan-cooling-mot-input-fit2.tsv') peaks_val.append(peak_val) peaks_err.append(peak_err) peak_val, peak_err = fit_osci_peak(osci20_x1, osci20_y1, 0.80, 1.07, 'scan-cooling-mot-input-fit3.tsv') peaks_val.append(peak_val) peaks_err.append(peak_err) spacings = np.array([0, 31.7, 31.7 + 60.3]) spacings -= spacings[2] popt, pconv = op.curve_fit(linear, spacings, peaks_val, sigma=peaks_err) np.savetxt('_build/xy/scan-cooling-spacing-data.tsv', np.column_stack([spacings, peaks_val, peaks_err])) fit_x = np.linspace(min(spacings), max(spacings), 10) fit_y = linear(fit_x, *popt) np.savetxt('_build/xy/scan-cooling-spacing-data.tsv', np.column_stack([spacings, peaks_val, peaks_err])) np.savetxt('_build/xy/scan-cooling-spacing-fit.tsv', np.column_stack([fit_x, fit_y])) detuning_x = (osci19_x2 - popt[1]) / popt[0] detuning_y = osci19_y2 - osci20_y2 np.savetxt('_build/xy/scan-cooling-detuning.tsv', np.column_stack([detuning_x, detuning_y])) sel = (-18 < detuning_x) & (detuning_x < -9) p0 = [-15, 3, 1] popt, pconv = op.curve_fit(gauss, detuning_x[sel], detuning_y[sel], p0=p0) fit_x = np.linspace(-18, -9, 100) fit_y = gauss(fit_x, *popt) np.savetxt('_build/xy/scan-cooling-detuning-fit.tsv', np.column_stack([fit_x, fit_y])) perr = np.sqrt(pconv.diagonal()) T['detuning'] = siunitx(popt[0], perr[0]) return popt[0], perr[0]
def job_doppler_free(T): osci08_x1, osci08_y1, osci08_x2, osci08_y2 = trek.load_dir("0008") osci20_x1, osci20_y1, osci20_x2, osci20_y2 = trek.load_dir("0020") np.savetxt("_build/xy/doppler-free-pumping.tsv", np.column_stack([osci08_x1, osci08_y1])) np.savetxt("_build/xy/doppler-free-cooling.tsv", np.column_stack([osci20_x1, osci20_y1]))