def get_transitions(Yg, Ye, ve, vg, cnt_freqs, df=100e6, T=1, Jmax=1): Jg_arr = np.arange(0, Jmax + 1) Je_arr = np.arange(0, Jmax + 1) w = get_doppler(T, 100 * c * cnt_freq) nus = np.linspace(100 * c * (cnt_freq) - df, 100 * c * (cnt_freq) + df, 2000) spectrum_P = np.zeros(len(nus)) spectrum_Q = np.zeros(len(nus)) spectrum_R = np.zeros(len(nus)) f_P = [] f_Q = [] f_R = [] for Jg in Jg_arr: for Je in Je_arr: # only dipole transitions eng = 100 * c * (energy(Ye, ve, Je) - energy(Yg, vg, Jg)) # apply population of ground states A = get_pop(Jg, 100 * c * Yg[1][0], T) if Je - Jg == -1: spectrum_P += gauss(nus, eng, A, w) f_P.append(eng) #plt.plot( 2 * [(eng - 100*c*cnt_freq) / 1e9], [-0.1,0.0], 'r' ) if Je - Jg == 0: spectrum_Q += gauss(nus, eng, A, w) f_Q.append(eng) #plt.plot( 2 * [(eng - 100*c*cnt_freq) / 1e9], [-0.1,0.0], 'g' ) if Je - Jg == +1: spectrum_R += gauss(nus, eng, A, w) f_R.append(eng) #plt.plot( 2 * [(eng - 100*c*cnt_freq) / 1e9], [-0.1,0.0], 'b' ) f_P = np.array(f_P) - 100 * c * cnt_freq f_Q = np.array(f_Q) - 100 * c * cnt_freq f_R = np.array(f_R) - 100 * c * cnt_freq nus = nus - 100 * c * cnt_freqs return (nus, [spectrum_P, spectrum_Q, spectrum_R], [f_P, f_Q, f_R])
def fcn2min(params, x, data, Yg35, Ye35, plot_fit = False): a = params['a'] Trot = params['Trot'] Tcoll = params['Tcoll'] x0 = params['x0'] Ye = Ye35 Yg = Yg35 vg = 0 ve = 0 Jmax = 10 cnt_freq = 3*382.11035e12/100.0/c Jg_arr = np.arange(0, Jmax+1) w = get_doppler(Tcoll, 100*c*cnt_freq) nus = x*1e6 - x0 + 100 * c * cnt_freq # in Hz df = 1e9 if plot_fit == False: xfit = nus else: xfit = np.linspace(np.min(nus) - df, np.max(nus) + df, 500) spectrum_Q = np.zeros(len(xfit)) for Jg in Jg_arr: Je = Jg eng = 100*c*(energy(Ye, ve, Je) - energy(Yg, vg, Jg)) # apply population of ground states A = get_pop(Jg, 100 * c * np.abs(Yg[1][0]), Trot) spectrum_Q += gauss(xfit, eng, A, w) y_th = a * spectrum_Q # (0.76 * spectrum35 + 0.24 * spectrum37) if plot_fit == False: return y_th - data else: return ((xfit - 100*c*cnt_freq + x0)/1e6, y_th)