SciCompMod / memilio

Modular spatio-temporal models for epidemic and pandemic simulations
https://scicompmod.github.io/memilio/
Apache License 2.0
52 stars 15 forks source link

1012 bug in getting testparameters in specific test derived from generictest #1013

Open khoanguyen-dev opened 2 months ago

khoanguyen-dev commented 2 months ago

Changes and Information

Please briefly list the changes (main added features, changed items, or corrected bugs) made:

If need be, add additional information and what the reviewer should look out for in particular:

Merge Request - Guideline Checklist

Please check our git workflow. Use the draft feature if the Pull Request is not yet ready to review.

Checks by code author

Checks by code reviewer(s)

Closes #1012

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.22%. Comparing base (575a146) to head (c837eb9). Report is 7 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1013 +/- ## ========================================== - Coverage 96.23% 96.22% -0.01% ========================================== Files 128 128 Lines 10852 10869 +17 ========================================== + Hits 10443 10459 +16 - Misses 409 410 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

khoanguyen-dev commented 2 months ago

There is still an error in the Pycode. The mio::CustomIndexArray<mio::abm::TestParameters, mio::abm::TestType> could not be bound since the pymio::bind_CustomIndexArray function does not include an overload for a tuple of doubles (just a single double). I will try to work to extend this. If time is essential, I can set up the TestParameters in the test directly instead of taking it from the world.parameters.

reneSchm commented 2 months ago

According to CodeCov the coverage dropped because of some "indirect changes" by commit a8dd034 (I am not sure that the branch is reported correctly), so now line 200-202 in cpp/models/abm/infection.cpp are no longer covered. Probably some parameter change in the tests could fix this, but maybe have a look at the function as well (it might possibly need updating?).

DavidKerkmann commented 2 days ago

It seems that I managed to fix the python bindings. However, I had to implement serialise and deserialise for the simple

struct TestParameters {
     UncertainValue<> sensitivity;
     UncertainValue<> specificity;
}

as it couldn't be detected by the templates in io/io.h. Is there a way around that? I can imagine letting this derive from std::pair and write access operators for .first and .second but there may be something more simple. Please comment if you have ideas.

reneSchm commented 1 day ago

Is there a way around that?

Not really, we cannot iterate over members of generic structs. (Technically, we could using a void*, but that will cause more issues than it solves.)

I can imagine letting this derive from std::pair and write access operators for .first and .second

That (or tuples, vectors, or other types with its own (de)serialize_internal function) would work, but you lose the names when writing the Json.

I'd say the best options are

DavidKerkmann commented 1 day ago

I see. In that case I would leave it as is for now and make changes later if we need to.