...
 
Commits (2)
......@@ -18,16 +18,17 @@ set bars 0
set term post size 5in, 9in eps enhanced color
#set term png size 700,400
set out "Ecount.eps"
#plot "out/Ecount.txt" using 1:4:3:7:6 w candlestick t "", \
# "out/Ecount.txt" using 5:5:5:5:5 w candlestick lw 2 t "", \
#plot "out/Ecount.txt" using 5:1:4:6:ytic(2) w xerrorbars t ""
set out "Ecount_extinction.eps"
plot "out/Ecount_extinction.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Ecount_extinction.txt" using 8:1 w p t "avg", \
set out "Ecount_outbreak.eps"
plot "out/Ecount_outbreak.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Ecount_outbreak.txt" using 8:1 w p t "avg", \
set out "Ecount_hit_stop.eps"
plot "out/Ecount_hit_stop.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Ecount_hit_stop.txt" using 8:1 w p t "avg", \
unset output
......@@ -18,16 +18,18 @@ set bars 0
set term post size 5in, 9in eps enhanced color
#set term png size 700,400
set out "Efirst.eps"
set out "Efirst_extinction.eps"
plot "out/Efirst_extinction.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Efirst_extinction.txt" using 8:1 w p t "avg", \
#plot "out/Efirst.txt" using 1:4:3:7:6 w candlestick t "", \
# "out/Efirst.txt" using 5:5:5:5:5 w candlestick lw 2 t "", \
set out "Efirst_outbreak.eps"
plot "out/Efirst_outbreak.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Efirst_outbreak.txt" using 8:1 w p t "avg", \
#plot "out/Efirst.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
# "out/Efirst.txt" using 8:1 w p t "avg", \
set out "Efirst_hit_stop.eps"
plot "out/Efirst_hit_stop.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Efirst_hit_stop.txt" using 8:1 w p t "avg", \
plot "out/Efirst_extinction.txt" using 5:1:4:6:ytic(2) w xerrorbars t "med, quartile", \
"out/Efirst_extinction.txt" using 8:1 w p t "avg", \
unset output
reset
clear
#set title ""
set xrange [0:]
#set yrange [0:0.035]
set autoscale fix
set offsets 0, 0, 0.5, 0.5
set encoding utf8
set ylabel 'Zone'
set xlabel 'Hit probability'
set key bottom right
set bars 0
set term post size 5in, 9in eps enhanced color
#set term png size 700,400
set out "Zhit_extinction.eps"
plot "out/Zhit_extinction.txt" using 3:1:ytic(2) w p t "", \
set out "Zhit_outbreak.eps"
plot "out/Zhit_outbreak.txt" using 3:1:ytic(2) w p t "", \
set out "Zhit_hit_stop.eps"
plot "out/Zhit_hit_stop.txt" using 3:1:ytic(2) w p t "", \
unset output
local NRUNS = assert(tonumber(arg[1]), 'missing count parameter')
local MIN_EXPOS_TO_PLOT = NRUNS/100
local E_PLOT_COUNT = 70
local mathutil = require('lib.mathutil')
......@@ -20,6 +20,7 @@ end
local Efirst = {}
local Zhit = {}
local Ecount = {}
local ExtintionR = {}
......@@ -54,19 +55,30 @@ local function parse (f)
FinishedT[status][ #FinishedT[status]+1 ] = t
end
end
do
Ecount[status] = Ecount[status] or {}
local EcountS = Ecount[status]
for zone, count in pairs(Es)do
EcountS[zone] = EcountS[zone] or {}
EcountS[zone][ #EcountS[zone]+1 ] = count
end
end
Ecount[status] = Ecount[status] or {}
local EcountS = Ecount[status]
for zone, count in pairs(Es)do
EcountS[zone] = EcountS[zone] or {}
EcountS[zone][ #EcountS[zone]+1 ] = count
do
Efirst[status] = Efirst[status] or {}
local EfirstS = Efirst[status]
for zone, t in pairs(Ef)do
EfirstS[zone] = EfirstS[zone] or {}
EfirstS[zone][ #EfirstS[zone]+1 ] = t
end
end
Efirst[status] = Efirst[status] or {}
local EfirstS = Efirst[status]
for zone, t in pairs(Ef)do
EfirstS[zone] = EfirstS[zone] or {}
EfirstS[zone][ #EfirstS[zone]+1 ] = t
do
Zhit[status] = Zhit[status] or {}
local ZhitS = Zhit[status]
for zone, t in pairs(Ef)do
ZhitS[zone] = (ZhitS[zone] or 0) + 1
end
end
end
......@@ -139,16 +151,27 @@ local function process_Efirst ()
local stats = {}
for zone, arrivals in pairs(EfirstS) do
if #arrivals>MIN_EXPOS_TO_PLOT then
local min, max = mathutil.minmax(arrivals)
local avg, std = mathutil.avgstd(arrivals)
local med, low, high = mathutil.median(arrivals)
--print(zone, min, low, med, high, max, avg, std)
stats[#stats+1] = {zone=zone, min=min, low=low, med=med, high=high,
max=max, avg=avg, std=std}
local min, max = mathutil.minmax(arrivals)
local avg, std = mathutil.avgstd(arrivals)
local med, low, high = mathutil.median(arrivals)
--print(zone, min, low, med, high, max, avg, std)
stats[#stats+1] = {zone=zone, min=min, low=low, med=med, high=high,
max=max, avg=avg, std=std, count=#arrivals}
end
-- filter most frequent arrivals
do
table.sort(stats, function(a,b) return a.count>b.count end)
local ecount = #stats
local statstemp = {}
if E_PLOT_COUNT<ecount then ecount = E_PLOT_COUNT end
for i=1, ecount do
statstemp[i] = stats[i]
end
stats = statstemp
end
table.sort(stats, function(a,b) return a.avg<b.avg end)
local f = io.open('out/Efirst_'..status..'.txt', 'w')
......@@ -170,19 +193,30 @@ local function process_Ecount ()
local stats = {}
for zone, counts in pairs(EcountS) do
if #counts>MIN_EXPOS_TO_PLOT then
local min, max = mathutil.minmax(counts)
local avg, std = mathutil.avgstd(counts)
local med, low, high = mathutil.median(counts)
--print(zone, min, low, med, high, max, avg, std)
stats[#stats+1] = {zone=zone, min=min, low=low, med=med, high=high,
max=max, avg=avg, std=std}
local min, max = mathutil.minmax(counts)
local avg, std = mathutil.avgstd(counts)
local med, low, high = mathutil.median(counts)
--print(zone, min, low, med, high, max, avg, std)
stats[#stats+1] = {zone=zone, min=min, low=low, med=med, high=high,
max=max, avg=avg, std=std, count=#counts}
end
-- filter most frequent arrivals
do
table.sort(stats, function(a,b) return a.count>b.count end)
local ecount = #stats
local statstemp = {}
if E_PLOT_COUNT<ecount then ecount = E_PLOT_COUNT end
for i=1, ecount do
statstemp[i] = stats[i]
end
stats = statstemp
end
table.sort(stats, function(a,b) return a.avg>b.avg end)
local f = io.open('out/Ecount_'..status..'.txt', 'w')
local ecount = #stats
for i=1, #stats do
local s = stats[i]
f:write(i, ' ', '"'..s.zone..'"', ' ', s.min, ' ', s.low, ' ',
......@@ -196,6 +230,42 @@ local function process_Ecount ()
os.execute('gnuplot Ecount.plot')
end
local function process_Zhit ()
--print('i, zone, min, low, med, high, max, avg, std')
for status, ZhitS in pairs(Zhit) do
local stats = {}
for zone, count in pairs(ZhitS) do
stats[#stats+1] = {zone=zone, hitrate=count / NRUNS}
end
-- filter most frequent arrivals
do
table.sort(stats, function(a,b) return a.hitrate>b.hitrate end)
local ecount = #stats
local statstemp = {}
if E_PLOT_COUNT<ecount then ecount = E_PLOT_COUNT end
for i=1, ecount do
statstemp[i] = stats[i]
end
stats = statstemp
end
local f = io.open('out/Zhit_'..status..'.txt', 'w')
local ecount = #stats
for i=1, #stats do
local s = stats[i]
f:write(i, ' ', '"'..s.zone..'"', ' ', s.hitrate, '\n')
end
f:close()
end
os.execute('gnuplot Zhit.plot')
end
-------------------------------------------------------------------------------
......@@ -203,4 +273,5 @@ parse_files()
process_finished()
process_Ecount()
process_Efirst()
\ No newline at end of file
process_Efirst()
process_Zhit()
\ No newline at end of file
......@@ -6,17 +6,17 @@ local epitrace = require('epitrace')
local conf = {
TMAX = math.huge, --12*30 -- Simulation time limit
NRUNS = 100, -- Number of runs
NRUNS = 10000, -- Number of runs
out_path = 'out/', -- nil to disable logging
startExposed = {
[19220] = {t=0, count=20}, -- exposed at t=0 , RIVERA-MASOLLER
[19220] = {t=0, count=20}, -- exposed at t=0
},
--stop conditions
stop_dpto = 'MONTEVIDEO',
stop_dpto = nil, --'MONTEVIDEO',
stop_localidad = nil, -- any
outbreak_threshold = 100, -- Max number of actives
outbreak_threshold = 200, -- Max number of actives
---[[
disease = {
......@@ -32,7 +32,7 @@ local conf = {
k = 0.15, -- proportion of presymptomatic transmission
r = 0.5, -- relative infectiousness of asymptomatic individuals
T_q = 2.5, -- time to self quarantine
T_q = 2, -- time to self quarantine
},
--]]
--[[
......