Commit 863045e5 authored by Victor Boussange's avatar Victor Boussange
Browse files

modifying project.toml and unit test

parent f83e15b1
......@@ -21,6 +21,24 @@ version = "3.5.0+2"
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[BinaryProvider]]
deps = ["Libdl", "SHA"]
git-tree-sha1 = "5b08ed6036d9d3f0ee6369410b830f8873d4024c"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.8"
[[CodeTracking]]
deps = ["InteractiveUtils", "UUIDs"]
git-tree-sha1 = "0becdab7e6fbbcb7b88d8de5b72e5bb2f28239f3"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
version = "0.5.8"
[[CodecZlib]]
deps = ["BinaryProvider", "Libdl", "TranscodingStreams"]
git-tree-sha1 = "05916673a2627dd91b4969ff8ba6941bc85a960e"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.6.0"
[[CompilerSupportLibraries_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612"
......@@ -56,6 +74,15 @@ git-tree-sha1 = "c4ed10355637fcb0725dc6a27060f74df24f13cd"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.23.2"
[[FileIO]]
deps = ["Pkg"]
git-tree-sha1 = "3d7cb2c4c850439f19c4d6d3fbe1dce6481cddb1"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.2.4"
[[FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
[[FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays"]
git-tree-sha1 = "3eb5253af6186eada40de3df524a1c10f0c6bfa2"
......@@ -71,7 +98,20 @@ version = "0.1.2"
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[JLD2]]
deps = ["CodecZlib", "DataStructures", "FileIO", "Mmap", "Pkg", "Printf", "UUIDs"]
git-tree-sha1 = "d6cfa7c24e27d7eaa2290372739c8298257dae16"
uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
version = "0.1.12"
[[JuliaInterpreter]]
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
git-tree-sha1 = "2eadbbde5534346cbb837c3a75b377cba477a06d"
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
version = "0.7.13"
[[LibGit2]]
deps = ["Printf"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[Libdl]]
......@@ -90,6 +130,12 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[LoweredCodeUtils]]
deps = ["JuliaInterpreter"]
git-tree-sha1 = "1c41621653250b2824b6e664ac5bd805558aeff9"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "0.4.3"
[[MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "f7d2e3f654af75f01ec49be82c231c382214223a"
......@@ -134,7 +180,7 @@ uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.9.12"
[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[Printf]]
......@@ -166,6 +212,12 @@ git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "0.2.0"
[[Revise]]
deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "UUIDs", "Unicode"]
git-tree-sha1 = "6cefbc0e3b62146e564a3cf209e7370a839883da"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "2.6.0"
[[Rmath]]
deps = ["Random", "Rmath_jll"]
git-tree-sha1 = "86c5647b565873641538d8f812c04e4c9dbeb370"
......@@ -243,6 +295,12 @@ uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TranscodingStreams]]
deps = ["Random", "Test"]
git-tree-sha1 = "7c53c35547de1c5b9d46a4797cf6d8253807108c"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.5"
[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
......
......@@ -6,9 +6,14 @@ version = "0.1.0"
[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SharedArrays = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
cd(@__DIR__)
using Random;Random.seed!(0)
using JLD2
using Revise,ABMEv,Test
Random.seed!(0)
import ABMEv:update_rates_std!
......@@ -27,21 +24,23 @@ world_alive_test = collect(skipmissing(worldall[:,end]))
# @save "gillepsie_test.jld2" world_alive
@load "gillepsie_test.jld2" world_alive
## Testing
@testset "testing global functioning" begin
@test size(worldall,2) > 1
@test p_default["tspan"][end] >= p_default["tend"]
end
## Comparing simulation
xarray = get_xarray(world_alive,1);xarray_test = get_xarray(world_alive_test,1);
@test xarray xarray_test
@testset "Gillepsie Algorithm" begin
@testset "Testing global functioning" begin
@test size(worldall,2) > 1
@test p_default["tspan"][end] >= p_default["tend"]
end
## Comparing simulation
xarray = get_xarray(world_alive,1);xarray_test = get_xarray(world_alive_test,1);
@test xarray xarray_test
@testset "testing update rates matrix" begin
bs_end = get_b.(world_alive);ds_end = get_d.(world_alive)
update_rates_std!(world_alive,p_default,0.);
bs_recalculated = get_b.(world_alive);ds_recalculated = get_d.(world_alive);
@testset "Testing update rates matrix" begin
bs_end = get_b.(world_alive);ds_end = get_d.(world_alive)
update_rates_std!(world_alive,p_default,0.);
bs_recalculated = get_b.(world_alive);ds_recalculated = get_d.(world_alive);
@test bs_end bs_recalculated;
@test bs_end bs_recalculated;
@test ds_end ds_recalculated;
@test ds_end ds_recalculated;
end
end
using ABMEv,Revise,Test
K0 = 1000; σ = 1e-1
agents1 = [Agent( [σ] .* randn(1) .- .5) for i in 1:K0]
agents2 = [Agent( [σ σ] .* randn(2) .- .5) for i in 1:K0]
world
## testing variance
@testset "Testing metrics" begin
@test first(var(agents1)) (σ).^2 atol=0.001
......@@ -19,7 +17,7 @@ world
end
# not sure this is the bestway of testing
# there is a problem here but we do not know hor to
# there is a problem here
@testset "covgeo2d" begin
cmat = covgeo(agents2,2);
smat = [σ^2 σ^2; σ^2 σ^2]
......
using ABMEv, Test, JLD2,Random
@testset "ABMEv" begin
include("gillepsie.jl")
include("wrightfisher.jl")
include("metrics.jl")
end
using Random;Random.seed!(0)
using Test
cd(@__DIR__)
using Revise,ABMEv
## 1D Simulation
a = 0;
......@@ -23,9 +21,9 @@ agents = [Agent( [1e-2] .* randn(1) .- .5) for i in 1:K0]
@time worldall_test,p["tspan"] = runWorld_store_WF(p,agents,reflected=false);
## load to compare simulation
using JLD2
# @save "wrightfisher_test.jld2" worldall p
@load "wrightfisher_test.jld2" worldall
xarray = get_xarray(worldall,1); xarray_test = get_xarray(worldall_test,1)
@test xarray xarray_test
@testset "Wright Fisher Algorithm" begin
@test xarray xarray_test
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment