Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattg3004 committed Jan 14, 2025
1 parent 6050fe6 commit 95793bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions src/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void Model::runScenarios(ScenariosList &scenarios, Population &popln,
Vector &vectors, Worm &worms, int replicates,
double timestep, int index, int outputEndgame,
int outputEndgameDate, bool outputNTDMC,
int outputNTDMCDate, int reduceImpViaXml,
std::optional<int> outputNTDMCDate, int reduceImpViaXml,
std::string randParamsfile, std::string RandomSeedFile,
std::string RandomCovPropFile, std::string opDir) {

Expand Down Expand Up @@ -146,13 +146,13 @@ void Model::runScenarios(ScenariosList &scenarios, Population &popln,
}

// evolve, saving any specified months along the way
for (int y = 0; y < sc.getNumMonthsToSave(); y++)

for (int y = 0; y < sc.getNumMonthsToSave(); y++){
evolveAndSave(y, popln, vectors, worms, sc, currentOutput, rep, k_vals,
v_to_h_vals, popln.getUpdateParams(), outputEndgame,
outputEndgameDate, outputNTDMC, outputNTDMCDate,
reduceImpViaXml, opDir, cov_prop);

}

// done for this scenario, save the prevalence values for this replicate
if (!_DEBUG)
sc.printResults(rep, currentOutput, popln);
Expand Down Expand Up @@ -218,7 +218,7 @@ void Model::evolveAndSave(int y, Population &popln, Vector &vectors,
int rep, std::vector<double> &k_vals,
std::vector<double> &v_to_h_vals, int updateParams,
int outputEndgame, int outputEndgameDate,
bool outputNTDMC, int outputNTDMCDate,
bool outputNTDMC, std::optional<int> outputNTDMCDate,
int reduceImpViaXml, std::string opDir,
double cov_prop) {

Expand All @@ -241,7 +241,9 @@ void Model::evolveAndSave(int y, Population &popln, Vector &vectors,
// simulations from the scenario file.
int BASEYEAR = 2000;
outputEndgameDate = (outputEndgameDate - BASEYEAR) * 12;
outputNTDMCDate = (outputNTDMCDate - BASEYEAR) * 12;
if(outputNTDMCDate.hasValue()){
outputNTDMCDateFromYear = (outputNTDMCDate.value - BASEYEAR) * 12;
}
int popSize = popln.getSizeOfPop();
double mfprev_aimp_old =
popln.getMFPrev(sc, 0, 0, outputEndgameDate, rep, popSize, folderName);
Expand All @@ -258,15 +260,16 @@ void Model::evolveAndSave(int y, Population &popln, Vector &vectors,
int HydroceleTotalWorms = popln.getHydroceleTotalWorms();
double LymphodemaShape = popln.getLymphodemaShape();
double HydroceleShape = popln.getHydroceleShape();
// if y != 0, then this is a simulation of a scenario which has already
// started and hence, we don't want to reinitialise the outputs

// Only initalize outputs if we are at the start of a simulation, when y==0
// (rather than reinitializing for a scenario that has already started)
if ((outputEndgame == 1) && (y == 0)) {
sc.InitIHMEData(rep, folderName);
sc.InitPreTASData(rep, folderName);
sc.InitTASData(rep, folderName);
}
// if y != 0, then this is a simulation of a scenario which has already
// started and hence, we don't want to reinitialise the outputs
// Only initalize outputs if we are at the start of a simulation, when y==0
// (rather than reinitializing for a scenario that has already started)
if ((outputNTDMC == true) && (y == 0)) {
sc.InitNTDMCData(rep, folderName);
}
Expand Down Expand Up @@ -332,8 +335,8 @@ void Model::evolveAndSave(int y, Population &popln, Vector &vectors,
sc.writeSurveyByAge(popln, t, popln.preTAS_Pass, popln.TAS_Pass, rep,
folderName);
}

if ((t % 12 == 0) && (outputNTDMC == true) && (t >= outputNTDMCDate)) {
if ((t % 12 == 0) && (outputNTDMC == true) && (t >= outputNTDMCDateFromYear)) {
sc.writeRoadmapTarget(popln, t, rep, popln.DoMDA, popln.TAS_Pass,
neededTASPass, folderName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Model {
Vector &vectors, Worm &worms, int replicates,
double timestep, int index, int outputEndgame,
int outputEndgameDate, bool outputNTDMC,
int outputNTDMCDate, int reduceImpViaXml,
std::optional<int> outputNTDMCDate, int reduceImpViaXml,
std::string randParamsfile, std::string RandomSeedFile,
std::string RandomCovPropFile, std::string opDir);
bool
Expand Down

0 comments on commit 95793bf

Please sign in to comment.