Skip to content

Commit 47ec4b9

Browse files
committed
Merge branch 'gh152_BloodCapacity_Calculation_Fix' into New_Pyrogenic_Threshold_And_MSP1_Antibody_Capacity_Fix
# Conflicts: # Eradication/SusceptibilityMalaria.cpp # Regression/Malaria/113_Malaria_AntibodyLongTermDecay/output/InsetChart.json # Regression/Malaria/114_Malaria_Serialization_AntibodyLongTermDecay/output/InsetChart.json
2 parents dee6a9d + 132dedf commit 47ec4b9

File tree

106 files changed

+264840
-176091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+264840
-176091
lines changed

Eradication/SusceptibilityMalaria.cpp

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ namespace Kernel
260260
}
261261
else if(SusceptibilityMalariaConfig::innate_immune_variation_type != InnateImmuneVariationType::NONE)
262262
{
263-
264263
const NodeDemographics& r_demographics = parent->GetEventContext()->GetNodeEventContext()->GetDemographics();
265264
if(!r_demographics["IndividualAttributes"].Contains( "InnateImmuneDistributionFlag" ) ||
266265
!r_demographics["IndividualAttributes"].Contains( "InnateImmuneDistribution1" ) ||
@@ -306,22 +305,22 @@ namespace Kernel
306305

307306
void SusceptibilityMalaria::Update(float dt)
308307
{
309-
release_assert( params() );
308+
// dt = 0.125 when infected, 1.0 otherwise
309+
release_assert(params());
310310

311311
age += dt; // age in days
312312
m_age_dependent_biting_risk = BitingRiskAgeFactor(age);
313313

314-
if( age <= (20 * DAYSPERYEAR) ) // recalculate kids every day
314+
if(age < ( 20 * DAYSPERYEAR )) // recalculate under-20 year olds every time step
315315
{
316-
recalculateBloodCapacity( age );
316+
recalculateBloodCapacity( age );
317317
}
318-
else if(age <= 20 * DAYSPERYEAR + dt) // recalculate once when they turn 20
318+
else if(age < ( 20 * DAYSPERYEAR + dt )) // recalculate once when they turn 20
319319
{
320320
// set adult blood capacity once when they turn 20, it remains constant after that, no need to update again
321-
recalculateBloodCapacity( age );
321+
recalculateBloodCapacity( age );
322322
}
323323

324-
325324
// approximately every 3 months, within the first timestep once three months have passed
326325
if(SusceptibilityMalariaConfig::innate_immune_variation_type == InnateImmuneVariationType::PYROGENIC_THRESHOLD_VS_AGE_CONCAVE ||
327326
SusceptibilityMalariaConfig::innate_immune_variation_type == InnateImmuneVariationType::PYROGENIC_THRESHOLD_VS_AGE_INCREASING_AND_CYTOKINE_KILLING_INVERSE)
@@ -566,24 +565,21 @@ namespace Kernel
566565
void SusceptibilityMalaria::recalculateBloodCapacity( float _age )
567566
{
568567
// How many RBCs a person should have determined by age.
569-
// This sets the daily production of red blood cells for adults to maintain
570-
// standard equilibrium RBC concentrations given RBC lifetime
571-
if ( _age > (20 * DAYSPERYEAR) )
568+
// Sets daily production of red blood cells for people to set their equilibrium RBC concentrations and blood volume given an RBC lifetime
569+
// Only approximate due to linear increase in blood volume from 0.5 to 5 liters with age, a better growth model would be nonlinear
570+
if (_age >= 20 * DAYSPERYEAR) // 20 years = 7300 days, keeping this separate for initializing the population
572571
{
573-
// This initializes the daily production of red blood cells for adults to maintain standard equilibrium RBC concentrations given RBC lifetime
574-
// N.B. Heavily caveated, because not all adults are same size. However, this keeps consistent equilibrium RBC densities, allowing study of anemia, etc...
575-
m_RBCproduction = ADULT_RBC_PRODUCTION; // 2.0*10^11 (RBCs/day)*(120 days) = 2.4x10^13 RBCs ~= 5 liters * 5x10^6 RBCs/microliter
576-
// This equation tracks the blood volume separately from the equilibrium number of RBCs, allowing for non-constant RBC concentration.
577-
// m_inv_microliters_blood is 1/(microliters of blood in body)--this allows easy calculation of pathogen densities from pathogen numbers
578-
m_inv_microliters_blood = float(1 / ( (0.225 * (7300/DAYSPERYEAR) + 0.5) * 1e6 ));
572+
m_RBCproduction = ADULT_RBC_PRODUCTION;
573+
m_inv_microliters_blood = float( 1 / ( ( 0.225 * ( 7300 / DAYSPERYEAR ) + 0.5 ) * 1e6 ) );// adult blood volume 5 liters
579574
}
580575
else
581576
{
582-
// Update children
583-
// Sets daily production of red blood cells for children to set their equilibrium RBC concentrations and blood volume given an RBC lifetime
584-
// Only approximate due to linear increase in blood volume from 0.5 to 5 liters with age, a better growth model would be nonlinear
585-
m_RBCproduction = int64_t(INFANT_RBC_PRODUCTION + (_age * .000137) * (ADULT_RBC_PRODUCTION - INFANT_RBC_PRODUCTION)); //*.000137==/(20*DAYSPERYEAR)
586-
m_inv_microliters_blood = float(1 / ( (0.225 * (_age/DAYSPERYEAR) + 0.5 ) * 1e6 ));
577+
m_RBCproduction = int64_t( INFANT_RBC_PRODUCTION + ( _age * .000137 ) * ( ADULT_RBC_PRODUCTION - INFANT_RBC_PRODUCTION ) );
578+
if(m_RBCproduction > ADULT_RBC_PRODUCTION)
579+
{
580+
m_RBCproduction = ADULT_RBC_PRODUCTION; // cap at adult production, overrun happens to infected people at age 7299.375-7300 days
581+
}
582+
m_inv_microliters_blood = float( 1 / ( ( 0.225 * ( _age / DAYSPERYEAR ) + 0.5 ) * 1e6 ) );
587583
}
588584
m_RBCcapacity = m_RBCproduction * AVERAGE_RBC_LIFESPAN; // Health equilibrium of RBC is production*lifetime
589585
}

Regression/Malaria/101_Malaria_ReportInterventionData/output/InsetChart.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Regression/Malaria/104_Malaria_Household_5x5_Serialization/output/InsetChart.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8735,7 +8735,7 @@
87358735
0.007477736100554,
87368736
0.008269515819848,
87378737
0.008843364194036,
8738-
0.007301237434149,
8738+
0.007301236968488,
87398739
0.007040482480079,
87408740
0.006629044190049,
87418741
0.00649824924767,
@@ -22053,8 +22053,8 @@
2205322053
},
2205422054
"Header": {
2205522055
"Channels": 30,
22056-
"DTK_Version": "2.29.6 antibody_decay_improvements(7f57409a) Nov 4 2025 11:39:54",
22057-
"DateTime": "Tue Nov 4 13:39:33 2025",
22056+
"DTK_Version": "2.30.0 gh152_BloodCapacity_Calculation_Fix(050fe88582) Jan 7 2026 09:48:56",
22057+
"DateTime": "Wed Jan 7 11:06:41 2026",
2205822058
"Report_Type": "InsetChart",
2205922059
"Report_Version": "3.2",
2206022060
"Simulation_Timestep": 1,

Regression/Malaria/105_Malaria_Innate_Immune_Variation/output/InsetChart.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Regression/Malaria/106_Malaria_ReportInterventionData_GH4629/output/InsetChart.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Regression/Malaria/107_Malaria_Serialization_DelayedIntervention/output/InsetChart.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5902,9 +5902,9 @@
59025902
0.0003566804807633,
59035903
0.000390064669773,
59045904
0.0004215698863845,
5905-
0.0004461080825422,
5906-
0.0004527047276497,
5907-
0.0004664439184126,
5905+
0.0004461080534384,
5906+
0.0004527046985459,
5907+
0.0004664438893087,
59085908
0.000462149415398,
59095909
0.0004665091109928,
59105910
0.0004663094587158,
@@ -5920,8 +5920,8 @@
59205920
0.0004726638144348,
59215921
0.0004671269853134,
59225922
0.0004466707468964,
5923-
0.0004189886385575,
5924-
0.0003876005939674,
5923+
0.0004189886676613,
5924+
0.0003876006230712,
59255925
0.0003202469379175,
59265926
0.0002837656065822,
59275927
0.0002754237793852,
@@ -15153,8 +15153,8 @@
1515315153
},
1515415154
"Header": {
1515515155
"Channels": 30,
15156-
"DTK_Version": "2.29.6 antibody_decay_improvements(7f57409a) Nov 4 2025 11:39:54",
15157-
"DateTime": "Tue Nov 4 13:39:25 2025",
15156+
"DTK_Version": "2.30.0 gh152_BloodCapacity_Calculation_Fix(050fe88582) Jan 7 2026 09:48:56",
15157+
"DateTime": "Wed Jan 7 11:06:33 2026",
1515815158
"Report_Type": "InsetChart",
1515915159
"Report_Version": "3.2",
1516015160
"Simulation_Timestep": 1,

Regression/Malaria/108_Malaria_Serialization_GH4791/output/InsetChart.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20322,7 +20322,7 @@
2032220322
0.0005283076316118,
2032320323
0.0004993530455977,
2032420324
0.0004704289895017,
20325-
0.0004487686383072,
20325+
0.0004487686965149,
2032620326
0.0004290209326427,
2032720327
0.0004168850427959,
2032820328
0.0004068225389346,
@@ -20363,7 +20363,7 @@
2036320363
0.0005376207409427,
2036420364
0.0005462000845,
2036520365
0.0005532433860935,
20366-
0.0005621501477435,
20366+
0.0005621500895359,
2036720367
0.0005595924449153,
2036820368
0.0005652506370097,
2036920369
0.0005649295053445,
@@ -20505,7 +20505,7 @@
2050520505
0.0002005951100728,
2050620506
0.0001951031154022,
2050720507
0.0001931810838869,
20508-
0.0001920767972479,
20508+
0.0001920768117998,
2050920509
0.0001892387517728,
2051020510
0.0001849692926044,
2051120511
0.0001827476808103,
@@ -20683,8 +20683,8 @@
2068320683
0.000146064980072,
2068420684
0.0001438863400836,
2068520685
0.000142953111208,
20686-
0.0001404667127645,
20687-
0.0001404645154253,
20686+
0.0001404667418683,
20687+
0.0001404645299772,
2068820688
0.0001390895486111,
2068920689
0.0001381741894875,
2069020690
0.0001408539392287,
@@ -20701,7 +20701,7 @@
2070120701
0.0001422314380761,
2070220702
0.0001420098269591,
2070320703
0.0001430045522284,
20704-
0.0001421861816198,
20704+
0.0001421861525159,
2070520705
0.0001448029797757,
2070620706
0.0001440631895093,
2070720707
0.0001475901663071,
@@ -20742,7 +20742,7 @@
2074220742
0.0001352316467091,
2074320743
0.0001343625335721,
2074420744
0.0001367274671793,
20745-
0.0001367531658616,
20745+
0.0001367531513097,
2074620746
0.0001384518545819,
2074720747
0.0001369681122014,
2074820748
0.0001393715210725,
@@ -20921,7 +20921,7 @@
2092120921
0.0001234359660884,
2092220922
0.0001213696959894,
2092320923
0.0001201131526614,
20924-
0.0001203038991662,
20924+
0.0001203038918902,
2092520925
0.0001190773909912,
2092620926
0.0001199950056616,
2092720927
0.0001188600072055,
@@ -20932,7 +20932,7 @@
2093220932
0.0001204728978337,
2093320933
0.000120580822113,
2093420934
0.0001218341421918,
20935-
0.0001217627650476,
20935+
0.0001217627723236,
2093620936
0.0001234862429556,
2093720937
0.0001259458367713,
2093820938
0.0001273658417631,
@@ -21097,7 +21097,7 @@
2109721097
0.0001088679127861,
2109821098
0.0001102358728531,
2109921099
0.0001089557990781,
21100-
0.0001100127919926,
21100+
0.0001100127774407,
2110121101
0.0001094947292586,
2110221102
0.000109483502456,
2110321103
0.0001084020041162,
@@ -21144,7 +21144,7 @@
2114421144
9.957650763681e-05,
2114521145
9.987109660869e-05,
2114621146
0.0001000967167784,
21147-
0.0001004758232739,
21147+
0.0001004758378258,
2114821148
0.0001014355802909,
2114921149
0.000101484482002,
2115021150
0.000103022895928,
@@ -21159,7 +21159,7 @@
2115921159
0.0001058171474142,
2116021160
0.0001047957775882,
2116121161
0.0001055314278346,
21162-
0.0001032693398884,
21162+
0.0001032693471643,
2116321163
0.0001058233319782,
2116421164
0.0001053158193827,
2116521165
0.0001060606591636,
@@ -21363,7 +21363,7 @@
2136321363
9.991432307288e-05,
2136421364
0.0001005339508993,
2136521365
9.822811989579e-05,
21366-
9.811333438847e-05,
21366+
9.811334166443e-05,
2136721367
9.525848872727e-05,
2136821368
9.393854998052e-05,
2136921369
9.144909563474e-05,
@@ -21469,7 +21469,7 @@
2146921469
8.628224895801e-05,
2147021470
8.898373198463e-05,
2147121471
8.910393808037e-05,
21472-
9.087420039577e-05,
21472+
9.087420767173e-05,
2147321473
9.040500299307e-05,
2147421474
9.148439130513e-05,
2147521475
9.091481479118e-05,
@@ -21525,7 +21525,7 @@
2152521525
8.407558198087e-05,
2152621526
8.915945363697e-05,
2152721527
8.724624785827e-05,
21528-
9.09398222575e-05,
21528+
9.093981498154e-05,
2152921529
8.994298696052e-05,
2153021530
9.32250986807e-05,
2153121531
9.063190373126e-05,
@@ -21554,7 +21554,7 @@
2155421554
8.000867092051e-05,
2155521555
7.913101580925e-05,
2155621556
7.923720841063e-05,
21557-
7.858505705371e-05,
21557+
7.858506432967e-05,
2155821558
7.970413571456e-05,
2155921559
7.998231740203e-05,
2156021560
8.137195982272e-05,
@@ -21579,7 +21579,7 @@
2157921579
8.304588845931e-05,
2158021580
8.329967386089e-05,
2158121581
8.222842006944e-05,
21582-
8.233963308157e-05,
21582+
8.233961852966e-05,
2158321583
8.172765228665e-05,
2158421584
8.168880594894e-05,
2158521585
8.175717084669e-05,
@@ -21597,7 +21597,7 @@
2159721597
8.390088623855e-05,
2159821598
8.612976671429e-05,
2159921599
8.447254367638e-05,
21600-
8.71820593602e-05,
21600+
8.718204480829e-05,
2160121601
8.594396786066e-05,
2160221602
8.751933637541e-05,
2160321603
8.463092672173e-05,
@@ -21622,7 +21622,7 @@
2162221622
7.34658606234e-05,
2162321623
7.321880548261e-05,
2162421624
7.482231012546e-05,
21625-
7.476781320293e-05,
21625+
7.476782047888e-05,
2162621626
7.611803448526e-05,
2162721627
7.578308577649e-05,
2162821628
7.685703167226e-05,
@@ -21734,7 +21734,7 @@
2173421734
7.542274397565e-05,
2173521735
7.567470311187e-05,
2173621736
7.575174822705e-05,
21737-
7.591932080686e-05,
21737+
7.59193135309e-05,
2173821738
7.619868119946e-05,
2173921739
7.681396527914e-05,
2174021740
7.688628829783e-05,
@@ -21819,8 +21819,8 @@
2181921819
7.320831355173e-05,
2182021820
7.180531247286e-05,
2182121821
7.217861275421e-05,
21822-
7.06812061253e-05,
21823-
7.107909186743e-05,
21822+
7.068121340126e-05,
21823+
7.107910641935e-05,
2182421824
7.113593892427e-05,
2182521825
7.206536974991e-05,
2182621826
7.208269380499e-05,
@@ -30493,7 +30493,7 @@
3049330493
83.89147186279,
3049430494
86.20938110352,
3049530495
86.88056182861,
30496-
89.13507080078,
30496+
89.13642883301,
3049730497
88.20337677002,
3049830498
84.69692230225,
3049930499
84.62982940674,
@@ -54903,8 +54903,8 @@
5490354903
},
5490454904
"Header": {
5490554905
"Channels": 30,
54906-
"DTK_Version": "2.29.6 antibody_decay_improvements(7f57409a) Nov 4 2025 11:39:54",
54907-
"DateTime": "Tue Nov 4 13:40:22 2025",
54906+
"DTK_Version": "2.30.0 gh152_BloodCapacity_Calculation_Fix(050fe88582) Jan 7 2026 09:48:56",
54907+
"DateTime": "Wed Jan 7 11:07:36 2026",
5490854908
"Report_Type": "InsetChart",
5490954909
"Report_Version": "3.2",
5491054910
"Simulation_Timestep": 1,

Regression/Malaria/109_Malaria_FPG_WorkflowOutput/output/InsetChart.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)