Test for AgeBaseHINT fails when targeting the first age bin
Opened this issue · 8 comments
My demographic:
{"Age_Bin_Edges_In_Years":[0,5,20,60,-1],
"Property":"Age_Bin",
"TransmissionMatrix":{
"contact":{"
Matrix":[[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]]},
"environmental":{
"Matrix":[[1,0,0,0],[1,0,0,0],[1,0,0,0],[1,0,0,0]]}}}
This should target the first age bin (0-5] only. I have one outbreak at day 1 and count the NewInfectionEvent in ReportEventRecorder.csv.
I expect NewInfectionEvent only happen in age bin (0-5] after day 1. But I got:
Age Bins: [Interval(0, 5, closed='right'), Interval(5, 20, closed='right'), Interval(20, 60, closed='right'), Interval(60, 150, closed='right')].
Good: There are some transmission for age bin: (0, 5],found 113 new infection.
BAD: Expected no transmission for age bin: (5, 20], found 1 new infections.
Good: There is no transmission for age bin: (20, 60].
BAD: Expected no transmission for age bin: (60, 150], found 3 new infections.
SUMMARY: Success=False
Please see these files for the values that I am looking at in the test:
This is a perfect bug report, btw! :)
235,2005.13,1,NewInfectionEvent,2960,53045.1,M,1,6717.5,145.3290410958904,"(60.0, 150.0]"
252,2005.23,1,NewInfectionEvent,330,56985.1,M,1,6717.5,156.12356164383561,
253,2005.24,1,NewInfectionEvent,927,58349.3,F,1,6717.5,159.86109589041098,
263,2006.28,1,NewInfectionEvent,1954,54100.8,M,1,6717.5,148.2213698630137,"(60.0, 150.0]"
(venv_typhoid) [jbloedow@internal.idm.ctr@ipadvapp06 future_campaign]$
They all seem very old!
(We shouldn't have >125yo in the model actually.)
Might not be an Age-Based HINT bug but rather an artifact of these methuselahs.
There might be a value in our demographics.json (we're doing the basic demographics by file, not by code) that should really be 0.
95,
100,
120
],
"DistributionValues": [
0,
0.1264,
0.2502,
0.3698,
0.4808,
0.5786,
0.6615,
0.7355,
0.7981,
0.8451,
0.8803,
0.9108,
0.938,
0.9594,
0.9754,
0.9868,
0.994,
0.9979,
0.9995,
0.9999,
1,
1
Looks fine.
This can be closed. It is actually covered by #30.
Big update on this...
First, the "Methuselah Problem" is a known issue when using SIMPLE initial age and a distribution like exponential. In practice we expect users to handle this with aggressive natural mortality in the first timestep. For testing purposes, it's probably better to use uniform distribution which lets you set a max age like 100.
Even after we did that in our test, we had a new problem: With a Run_Number of 1 (not 0, or 2, or other values tested) we got 1 NewInfection in the wrong bucket: We have a boy just past his 5th birthday getting an infection. The matrix says that should be impossible. It's not a terrible bug in the grand scheme of things, but it should be run to ground.
I checked whether there was a missing transition, but everything seems fine. I checked whether this was a new birth in the sim. It was not. I also checked whether this person received the expected PropertyChange from the 0-5 age bin to the 5-20 age bin, and they did indeed get the property change before the new infection. So they seem to be getting infected while having a 5-20 property.