def test_c_ops_fn_list_td_corr(): """ correlation: comparing 3LS emission corr., c_ops td (fn-list td format) """ # calculate zero-delay HOM cross-correlation, for incoherently pumped # 3LS ladder system g2ab[0] # with following parameters: # gamma = 1, 99% initialized, tp = 0.5 # Then: g2ab(0)~0.185 tlist = np.linspace(0, 6, 20) ket0 = fock(3, 0) ket1 = fock(3, 1) ket2 = fock(3, 2) sm01 = ket0 * ket1.dag() sm12 = ket1 * ket2.dag() psi0 = fock(3, 2) tp = 1 # define "pi" pulse as when 99% of population has been transferred Om = np.sqrt(-np.log(1e-2) / (tp * np.sqrt(np.pi))) c_ops = [ sm01, [ sm12 * Om, lambda t, args: np.exp(-(t - args["t_off"])**2 / (2 * args["tp"]**2)) ] ] args = {"tp": tp, "t_off": 2} H = qeye(3) * 0 # HOM cross-correlation depends on coherences (g2[0]=0) c1 = correlation_2op_2t(H, psi0, tlist, tlist, c_ops, sm01.dag(), sm01, args=args) c2 = correlation_2op_2t(H, psi0, tlist, tlist, c_ops, sm01.dag(), sm01, args=args, reverse=True) n = mesolve(H, psi0, tlist, c_ops, [sm01.dag() * sm01], args=args).expect[0] n_f = Cubic_Spline(tlist[0], tlist[-1], n) corr_ab = -c1 * c2 + np.array([[n_f(t) * n_f(t + tau) for tau in tlist] for t in tlist]) dt = tlist[1] - tlist[0] gab = abs(np.trapz(np.trapz(corr_ab, axis=0))) * dt**2 assert_(abs(gab - 0.185) < 1e-2)
def make_ham_spline(self, times, pulse): ''' :param times: time axis of pulse (Omega) :param pulse: y data for applied pulse :type times: numpy array :type pulse: numpy array ''' #Hamiltonian H0 = self.Delta1 * two_zero * two_zero.dag() + (self.Delta1 - self.deltaAC) * zero_one * zero_one.dag() \ + self.g * zero_one * two_zero.dag() + np.conj(self.g) * two_zero * zero_one.dag() H1 = two_zero * one_zero.dag() H2 = one_zero * two_zero.dag() S = Cubic_Spline(times[0], times[-1], pulse) S_conj = Cubic_Spline(times[0], times[-1], np.conj(pulse)) H = [H0, [H1, S], [H2, S_conj]] return H