Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Peter Jentsch
CovidAlertABM
Commits
078cd4e2
Commit
078cd4e2
authored
Jun 14, 2021
by
Peter Jentsch
Browse files
add another test
parent
ac910b77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
CovidAlertVaccinationModel/test/ABM/mixing_test.jl
CovidAlertVaccinationModel/test/ABM/mixing_test.jl
+13
-2
No files found.
CovidAlertVaccinationModel/test/ABM/mixing_test.jl
View file @
078cd4e2
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment