Skip to content

Commit

Permalink
update test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
EigenSolver committed Mar 4, 2024
1 parent 1ebda43 commit 315c769
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
6 changes: 3 additions & 3 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.10.1"
julia_version = "1.10.2"
manifest_format = "2.0"
project_hash = "1e88ce001819fd9155c699ecf849fef2bc976656"

Expand Down Expand Up @@ -163,9 +163,9 @@ version = "1.10.0"

[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "9e8fed0505b0c15b4c1295fd59ea47b411c019cf"
git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.2"
version = "1.4.3"

[[deps.Printf]]
deps = ["Unicode"]
Expand Down
2 changes: 1 addition & 1 deletion test/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ version = "2.3.1"

[[deps.SpinShuttling]]
deps = ["LinearAlgebra", "QuadGK", "SpecialFunctions", "Statistics"]
path = "C:\\Users\\ynzhang\\.julia\\dev\\SpinShuttling"
path = ".."
uuid = "eff49e45-ae6d-44ae-9170-2124a87971c9"
version = "0.1.3"

Expand Down
76 changes: 38 additions & 38 deletions test/testfidelity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,52 @@ using SpinShuttling: characteristicfunction
figsize=(400, 300)
visualize=false

# ##
# @testset begin "test single spin characteristics"
# T=400; L=10; σ = sqrt(2) / 20; M = 20000; N=601; κₜ=1/20;κₓ=1/0.1;
# v=L/T;
# t=range(0, T, N)
# P=hcat(t, v.*t)
# B=OrnsteinUhlenbeckField(0,[κₜ,κₓ],σ)
# # R=RandomFunction(P , B)
# model=OneSpinModel(T,L,M,N,B)
# # test customize println
# println(model)
##
@testset begin "test single spin characteristics"
T=400; L=10; σ = sqrt(2) / 20; M = 20000; N=601; κₜ=1/20;κₓ=1/0.1;
v=L/T;
t=range(0, T, N)
P=hcat(t, v.*t)
B=OrnsteinUhlenbeckField(0,[κₜ,κₓ],σ)
# R=RandomFunction(P , B)
model=OneSpinModel(T,L,M,N,B)
# test customize println
println(model)

# f1=averagefidelity(model)
# f2, f2_err=sampling(model, fidelity)
# f3=1/2*(1+φ(T,L,B))
# @test isapprox(f1, f3,rtol=1e-2)
# @test isapprox(f2, f3, rtol=1e-2)
# println("NI:", f1)
# println("MC:", f2)
# println("TH:", f3)
# end
f1=averagefidelity(model)
f2, f2_err=sampling(model, fidelity)
f3=1/2*(1+φ(T,L,B))
@test isapprox(f1, f3,rtol=1e-2)
@test isapprox(f2, f3, rtol=1e-2)
println("NI:", f1)
println("MC:", f2)
println("TH:", f3)
end

# ##
# @testset begin "test two spin characteristics"
# L=10; σ =sqrt(2)/20; M=20000; N=501; T1=200; T0=25*0.05; κₜ=1/20; κₓ=1/0.1;
# B=OrnsteinUhlenbeckField(0,[κₜ,κₓ],σ)
# model=TwoSpinModel(T0, T1, L, M, N, B)
# if visualize
# display(heatmap(collect(model.R.Σ), title="cross covariance matrix, test fig 4", size=figsize))
# end
# f1=averagefidelity(model)
# f2, f2_err=sampling(model, fidelity)
# f3=1/2*(1+φ(T0, T1, L,B))
# @test isapprox(f1, f3,rtol=1e-2)
# @test isapprox(f2, f3, rtol=1e-2)
# println("NI:", f1)
# println("MC:", f2)
# println("TH:", f3)
# end
##
@testset begin "test two spin characteristics"
L=10; σ =sqrt(2)/20; M=20000; N=501; T1=200; T0=25*0.05; κₜ=1/20; κₓ=1/0.1;
B=OrnsteinUhlenbeckField(0,[κₜ,κₓ],σ)
model=TwoSpinModel(T0, T1, L, M, N, B)
if visualize
display(heatmap(collect(model.R.Σ), title="cross covariance matrix, test fig 4", size=figsize))
end
f1=averagefidelity(model)
f2, f2_err=sampling(model, fidelity)
f3=1/2*(1+φ(T0, T1, L,B))
@test isapprox(f1, f3,rtol=1e-2)
@test isapprox(f2, f3, rtol=1e-2)
println("NI:", f1)
println("MC:", f2)
println("TH:", f3)
end

##
@testset "1/f noise chacacteristics" begin
σ = sqrt(2)/20; M = 5000; N=301; L=10; γ=(0.0001,10000); # MHz
# 0.01 ~ 100 μs
# v = 0.1 ~ 1000 m/s
v=0.1; T=L/v;κₓ=100;
v=0.1; T=L/v;κₓ=5;
B=PinkBrownianField(0,[κₓ],σ, γ)
model=OneSpinModel(T,L,M,N,B)

Expand Down

0 comments on commit 315c769

Please sign in to comment.