Closed ChrisJones687 closed 2 years ago
The tests actually need to change when the establishment is limited by number of S hosts. The fix for the tests is:
diff --git a/tests/test_model.cpp b/tests/test_model.cpp
index 5ed811c..9e06692 100644
--- a/tests/test_model.cpp
+++ b/tests/test_model.cpp
@@ -253,6 +253,14 @@ int test_deterministic()
auto expected_dispersers = config.reproductive_rate * infected;
auto expected_established_dispersers = config.reproductive_rate * infected;
+ // Limit established dispersers by number of available hosts.
+ for (int row = 0; row < susceptible.rows(); ++row) {
+ for (int col = 0; col < susceptible.cols(); ++col) {
+ if (expected_established_dispersers(row, col) > susceptible(row, col)) {
+ expected_established_dispersers(row, col) = susceptible(row, col);
+ }
+ }
+ }
int step = 0;
Model<Raster<int>, Raster<double>, Raster<double>::IndexType> model(config);
@@ -395,6 +403,14 @@ int test_deterministic_exponential()
auto expected_dispersers = config.reproductive_rate * infected;
auto expected_established_dispersers = config.reproductive_rate * infected;
+ // Limit established dispersers by number of available hosts.
+ for (int row = 0; row < susceptible.rows(); ++row) {
+ for (int col = 0; col < susceptible.cols(); ++col) {
+ if (expected_established_dispersers(row, col) > susceptible(row, col)) {
+ expected_established_dispersers(row, col) = susceptible(row, col);
+ }
+ }
+ }
int step = 0;
I can add that to the PR if needed.
Definitely want to change the established dispersers to addition rather than subtraction in the future.
weather at origin was being used to test for establishment rather than the weather at the destination.