Skip to content

Commit baa5e8c

Browse files
committed
Merge branch 'main' of github.com:SciCompMod/memilio-tutorials
2 parents 2b069cc + c623124 commit baa5e8c

9 files changed

Lines changed: 17 additions & 55 deletions

File tree

cpp-tutorials/abm/tutorial_abm_testing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const auto age_group_80_plus = mio::AgeGroup(5);
6464
// - Is active for the full 30-day simulation window.
6565
// - Uses a PCR test (sensitivity/specificity come from TestData defaults).
6666
// - Tests are valid for `validity_days`; a negative result exempts retesting for validity_days days (Default: 3).
67-
// - Targets persons in any infected state (Exposed through Critical).
67+
// - Targets persons in any infected state (Exposed to Critical).
6868
// - Applies to all age groups except school children (5-14).
6969
// - Tests with `testing_probability` probability upon entry (Default: 100%).
7070
// - Applies to all public locations (SocialEvent, School, Work, BasicsShop)
@@ -90,7 +90,7 @@ void add_npi_testing_strategies_to_world(mio::abm::Model& model, double testing_
9090

9191
auto testing_criteria = mio::abm::TestingCriteria(ages_to_test, states_to_test);
9292
auto testing_scheme = mio::abm::TestingScheme(testing_criteria, validity, start_date_test, end_date_test,
93-
pcr_test_parameters, testing_probability);
93+
pcr_test_parameters, testing_probability);
9494

9595
// Attach the scheme to all public location types.
9696
model.get_testing_strategy().add_scheme(mio::abm::LocationType::SocialEvent, testing_scheme);
@@ -291,4 +291,4 @@ int main(int argc, char* argv[])
291291
std::cout << "Results written to abm_tests.txt\n";
292292

293293
return 0;
294-
}
294+
}

cpp-tutorials/abm/tutorial_abm_vaccination.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ int main(int argc, char* argv[])
186186
// use_data_vacc : 1 = apply JSON data-driven vaccination, 0 = skip (default: 0)
187187
// Note that no vaccination takes place if json file should be used but cannot be found!
188188
double arg_vacc_rate = (argc > 1) ? std::atof(argv[1]) : 0.0;
189-
int arg_n_households = (argc > 2) ? std::atoi(argv[2]) : 1000;
189+
int arg_n_households = (argc > 2) ? std::atoi(argv[2]) : 125;
190190
double arg_protection_peak = (argc > 3) ? std::atof(argv[3]) : 0.67;
191191
int arg_use_data_vacc = (argc > 4) ? std::atoi(argv[4]) : 0;
192192

@@ -419,8 +419,7 @@ int main(int argc, char* argv[])
419419
// ── Data-driven mode ─────────────────────────────────────────
420420
// Read real-world vaccination counts from a JSON file and apply
421421
// them day-by-day to the model's persons.
422-
const std::string vacc_json_path =
423-
"/Users/saschakorf/Documents/Promotion/memilio-tutorials/cpp-tutorials/abm/vacc_county_ageinf_ma7.json";
422+
const std::string vacc_json_path = "./vacc_county_ageinf_ma7.json";
424423
const int county_id = 1002;
425424
const mio::Date sim_start = mio::Date(2020, 10, 1);
426425

@@ -452,4 +451,4 @@ int main(int argc, char* argv[])
452451
std::cout << "Results written to abm_vaccination.txt\n";
453452

454453
return 0;
455-
}
454+
}

exercises/exercise01.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _(mo):
250250

251251
@app.cell
252252
def _(result):
253-
result.print_table()
253+
print(result.print_table(return_string=True))
254254
return
255255

256256

@@ -280,7 +280,7 @@ def _(mo):
280280

281281
@app.cell
282282
def _(interpolated_result):
283-
interpolated_result.print_table()
283+
print(interpolated_result.print_table(return_string=True))
284284
return
285285

286286

exercises/exercise03.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def _(mo):
170170
def _(dt, model, osecir, t0, tmax):
171171
# Simulate model from t0 to tmax with initial step size dt
172172
result = osecir.simulate(t0, tmax, dt, model)
173-
result.print_table()
173+
print(result.print_table(return_string=True))
174174
return (result,)
175175

176176

@@ -186,7 +186,7 @@ def _(mo):
186186
def _(osecir, result):
187187
# Interpolate result to full days
188188
interpolated_result = osecir.interpolate_simulation_result(result)
189-
interpolated_result.print_table()
189+
print(interpolated_result.print_table(return_string=True))
190190
return
191191

192192

exercises/exercise05.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _(mo):
184184
def _(dt, model, osecir, t0, tmax):
185185
# Simulate model from t0 to tmax with initial step size dt
186186
result = osecir.simulate(t0, tmax, dt, model)
187-
result.print_table()
187+
print(result.print_table(return_string=True))
188188
return (result,)
189189

190190

@@ -200,7 +200,7 @@ def _(mo):
200200
def _(osecir, result):
201201
# Interpolate result to full days
202202
interpolated_result = osecir.interpolate_simulation_result(result)
203-
interpolated_result.print_table()
203+
print(interpolated_result.print_table(return_string=True))
204204
return
205205

206206

hello-world.ipynb

Lines changed: 0 additions & 37 deletions
This file was deleted.

tutorial01.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def _(mo):
221221

222222
@app.cell
223223
def _(result):
224-
result.print_table()
224+
print(result.print_table(return_string=True))
225225
return
226226

227227

@@ -251,7 +251,7 @@ def _(mo):
251251

252252
@app.cell
253253
def _(interpolated_result):
254-
interpolated_result.print_table()
254+
print(interpolated_result.print_table(return_string=True))
255255
return
256256

257257

tutorial03.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _(mo):
140140
def _(dt, model, osecir, t0, tmax):
141141
# Simulate model from t0 to tmax with initial step size dt
142142
result = osecir.simulate(t0, tmax, dt, model)
143-
result.print_table()
143+
print(result.print_table(return_string=True))
144144
return (result,)
145145

146146

@@ -156,7 +156,7 @@ def _(mo):
156156
def _(osecir, result):
157157
# Interpolate result to full days
158158
interpolated_result = osecir.interpolate_simulation_result(result)
159-
interpolated_result.print_table()
159+
print(interpolated_result.print_table(return_string=True))
160160
return
161161

162162

tutorial05.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _(dt, model, osecir, t0, tmax):
171171
result = osecir.simulate(t0, tmax, dt, model)
172172
# Interpolate result to full days
173173
interpolated_result = osecir.interpolate_simulation_result(result)
174-
interpolated_result.print_table()
174+
print(interpolated_result.print_table(return_string=True))
175175
return (result,)
176176

177177

0 commit comments

Comments
 (0)