From 21d4ca51f3709dd5c2798e0911de13b016b3d634 Mon Sep 17 00:00:00 2001 From: Matias Bundgaard-Nielsen <56378038+mabuni1998@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:01:55 +0200 Subject: [PATCH] Test fixed after normalization update Detection documentation is now no longer included as this is deprecated functions. --- test/helper_functions.jl | 8 ++++---- test/runtests.jl | 2 -- test/test_operators.jl | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/test/helper_functions.jl b/test/helper_functions.jl index d2a8a8f..78c19f6 100644 --- a/test/helper_functions.jl +++ b/test/helper_functions.jl @@ -138,7 +138,7 @@ function test_multiplewaveguides(b,Nw,idx,order,wda1,adw1) nsteps = length(times) dt = times[2] - times[1] ξfun(t1) = 1 - psi = tensor([i == bw_idx ? onephoton(b.bases[i],idx,ξfun) : i==bc_idx ? fockstate(b.bases[i],1) : fockstate(b.bases[i],0) for i in 1:3]...) + psi = tensor([i == bw_idx ? onephoton(b.bases[i],idx,ξfun,norm=true) : i==bc_idx ? fockstate(b.bases[i],1) : fockstate(b.bases[i],0) for i in 1:3]...) tmp = copy(psi) tmp2 = copy(psi) @@ -172,7 +172,7 @@ function test_multiplewaveguides(b,Nw,idx,order,wda1,adw1) psi_view = view_waveguide(tmp,ground_idx) for k in filter(x -> x != idx, 1:Nw) - psi = tensor([i == bw_idx ? onephoton(b.bases[i],k,ξfun) : i==bc_idx ? fockstate(b.bases[i],1) : fockstate(b.bases[i],0) for i in 1:3]...) + psi = tensor([i == bw_idx ? onephoton(b.bases[i],k,ξfun,norm=true) : i==bc_idx ? fockstate(b.bases[i],1) : fockstate(b.bases[i],0) for i in 1:3]...) mul!(tmp,wda1,psi,1,0) i,j = min(k,idx),max(k,idx) index = (i-1)*Nw + j - (i*(i+1))÷2 @@ -199,7 +199,7 @@ function test_interaction(b,Nw,idx1,idx2,order,wd2w1) nsteps = length(times) dt = times[2] - times[1] ξfun(t1) = 1 - psi = tensor([i == bw_idx ? onephoton(b.bases[i],idx1,ξfun) : fockstate(b.bases[i],0) for i in 1:3]...) + psi = tensor([i == bw_idx ? onephoton(b.bases[i],idx1,ξfun,norm=true) : fockstate(b.bases[i],0) for i in 1:3]...) tmp = copy(psi) testvec2 = ones(nsteps) .* sqrt(2)/get_nsteps(psi.basis) @@ -212,7 +212,7 @@ function test_interaction(b,Nw,idx1,idx2,order,wd2w1) end ξfun(t1,t2) = 1 - psi = tensor([i == bw_idx ? twophoton(b.bases[i],idx1,ξfun) : fockstate(b.bases[i],0) for i in 1:3]...) + psi = tensor([i == bw_idx ? twophoton(b.bases[i],idx1,ξfun,norm=true) : fockstate(b.bases[i],0) for i in 1:3]...) tmp = copy(psi) mul!(tmp,wd2w1,psi,1,0) diff --git a/test/runtests.jl b/test/runtests.jl index 07f2b99..e8df8d5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -26,8 +26,6 @@ println("Starting tests with $(Threads.nthreads()) threads out of `Sys.CPU_THREA @doset "operators" @doset "singlecavity" -@doset "detection_single" -@doset "detection_double" # TODO doctests need fixing #VERSION == v"1.8" && @doset "doctests" get(ENV,"QUANTUMOPTICS_JET_TEST","")=="true" && @doset "jet" diff --git a/test/test_operators.jl b/test/test_operators.jl index db7feaa..b5af45e 100644 --- a/test/test_operators.jl +++ b/test/test_operators.jl @@ -18,7 +18,7 @@ include("helper_functions.jl") adw = ad ⊗ w ξfun(t1,t2) = 1 - input = twophoton(bw,ξfun) + input = twophoton(bw,ξfun,norm=true) psi = fockstate(bc,0) ⊗ input psi_out = copy(psi) @@ -42,7 +42,7 @@ end adw = ad ⊗ w ξfun(t1) = 1 - input = onephoton(bw,ξfun) + input = onephoton(bw,ξfun,norm=true) psi = fockstate(bc,1) ⊗ input psi_out = copy(psi) mul!(psi_out,wda,psi,1,0.0) @@ -67,7 +67,7 @@ end adw = ad ⊗ w ξfun(t1) = 1 - input = onephoton(bw,ξfun) + input = onephoton(bw,ξfun,norm=true) psi = fockstate(bc,0) ⊗ input wda_out_2 = copy(psi) adw_out_2 = copy(psi) @@ -84,7 +84,7 @@ end wda = a ⊗ wd adw = ad ⊗ w - input = onephoton(bw,ξfun) + input = onephoton(bw,ξfun,norm=true) psi = fockstate(bc,0) ⊗ input adw_out_1 = copy(psi) wda_out_1 = copy(psi)