You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of tests still run by using the compiled C executable covid19ibm.exe. In #10 I added a new function in C so that the parameters can be passed using a buffer instead of saving the parameters to a file and then opening the file from C like in the following test from test_ibm.py.
"""
Set parameter value to zero should result in zero sum of output column
"""
params = ParameterSet(constant.TEST_DATA_FILE, line_number = 1)
if parameter == 'fraction_asymptomatic':
params = utils.set_fraction_asymptomatic_all( params, 0.0 )
if parameter == 'n_seed_infection':
params.set_param( 'n_seed_infection', 0 )
params = utils.set_fatality_fraction_all(params, 0.0)
params.write_params(constant.TEST_DATA_FILE)
# Call the model, pipe output to file, read output file
file_output = open(constant.TEST_OUTPUT_FILE, "w")
completed_run = subprocess.run([constant.command], stdout = file_output, shell = True)
df_output = pd.read_csv(constant.TEST_OUTPUT_FILE, comment = "#", sep = ",")
np.testing.assert_equal(df_output[output_column].sum(), 0)
@p-robot@roberthinch how does these tests work? is there anything to run the test in Python just like in C or do I have to recreate what's in main.c in Python?
After sorting this out I should be able to change all the tests to run from Python without using the executable.
The text was updated successfully, but these errors were encountered:
@danielmonterocr, I think all the tests should be able to be ported to the Python interface. We've been trying to write all new tests using the Python interface. The above test is parameterised, but for the situation where parameter == 'n_seed_infection' I think the above could be run using the Python interface in the following manner ...
A lot of tests still run by using the compiled C executable covid19ibm.exe. In #10 I added a new function in C so that the parameters can be passed using a buffer instead of saving the parameters to a file and then opening the file from C like in the following test from test_ibm.py.
@p-robot @roberthinch how does these tests work? is there anything to run the test in Python just like in C or do I have to recreate what's in main.c in Python?
After sorting this out I should be able to change all the tests to run from Python without using the executable.
The text was updated successfully, but these errors were encountered: