Skip to content
Merged

Lib #115

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/CI_NVMagnetometer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths:
- "src/NVMagnetometer/**"
- "lib/NVMagnetometer/**"
- ".github/workflows/CI_NVMagnetometer.yml"
push:
branches:
Expand Down Expand Up @@ -53,10 +53,10 @@ jobs:
Pkg.Registry.update()
# Install packages present in subdirectories
dev_pks = Pkg.PackageSpec[]
for path in ("src/QuanEstimationBase",)
for path in ("lib/QuanEstimationBase",)
push!(dev_pks, Pkg.PackageSpec(; path))
end
Pkg.develop(dev_pks)
Pkg.instantiate()
Pkg.test(; coverage="user")
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=src/NVMagnetometer {0}
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/NVMagnetometer {0}
5 changes: 3 additions & 2 deletions .github/workflows/CI_QuanEstimation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main
paths:
- "src/**"
- "lib/**"
- "ext/**"
- "test/**"
- "Project.toml"
Expand Down Expand Up @@ -58,7 +59,7 @@ jobs:
Pkg.Registry.update()
# Install packages present in subdirectories
dev_pks = Pkg.PackageSpec[]
for path in ("src/QuanEstimationBase", "src/NVMagnetometer")
for path in ("lib/QuanEstimationBase", "lib/NVMagnetometer")
push!(dev_pks, Pkg.PackageSpec(; path))
end
Pkg.develop(dev_pks)
Expand All @@ -67,7 +68,7 @@ jobs:
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=. {0}
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src
directories: src,ext,lib/QuanEstimationBase/src,lib/NVMagnetometer/src
- uses: codecov/codecov-action@v5
with:
files: lcov.info
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/CI_QuanEstimationBase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths:
- "src/QuanEstimationBase/**"
- "lib/QuanEstimationBase/**"
- ".github/workflows/CI_QuanEstimationBase.yml"
push:
branches:
Expand Down Expand Up @@ -51,4 +51,6 @@ jobs:
run: |
import Pkg
Pkg.Registry.update()
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=src/QuanEstimationBase {0}
Pkg.instantiate()
Pkg.test(; coverage="user")
shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/QuanEstimationBase {0}
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
JL = julia --project

default: init test

init:
$(JL) -e 'using Pkg; Pkg.develop([Pkg.PackageSpec(path = joinpath("lib", pkg)) for pkg in ["QuanEstimationBase", "NVMagnetometer"]]); Pkg.precompile()'

update:
$(JL) -e 'using Pkg; Pkg.update(); Pkg.precompile()'
update-docs:
$(JL) -e 'using Pkg; Pkg.activate("docs"); Pkg.update(); Pkg.precompile()'

test:
$(JL) -e 'using Pkg; Pkg.test("QuanEstimation")'

test-%:
$(JL) -e 'using Pkg; Pkg.test("$*")'

coverage:
$(JL) -e 'using Pkg; Pkg.test(["QuanEstimation", "QuanEstimationBase", "NVMagnetometer"]; coverage=true)'

servedocs:
$(JL) -e 'using Pkg; Pkg.activate("docs"); using LiveServer; servedocs(;skip_dirs=["docs/src/assets", "docs/src/generated"])'

clean:
rm -rf docs/build
find . -name "*.cov" -type f -print0 | xargs -0 /bin/rm -f

.PHONY: init test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
function test_Mopt_Projection()
M = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Projection(; M = M, seed = seed)
opt = MeasurementOpt(; mtype = :Projection, M = M, seed = seed)
@test opt.M == M
@test opt.rng == MersenneTwister(seed)
end
Expand All @@ -31,7 +31,7 @@ function test_Mopt_LinearComb()
POVM_basis = QuanEstimationBase.SIC(2)
M_num = 2
seed = 1234
opt = Mopt_LinearComb(POVM_basis = POVM_basis, M_num = M_num, seed = seed)
opt = MeasurementOpt(; mtype = :LC,POVM_basis = POVM_basis, M_num = M_num, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.M_num == M_num
@test opt.rng == MersenneTwister(seed)
Expand All @@ -41,7 +41,7 @@ end
function test_Mopt_Rotation()
POVM_basis = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Rotation(POVM_basis = POVM_basis, seed = seed)
opt = MeasurementOpt(; mtype = :Rotation, POVM_basis = POVM_basis, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.rng == MersenneTwister(seed)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function test_StateOpt()
@test opt.rng == MersenneTwister(seed)
end

function test_Mopt_Projection()
function test_MeasurementOpt(; mtype = :Projection,)
M = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Projection(M = M, seed = seed)
opt = MeasurementOpt(; mtype = :Projection,M = M, seed = seed)
@test opt.M == M
@test opt.rng == MersenneTwister(seed)
end
Expand All @@ -28,7 +28,7 @@ function test_Mopt_LinearComb()
POVM_basis = QuanEstimationBase.SIC(2)
M_num = 2
seed = 1234
opt = Mopt_LinearComb(POVM_basis = POVM_basis, M_num = M_num, seed = seed)
opt = MeasurementOpt(; mtype = :LC, POVM_basis = POVM_basis, M_num = M_num, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.M_num == M_num
@test opt.rng == MersenneTwister(seed)
Expand All @@ -37,7 +37,7 @@ end
function test_Mopt_Rotation()
POVM_basis = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Rotation(POVM_basis = POVM_basis, seed = seed)
opt = MeasurementOpt(; mtype = :Rotation,POVM_basis = POVM_basis, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.rng == MersenneTwister(seed)
end
Expand All @@ -52,7 +52,7 @@ function test_OptScenario()
end

@testset "Mopt_Projection" begin
test_Mopt_Projection()
test_MeasurementOpt()
end

@testset "Mopt_LinearComb" begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end
function test_Mopt_Projection()
M = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Projection(M = M, seed = seed)
opt = MeasurementOpt(; mtype = :Projection,M = M, seed = seed)
@test opt.M == M
@test opt.rng == MersenneTwister(seed)
end
Expand All @@ -28,7 +28,7 @@ function test_Mopt_LinearComb()
POVM_basis = QuanEstimationBase.SIC(2)
M_num = 2
seed = 1234
opt = Mopt_LinearComb(POVM_basis = POVM_basis, M_num = M_num, seed = seed)
opt = MeasurementOpt(; mtype = :LC, POVM_basis = POVM_basis, M_num = M_num, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.M_num == M_num
@test opt.rng == MersenneTwister(seed)
Expand All @@ -37,7 +37,7 @@ end
function test_Mopt_Rotation()
POVM_basis = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Rotation(POVM_basis = POVM_basis, seed = seed)
opt = MeasurementOpt(; mtype = :Rotation, POVM_basis = POVM_basis, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.rng == MersenneTwister(seed)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ end
function test_Mopt_Projection()
M = QuanEstimationBase.SIC(2)
seed = 1234
opt = Mopt_Projection(M = M, seed = seed)
opt = MeasurementOpt(; mtype = :Projection,M = M, seed = seed)
@test opt.M == M
@test opt.rng == MersenneTwister(seed)
end
Expand All @@ -45,7 +45,7 @@ function test_Mopt_LinearComb()
POVM_basis = QuanEstimationBase.SIC(2)
M_num = 2
seed = 1234
opt = Mopt_LinearComb(POVM_basis = POVM_basis, M_num = M_num, seed = seed)
opt = MeasurementOpt(; mtype = :LC, POVM_basis = POVM_basis, M_num = M_num, seed = seed)
@test opt.POVM_basis == POVM_basis
@test opt.M_num == M_num
@test opt.rng == MersenneTwister(seed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ end
include("algorithms/test_DE.jl")
end

@testset "NM" begin
include("algorithms/test_NM.jl")
end

@testset "PSO" begin
include("algorithms/test_PSO.jl")
end
Expand Down
Loading