Skip to content

Commit 641f3e7

Browse files
committedJun 23, 2020
Added param_line_number to hospital output files
src/input.c: edited hospital file naming to include param_line_number so as to be consistent with other output files tests/constant.py: edited file paths so that tests pick up the renamed files Fixes BDI-pathogens#112
1 parent 3ad93b2 commit 641f3e7

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed
 

‎src/input.c

+13
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,13 @@ void write_ward_data( model *model)
948948

949949
int hospital_idx = 0;
950950

951+
char param_line_number[10];
952+
sprintf(param_line_number, "%d", model->params->param_line_number);
953+
951954
// Concatenate file name
952955
strcpy(output_file_name, model->params->output_file_dir);
953956
strcat(output_file_name, "/ward_output");
957+
strcat(output_file_name, param_line_number);
954958
strcat(output_file_name, ".csv");
955959
ward_output_file = fopen(output_file_name, "w");
956960

@@ -1397,9 +1401,13 @@ void write_hospital_interactions( model *model )
13971401
int day, hcw_ward_type, hcw_ward_index;
13981402
hospital *hospital = &model->hospitals[0];
13991403

1404+
char param_line_number[10];
1405+
sprintf(param_line_number, "%d", model->params->param_line_number);
1406+
14001407
// Concatenate file name
14011408
strcpy(output_file_name, model->params->output_file_dir);
14021409
strcat(output_file_name, "/time_step_hospital_interactions");
1410+
strcat(output_file_name, param_line_number);
14031411
strcat(output_file_name, ".csv");
14041412

14051413
day = model->interaction_day_idx;
@@ -1484,9 +1492,14 @@ void write_time_step_hospital_data( model *model)
14841492

14851493
if( model->params->sys_write_hospital )
14861494
{
1495+
1496+
char param_line_number[10];
1497+
sprintf(param_line_number, "%d", model->params->param_line_number);
1498+
14871499
// Concatenate file name
14881500
strcpy(output_file_name, model->params->output_file_dir);
14891501
strcat(output_file_name, "/time_step_hospital_output");
1502+
strcat(output_file_name, param_line_number);
14901503
strcat(output_file_name, ".csv");
14911504

14921505
// Open outputfile in different mode depending on whether this is the first time step

‎tests/constant.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
TEST_TRANSMISSION_FILE = join(DATA_DIR_TEST, "transmission_Run1.csv")
3232
TEST_TRACE_FILE = join(DATA_DIR_TEST, "trace_tokens_Run1.csv")
3333
TEST_QUARANTINE_REASONS_FILE = Template(join(DATA_DIR_TEST, "quarantine_reasons_file_Run1_T$T.csv"))
34-
TEST_HCW_FILE = join(DATA_DIR_TEST, "ward_output.csv")
35-
TEST_OUTPUT_FILE_HOSPITAL_TIME_STEP = join(DATA_DIR_TEST, "time_step_hospital_output.csv")
36-
TEST_OUTPUT_FILE_HOSPITAL_INTERACTIONS = join(DATA_DIR_TEST, "time_step_hospital_interactions.csv")
34+
TEST_HCW_FILE = join(DATA_DIR_TEST, "ward_output1.csv")
35+
TEST_OUTPUT_FILE_HOSPITAL_TIME_STEP = join(DATA_DIR_TEST, "time_step_hospital_output1.csv")
36+
TEST_OUTPUT_FILE_HOSPITAL_INTERACTIONS = join(DATA_DIR_TEST, "time_step_hospital_interactions1.csv")
3737
TEST_HOUSEHOLD_TEMPLATE = "./tests/data/baseline_household_demographics.csv"
3838
TEST_HOUSEHOLD_FILE = join(DATA_DIR_TEST, "test_household_demographics.csv")
3939

0 commit comments

Comments
 (0)
Please sign in to comment.