Skip to content

Conversation

MaxBetzDLR
Copy link
Member

@MaxBetzDLR MaxBetzDLR commented Sep 8, 2025

Changes and Information

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

  • Add bindings for sde models (SIR, SIRS)
  • Use simulate_stochastic

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

  • Every addressed issue is linked (use the "Closes #ISSUE" keyword below)
  • New code adheres to coding guidelines
  • No large data files have been added (files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
  • Tests are added for new functionality and a local test run was successful (with and without OpenMP)
  • Appropriate documentation within the code (Doxygen) for new functionality has been added in the code
  • Appropriate external documentation (ReadTheDocs) for new functionality has been added to the online documentation
  • Proper attention to licenses, especially no new third-party software with conflicting license has been added
  • (For ABM development) Checked benchmark results and ran and posted a local test above from before and after development to ensure performance is monitored.

Checks by code reviewer(s)

  • Corresponding issue(s) is/are linked and addressed
  • Code is clean of development artifacts (no deactivated or commented code lines, no debugging printouts, etc.)
  • Appropriate unit tests have been added, CI passes, code coverage and performance is acceptable (did not decrease)
  • No large data files added in the whole history of commits(files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
  • On merge, add 2-5 lines with the changes (main added features, changed items, or corrected bugs) to the merge-commit-message. This can be taken from the briefly-list-the-changes above (best case) or the separate commit messages (worst case).

Closes #1351

@MaxBetzDLR MaxBetzDLR added the loc::python interface This issue concerns the python interface to the backend implementation. label Sep 8, 2025
@MaxBetzDLR MaxBetzDLR linked an issue Sep 8, 2025 that may be closed by this pull request
2 tasks
@MaxBetzDLR MaxBetzDLR added the model::sde This issue concerns any kind of stochastic differential equation-based model. label Sep 8, 2025
@MaxBetzDLR MaxBetzDLR requested a review from jubicker September 8, 2025 14:26
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.24%. Comparing base (10447f3) to head (52da059).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1371      +/-   ##
==========================================
- Coverage   97.28%   97.24%   -0.05%     
==========================================
  Files         174      174              
  Lines       15153    15153              
==========================================
- Hits        14742    14735       -7     
- Misses        411      418       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.



def run_sde_sir_simulation():
"""Runs the c++ SDE SIR model"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Runs the c++ SDE SIR model"""
"""Runs SDE SIR model"""

def run_sde_sir_simulation():
"""Runs the c++ SDE SIR model"""

# Define population of age groups
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the comment. This is the total population, right? Does the SDE model even have age groups?

# Define population of age groups
population = 10000

days = 5. # number of days to simulate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
days = 5. # number of days to simulate
tmax = 5. # simulation time frame

days = 5. # number of days to simulate
dt = 0.1

# Initialize Parameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Initialize Parameters
# Initialize model

# Initialize Parameters
model = Model()

# Compartment transition duration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Compartment transition duration
# Mean time in Infected compartment


def test_check_constraints_parameters(self):
model = Model()
# valid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a very well-formulated comment

vals = result[i]
self.assertEqual(len(vals), 3)
# Non-negativity
self.assertTrue(np.all(np.array(vals) >= -1e-10))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't >= 0 work here?

#############################################################################
# Copyright (C) 2020-2025 MEmilio
#
# Authors:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Author missing

def setUp(self):
# Initialize model similar to the sde_sirs_simple example
self.population = 10000
self.days = 5.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.days = 5.0
self.tmax = 5.0

vals = result[i]
self.assertEqual(len(vals), 3)
# Non-negativity
self.assertTrue(np.all(np.array(vals) >= -1e-8))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you use e-8 here and e-10 for the SSIR example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
loc::python interface This issue concerns the python interface to the backend implementation. model::sde This issue concerns any kind of stochastic differential equation-based model.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PyMio interface for SDE SIR-type models
3 participants