Commit 078cd4e2 authored by Peter Jentsch's avatar Peter Jentsch
Browse files

add another test

parent ac910b77
......@@ -116,8 +116,19 @@ end
@testset "degree distribution generation" for _ in samples
model = ModelSolution(1, get_parameters(), 100_000)
dist_means = (
[3.1955821797791937 0.9429428771683844 0.0031430699141405485; 0.7199525059785551 2.4721641553924263 0.0044567453216716795; 0.009353408942771433 0.017370616608004246 0.00426932603311176],
[0.8019318380935724 0.651677764149297 0.0018836516558612103; 0.4975667675635904 1.316746659531406 0.0026840811411943774; 0.00560552731065053 0.010461478294876817 0.006192152261765137],
[0.1128548274049412 0.3230353075170861 0.003964429647800997; 0.2466428081676342 1.258148402093756 0.004582169674064005; 0.011797679572415589 0.017859470733932858 0.01238430452353015],
[1.0193293323987982 0.3561306290520396 0.030138426493779822; 0.27191163436292753 0.5144739702660603 0.08850778467147245; 0.08968843697040778 0.3449680615304364 0.10943814365793207],
[0.906277378657788 0.37875635184860545 0.048350709654810434; 0.28918674849909 0.842274696054987 0.1455507801394707; 0.14388606439838253 0.5672989180028651 0.2322383000912529],
[0.8128613982828048 0.7034672332223655 0.06881899421762766; 0.5371088850611215 1.8960399351138069 0.250096158670163; 0.20479728848911483 0.9747751271020686 0.32411028549080995],
)
@unpack demographics, index_vectors, rest_matrix_tuple, ws_matrix_tuple = model
for dist in (ws_matrix_tuple...,rest_matrix_tuple...)
for (expected_dist_mean,dist) in zip(dist_means,(ws_matrix_tuple...,rest_matrix_tuple...))
g = WeightedGraph(demographics,index_vectors,dist,contact_time_distributions.ws)
mixing_dist = [Variance() for _ in 1:3, _ in 1:3]
for v in vertices(g.g)
......@@ -131,8 +142,8 @@ end
fit!(mixing_dist[Int(demo_v), j],d)
end
end
display(mean.(mixing_dist))
for i in eachindex(mixing_dist)
@test mean(mixing_dist[i]) expected_dist_mean atol = 0.01
@test mean(mixing_dist[i]) mean(dist[i]) atol = 0.2
end
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