Skip to content

Commit

Permalink
Merge pull request #430 from mrc-ide/MoreCalibChanges
Browse files Browse the repository at this point in the history
Morecalibchanges
  • Loading branch information
matt-gretton-dann authored Jul 8, 2020
2 parents bdd4fea + 37171d5 commit eb036bc
Show file tree
Hide file tree
Showing 18 changed files with 1,691 additions and 1,146 deletions.
22 changes: 21 additions & 1 deletion src/CLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include "Error.h"
#include "Param.h"

void parse_string(std::string const& input, std::string& output)
{
output = input;
}

void parse_read_file(std::string const& input, std::string& output)
{
// check to see if the file exists and error out if it doesn't
Expand Down Expand Up @@ -173,11 +178,26 @@ Optional arguments:

void CmdLineArgs::print_help()
{
// Wes: Temporary hack to reduce the number of /CLP: on the help text.
int clp_flag = 0;
const std::string CLP = "CLP";
std::stringstream ss;

ss << "CovidSim";
for (auto const& it : option_map_)
{
ss << " [/" << it.first << ']';
std::string option = it.first;
std::string option_first_3 = option.substr(0, 3);

if (option_first_3.compare(CLP) == 0) {
if (clp_flag == 0) {
ss << " [/CLP:00] .. [/CLP:99]";
clp_flag = 1;
}
}
else {
ss << " [/" << option << ']';
}
}
std::cerr << ss.str() << ' ' << USAGE << std::endl;
}
Expand Down
5 changes: 5 additions & 0 deletions src/CLI.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ void parse_read_file(std::string const& input, std::string& output);
*/
void parse_write_dir(std::string const& input, std::string& output);

/**
* handles general string.
*/
void parse_string(std::string const& input, std::string& output);

/**
* Parses and checks if the input string is an integer.
*/
Expand Down
27 changes: 18 additions & 9 deletions src/CalcInfSusc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,33 @@ double CalcHouseInf(int j, unsigned short int ts)
return ((HOST_ISOLATED(j) && (Hosts[j].digitalContactTraced != 1)) ? P.CaseIsolationHouseEffectiveness : 1.0)
* ((Hosts[j].digitalContactTraced==1) ? P.DCTCaseIsolationHouseEffectiveness : 1.0)
* ((HOST_QUARANTINED(j) && (Hosts[j].digitalContactTraced != 1) && (!(HOST_ISOLATED(j))))? P.HQuarantineHouseEffect : 1.0)
* P.HouseholdDenomLookup[Households[Hosts[j].hh].nhr - 1] * CalcPersonInf(j, ts);
* P.HouseholdDenomLookup[Households[Hosts[j].hh].nhr - 1]
* ((Hosts[j].care_home_resident) ? P.CareHomeResidentHouseholdScaling : 1.0)
* (HOST_TREATED(j) ? P.TreatInfDrop : 1.0)
* (HOST_VACCED(j) ? P.VaccInfDrop : 1.0)
* ((P.NoInfectiousnessSDinHH)? ((Hosts[j].infectiousness < 0) ? P.SymptInfectiousness : P.AsymptInfectiousness):fabs(Hosts[j].infectiousness)) // removed call to CalcPersonInf to allow infectiousness to be const in hh
* P.infectiousness[ts - Hosts[j].latent_time - 1];
}

double CalcPlaceInf(int j, int k, unsigned short int ts)
{
return ((HOST_ISOLATED(j) && (Hosts[j].digitalContactTraced != 1)) ? P.CaseIsolationEffectiveness : 1.0)
* ((Hosts[j].digitalContactTraced==1) ? P.DCTCaseIsolationEffectiveness : 1.0)
* ((HOST_QUARANTINED(j) && (Hosts[j].digitalContactTraced != 1) && (!(HOST_ISOLATED(j)))) ? P.HQuarantinePlaceEffect[k] : 1.0)
* ((Hosts[j].inf == InfStat_Case) ? P.SymptPlaceTypeContactRate[k] : 1.0)
* ((HOST_QUARANTINED(j) && (!Hosts[j].care_home_resident) && (Hosts[j].digitalContactTraced != 1) && (!(HOST_ISOLATED(j)))) ? P.HQuarantinePlaceEffect[k] : 1.0)
* (((Hosts[j].inf == InfStat_Case) && (!Hosts[j].care_home_resident)) ? P.SymptPlaceTypeContactRate[k] : 1.0)
* P.PlaceTypeTrans[k] / P.PlaceTypeGroupSizeParam1[k] * CalcPersonInf(j, ts);
}

double CalcSpatialInf(int j, unsigned short int ts)
{
return ((HOST_ISOLATED(j) && (Hosts[j].digitalContactTraced != 1)) ? P.CaseIsolationEffectiveness : 1.0)
* ((Hosts[j].digitalContactTraced==1) ? P.DCTCaseIsolationEffectiveness : 1.0)
* ((HOST_QUARANTINED(j) && (Hosts[j].digitalContactTraced != 1) && (!(HOST_ISOLATED(j)))) ? P.HQuarantineSpatialEffect : 1.0)
* ((HOST_QUARANTINED(j) && (!Hosts[j].care_home_resident) && (Hosts[j].digitalContactTraced != 1) && (!(HOST_ISOLATED(j)))) ? P.HQuarantineSpatialEffect : 1.0)
* ((Hosts[j].inf == InfStat_Case) ? P.SymptSpatialContactRate : 1.0)
* P.RelativeSpatialContact[HOST_AGE_GROUP(j)]
* CalcPersonInf(j, ts); /* *Hosts[j].spatial_norm */
}

double CalcPersonInf(int j, unsigned short int ts)
{
return (HOST_TREATED(j) ? P.TreatInfDrop : 1.0)
Expand All @@ -47,19 +55,20 @@ double CalcHouseSusc(int ai, unsigned short int ts, int infector, int tn)
{
return CalcPersonSusc(ai, ts, infector, tn)
* ((Mcells[Hosts[ai].mcell].socdist == 2) ? ((Hosts[ai].esocdist_comply) ? P.EnhancedSocDistHouseholdEffectCurrent : P.SocDistHouseholdEffectCurrent) : 1.0)
* (Hosts[ai].digitalContactTraced==1 ? P.DCTCaseIsolationHouseEffectiveness : 1.0);
* ((Hosts[ai].digitalContactTraced==1) ? P.DCTCaseIsolationHouseEffectiveness : 1.0)
* ((Hosts[ai].care_home_resident) ? P.CareHomeResidentHouseholdScaling : 1.0);
}
double CalcPlaceSusc(int ai, int k, unsigned short int ts, int infector, int tn)
{
return ((HOST_QUARANTINED(ai) && (Hosts[ai].digitalContactTraced != 1)) ? P.HQuarantinePlaceEffect[k] : 1.0)
return ((HOST_QUARANTINED(ai) && (!Hosts[ai].care_home_resident) && (Hosts[ai].digitalContactTraced != 1)) ? P.HQuarantinePlaceEffect[k] : 1.0)
* ((Mcells[Hosts[ai].mcell].socdist == 2) ? ((Hosts[ai].esocdist_comply) ? P.EnhancedSocDistPlaceEffectCurrent[k] : P.SocDistPlaceEffectCurrent[k]) : 1.0)
* (Hosts[ai].digitalContactTraced==1 ? P.DCTCaseIsolationEffectiveness : 1.0);
* ((Hosts[ai].digitalContactTraced==1) ? P.DCTCaseIsolationEffectiveness : 1.0);
}
double CalcSpatialSusc(int ai, unsigned short int ts, int infector, int tn)
{
return ((HOST_QUARANTINED(ai) && (Hosts[ai].digitalContactTraced != 1)) ? P.HQuarantineSpatialEffect : 1.0)
return ((HOST_QUARANTINED(ai) && (!Hosts[ai].care_home_resident) && (Hosts[ai].digitalContactTraced != 1)) ? P.HQuarantineSpatialEffect : 1.0)
* ((Mcells[Hosts[ai].mcell].socdist == 2) ? ((Hosts[ai].esocdist_comply) ? P.EnhancedSocDistSpatialEffectCurrent : P.SocDistSpatialEffectCurrent) : 1.0)
* (Hosts[ai].digitalContactTraced==1 ? P.DCTCaseIsolationEffectiveness : 1.0);
* ((Hosts[ai].digitalContactTraced == 1) ? P.DCTCaseIsolationEffectiveness : 1.0);
}
double CalcPersonSusc(int ai, unsigned short int ts, int infector, int tn)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const int OUTPUT_DIST_SCALE = 1000;
const int MAX_PLACE_SIZE = 20000;
const int MAX_NUM_SEED_LOCATIONS = 10000;

const int MAX_CLP_COPIES = 50;

const int CDF_RES = 20;
const int INFPROF_RES = 56;

Expand Down
2 changes: 1 addition & 1 deletion src/Country.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const int MAX_INTERVENTIONS_PER_ADUNIT = 10;

const int ADUNIT_LOOKUP_SIZE = 1000000;
const int MAX_COUNTRIES = 100;
const int NUM_PLACE_TYPES = 4;
const int NUM_PLACE_TYPES = 5;
const int MAX_ADUNITS = 3200;

// Maximal absent time - used for array sizing
Expand Down
Loading

0 comments on commit eb036bc

Please sign in to comment.