From b8ac501033ed0cb7d07a996e78f864150b51effd Mon Sep 17 00:00:00 2001 From: pjentsch <pjentsch@uwaterloo.ca> Date: Wed, 21 Apr 2021 11:08:18 -0400 Subject: [PATCH] revert prev change --- CovidAlertVaccinationModel/Manifest.toml | 89 +++++++++++-------- .../src/ABM/mixing_graphs.jl | 2 + .../src/CovidAlertVaccinationModel.jl | 8 +- .../src/IntervalsModel/intervals_model.jl | 1 - CovidAlertVaccinationModel/src/data.jl | 6 +- 5 files changed, 61 insertions(+), 45 deletions(-) diff --git a/CovidAlertVaccinationModel/Manifest.toml b/CovidAlertVaccinationModel/Manifest.toml index 439fc5d..f0134ef 100644 --- a/CovidAlertVaccinationModel/Manifest.toml +++ b/CovidAlertVaccinationModel/Manifest.toml @@ -93,21 +93,21 @@ version = "0.9.5" [[ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "44e9f638aa9ed1ad58885defc568c133010140aa" +git-tree-sha1 = "42e3c181483fbd2c416087a0a93838803e358358" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "0.9.37" +version = "0.9.38" [[CheapThreads]] deps = ["ArrayInterface", "IfElse", "Requires", "Static", "StrideArraysCore", "ThreadingUtilities", "VectorizationBase"] -git-tree-sha1 = "5b11b7aba0d4b53f46559b25055d3f0d4376fb36" +git-tree-sha1 = "6596dbdb8fadd45ef9dff0087ef3a6ec9c5473bc" uuid = "b630d9fa-e28e-4980-896d-83ce5e2106b2" -version = "0.2.2" +version = "0.2.3" [[ColorSchemes]] deps = ["ColorTypes", "Colors", "FixedPointNumbers", "Random", "StaticArrays"] -git-tree-sha1 = "d3cf83862f70d430d4b34e43ed65e74bd50ae0e0" +git-tree-sha1 = "9d7dfad1326b1ad29afa1366587806a14d727745" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.11.0" +version = "3.12.0" [[ColorTypes]] deps = ["FixedPointNumbers", "Random"] @@ -138,9 +138,9 @@ version = "0.1.0" [[Conda]] deps = ["JSON", "VersionParsing"] -git-tree-sha1 = "6231e40619c15148bcb80aa19d731e629877d762" +git-tree-sha1 = "299304989a5e6473d985212c28928899c74e9421" uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d" -version = "1.5.1" +version = "1.5.2" [[ConsoleProgressMonitor]] deps = ["Logging", "ProgressMeter"] @@ -218,9 +218,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[Distributions]] deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns"] -git-tree-sha1 = "e64debe8cd174cc52d7dd617ebc5492c6f8b698c" +git-tree-sha1 = "09b3d464f5cbeaf1a2a422afe20d82eff421a7ca" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.24.15" +version = "0.24.17" [[DocStringExtensions]] deps = ["LibGit2", "Markdown", "Pkg", "Test"] @@ -268,10 +268,10 @@ uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5" version = "4.3.1+4" [[FFTW]] -deps = ["AbstractFFTs", "FFTW_jll", "IntelOpenMP_jll", "Libdl", "LinearAlgebra", "MKL_jll", "Reexport"] -git-tree-sha1 = "1b48dbde42f307e48685fa9213d8b9f8c0d87594" +deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] +git-tree-sha1 = "1dc6ca6ad69eb9beadd3ce82b90910f4fa63d7c3" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.3.2" +version = "1.4.0" [[FFTW_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -327,9 +327,9 @@ version = "3.3.3+0" [[GR]] deps = ["Base64", "DelimitedFiles", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Printf", "Random", "Serialization", "Sockets", "Test", "UUIDs"] -git-tree-sha1 = "82a03d9c331d181bf33c99c9af04202cc4533d48" +git-tree-sha1 = "011458b83178ac913dc4eb73b229af45bdde5d83" uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" -version = "0.57.3" +version = "0.57.4" [[GR_jll]] deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Pkg", "Qt5Base_jll", "Zlib_jll", "libpng_jll"] @@ -422,9 +422,9 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" [[Interpolations]] deps = ["AxisAlgorithms", "LinearAlgebra", "OffsetArrays", "Random", "Ratios", "SharedArrays", "SparseArrays", "StaticArrays", "WoodburyMatrices"] -git-tree-sha1 = "eb1dd6d5b2275faaaa18533e0fc5f9171cec25fa" +git-tree-sha1 = "1e0e51692a3a77f1eeb51bf741bdd0439ed210e7" uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" -version = "0.13.1" +version = "0.13.2" [[Intervals]] deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"] @@ -449,9 +449,10 @@ uuid = "82899510-4779-5014-852e-03e436cf321d" version = "1.0.0" [[JLLWrappers]] -git-tree-sha1 = "a431f5f2ca3f4feef3bd7a5e94b8b8d4f2f647a0" +deps = ["Preferences"] +git-tree-sha1 = "642a199af8b68253517b80bd3bfd17eb4e84df6e" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.2.0" +version = "1.3.0" [[JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -502,9 +503,9 @@ version = "1.6.0" [[Latexify]] deps = ["Formatting", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "Printf", "Requires"] -git-tree-sha1 = "7c72983c6daf61393ee8a0b29a419c709a06cede" +git-tree-sha1 = "1925f6838df247e7853f3f9727dd8a52a78f60f4" uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" -version = "0.14.12" +version = "0.15.2" [[Lazy]] deps = ["MacroTools"] @@ -605,6 +606,12 @@ version = "1.3.5" deps = ["Libdl"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +[[LogExpFunctions]] +deps = ["DocStringExtensions"] +git-tree-sha1 = "9809b844f0ff853f0620e0cac7a712e1818671e5" +uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" +version = "0.2.1" + [[Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" @@ -788,9 +795,9 @@ version = "1.0.10" [[Plots]] deps = ["Base64", "Contour", "Dates", "FFMPEG", "FixedPointNumbers", "GR", "GeometryBasics", "JSON", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "PlotThemes", "PlotUtils", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs"] -git-tree-sha1 = "cc4eb1be2576984d7a0f7f51478827dee816138b" +git-tree-sha1 = "30004ffb10118498f38eb0f22cffe802b0aae45f" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" -version = "1.11.2" +version = "1.12.0" [[PooledArrays]] deps = ["DataAPI", "Future"] @@ -798,6 +805,12 @@ git-tree-sha1 = "cde4ce9d6f33219465b55162811d8de8139c0414" uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" version = "1.2.1" +[[Preferences]] +deps = ["TOML"] +git-tree-sha1 = "ea79e4c9077208cd3bc5d29631a26bc0cff78902" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.2.1" + [[PrettyTables]] deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"] git-tree-sha1 = "574a6b3ea95f04e8757c0280bb9c29f1a5e35138" @@ -822,9 +835,9 @@ version = "1.5.0" [[PyCall]] deps = ["Conda", "Dates", "Libdl", "LinearAlgebra", "MacroTools", "Serialization", "VersionParsing"] -git-tree-sha1 = "dd1a970b543bd02efce2984582e996af28cab27f" +git-tree-sha1 = "169bb8ea6b1b143c5cf57df6d34d022a7b60c6db" uuid = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" -version = "1.92.2" +version = "1.92.3" [[Qt5Base_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "xkbcommon_jll"] @@ -976,9 +989,9 @@ version = "0.2.4" [[StaticArrays]] deps = ["LinearAlgebra", "Random", "Statistics"] -git-tree-sha1 = "2f01a51c23eed210ff4a1be102c4cc8236b66e5b" +git-tree-sha1 = "e8cd1b100d37f5b4cfd2c83f45becf61c762eaf7" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.1.0" +version = "1.1.1" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] @@ -991,10 +1004,10 @@ uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" version = "0.33.5" [[StatsFuns]] -deps = ["Rmath", "SpecialFunctions"] -git-tree-sha1 = "ced55fd4bae008a8ea12508314e725df61f0ba45" +deps = ["LogExpFunctions", "Rmath", "SpecialFunctions"] +git-tree-sha1 = "30cd8c360c54081f806b1ee14d2eecbef3c04c49" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" -version = "0.9.7" +version = "0.9.8" [[StrideArraysCore]] deps = ["ArrayInterface", "Requires", "ThreadingUtilities", "VectorizationBase"] @@ -1010,9 +1023,9 @@ version = "0.5.1" [[StructTypes]] deps = ["Dates", "UUIDs"] -git-tree-sha1 = "5eaf731e88587bb72a6c1262c0a014cd1859a08d" +git-tree-sha1 = "ad4558dee74c5d26ab0d0324766b1a3ee6ae777a" uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" -version = "1.5.2" +version = "1.7.1" [[SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] @@ -1036,9 +1049,9 @@ version = "1.0.1" [[Tables]] deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"] -git-tree-sha1 = "a9ff3dfec713c6677af435d6a6d65f9744feef67" +git-tree-sha1 = "c9d2d262e9a327be1f35844df25fe4561d258dc9" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.4.1" +version = "1.4.2" [[Tar]] deps = ["ArgTools", "SHA"] @@ -1074,9 +1087,9 @@ version = "1.5.3" [[Transducers]] deps = ["ArgCheck", "BangBang", "CompositionsBase", "DefineSingletons", "Distributed", "InitialValues", "Logging", "Markdown", "MicroCollections", "Requires", "Setfield", "SplittablesBase", "Tables"] -git-tree-sha1 = "721dc0b917a43e6d191f07a6ea095ced164f08ce" +git-tree-sha1 = "d0aa4681564aa1c68bb1e146dd181817f139697b" uuid = "28d57a85-8fef-5791-bfe6-a80928e7c999" -version = "0.4.62" +version = "0.4.63" [[URIs]] git-tree-sha1 = "7855809b88d7b16e9b029afd17880930626f54a2" @@ -1097,9 +1110,9 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[VectorizationBase]] deps = ["ArrayInterface", "Hwloc", "IfElse", "Libdl", "LinearAlgebra", "Static"] -git-tree-sha1 = "ec513821175957ffb4a33af7d4b96065e3c0cdf6" +git-tree-sha1 = "4f9b7b3e40da418518e0282e7397fd0ca17a7527" uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f" -version = "0.19.27" +version = "0.19.28" [[VersionParsing]] git-tree-sha1 = "80229be1f670524750d905f8fc8148e5a8c4537f" diff --git a/CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl b/CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl index 00bdc2d..87d12b0 100644 --- a/CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl +++ b/CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl @@ -11,9 +11,11 @@ function Base.isequal(e1::GraphEdge,e2::GraphEdge) end function sample_mixing_graph!(mixing_graph,population_demographics) mixing_edges = mixing_graph.mixing_edges + # display( mixing_edges.sampler_matrix) for i in 1:size(mixing_edges.contact_array)[1], j in 1:i #diagonal demo_i = Int(population_demographics[i]) demo_j = Int(population_demographics[j]) + rand!(RNG, mixing_edges.sampler_matrix[demo_i,demo_j],mixing_edges.sample_cache[i,j]) for k in 1:length(mixing_edges.contact_array[i,j][1]) kth_node_i = mixing_edges.contact_array[i,j][1][k] diff --git a/CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl b/CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl index 0e2d09b..3e0897f 100644 --- a/CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl +++ b/CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl @@ -28,18 +28,20 @@ using StaticArrays export intervalsmodel, hh, ws, rest, abm const DNDEBUG = false -macro c_assert(boolean) +macro c_assert(boolean) #this is a version of @assert that turns itself off when DNDEBUG=false, should use more if DNDEBUG message = string("Assertion: ", boolean, " failed") :($(esc(boolean)) || error($message)) end end +const durmax = 144 const PACKAGE_FOLDER = dirname(dirname(pathof(CovidAlertVaccinationModel))) const RNG = Xoroshiro128Star(1) -#consts that let give us nicer names for the indices const color_palette = palette(:seaborn_pastel) #color theme for the plots +#consts that let give us nicer names for the indices + include("utils.jl") include("data.jl") include("ABM/contact_vectors.jl") @@ -52,11 +54,11 @@ include("ABM/output.jl") include("ABM/solve.jl") include("ABM/abm.jl") + include("IntervalsModel/intervals_model.jl") include("IntervalsModel/interval_overlap_sampling.jl") include("IntervalsModel/hh_durations_model.jl") include("IntervalsModel/ws_durations_model.jl") include("IntervalsModel/rest_durations_model.jl") include("IntervalsModel/plotting_functions.jl") - end diff --git a/CovidAlertVaccinationModel/src/IntervalsModel/intervals_model.jl b/CovidAlertVaccinationModel/src/IntervalsModel/intervals_model.jl index 3e4fce9..9605d5a 100644 --- a/CovidAlertVaccinationModel/src/IntervalsModel/intervals_model.jl +++ b/CovidAlertVaccinationModel/src/IntervalsModel/intervals_model.jl @@ -4,7 +4,6 @@ Number of start times to sample for a given set of distribution parameters. const comparison_samples = 100 const distribution_support = 0:94 const YOUNG, MIDDLE,OLD = 1,2,3 -const durmax = 144 const sample_repeat = 100 const sparam = (60,12) diff --git a/CovidAlertVaccinationModel/src/data.jl b/CovidAlertVaccinationModel/src/data.jl index b3d825e..a84afeb 100644 --- a/CovidAlertVaccinationModel/src/data.jl +++ b/CovidAlertVaccinationModel/src/data.jl @@ -108,12 +108,12 @@ function load_contact_time_distributions() ws = "ws", rest = "rest" ) - function make_sampler(λ) #our samples can only be in 0:143 so we can fake a poisson distribution by explicitly sampling - return Distributions.DiscreteNonParametricSampler(0:durmax,[pdf(Poisson(λ),x) for x in 0:durmax]) + function make_sampler(λ) + return Distributions.PoissonADSampler(λ)#Distributions.DiscreteNonParametricSampler(0:durmax,[pdf(Poisson(λ),x) for x in 0:durmax]) end contact_distributions_tuple = map(fnames) do fname dat = deserialize(joinpath(PACKAGE_FOLDER,"intervals_model_output","simulation_output","$fname.dat")) - return map(p -> Poisson(mode(p.particles)), as_symmetric_matrix(dat[distkey].P)) + return map(p -> make_sampler(mode(p.particles)), as_symmetric_matrix(dat[distkey].P)) end return contact_distributions_tuple end -- GitLab