Skip to content
milad edited this page May 10, 2026 · 3 revisions

Common questions and answers about the SIR Epidemic Simulator.


๐Ÿ“‹ Table of Contents


๐Ÿ’พ Installation Questions

Q1: How do I install the package?

pip install sir-epidemic

Q2: What Python version do I need?

Python 3.8 or higher. Check your version:

python --version

Q3: I get "ModuleNotFoundError: No module named 'sir_simulator'"

Solution: Install the package in development mode:

pip install -e .

Or from PyPI:

pip install sir-epidemic

Q4: I get "pip: command not found"

Solution: Install pip first:

  • Windows: python -m ensurepip
  • Linux/Mac: sudo apt install python3-pip (Ubuntu/Debian)

Q5: How do I install optional dependencies (XGBoost)?

pip install xgboost

Or install all dependencies:

pip install -r requirements.txt

๐ŸŽฎ Usage Questions

Q6: How do I run the Streamlit dashboard?

streamlit run src/sir_simulator/user_interface/app.py

Then open http://localhost:8501 in your browser.

Q7: How do I run the CLI?

sir-simulator --beta 0.5 --gamma 0.2 --tmax 100

Q8: How do I save simulation results?

CLI automatically saves to simulation_output.csv. In the dashboard, click the "Download CSV" button.

Q9: Can I use my own data?

Yes! For parameter optimization, upload a CSV with 'day' and 'cases' columns.

Q10: How do I change network type?

# Scale-free (power law)
sim = SocialNetworkSimulator(num_nodes=200, network_type='scale_free')

# Small-world
sim = SocialNetworkSimulator(num_nodes=200, network_type='small_world')

# Random
sim = SocialNetworkSimulator(num_nodes=200, network_type='random')

๐Ÿ“Š Model Questions

Q11: What is the difference between SIR and SEIR?

Feature SIR SEIR
Compartments 3 4
Incubation period No Yes
Realism Basic More realistic
Complexity Simple Moderate

Q12: How is Rโ‚€ calculated?

Rโ‚€ = ฮฒ / ฮณ
  • Rโ‚€ > 1: Disease spreads (epidemic)
  • Rโ‚€ = 1: Disease becomes endemic
  • Rโ‚€ < 1: Disease dies out

Real-world examples:

  • Seasonal flu: Rโ‚€ โ‰ˆ 1.3
  • COVID-19: Rโ‚€ โ‰ˆ 2.5-3.0
  • Measles: Rโ‚€ โ‰ˆ 12-18

Q13: Why use network simulation instead of SIR?

Network simulation captures social structure:

  • Super-spreaders (highly connected individuals)
  • Community structure (clusters)
  • Targeted interventions (vaccinate influencers)

Q14: How accurate are ML predictions?

Depends on data quality and quantity:

  • Good: Rยฒ > 0.8, 100+ days of data
  • Moderate: Rยฒ 0.5-0.8, 50-100 days
  • Poor: Rยฒ < 0.5, < 50 days

Q15: What's the best intervention strategy?

Combined (quarantine + vaccination) is usually most effective:

  • Quarantine: immediate but temporary
  • Vaccination: permanent but requires time
  • Combined: best of both worlds

๐Ÿ”ง Technical Questions

Q16: How do I run all tests?

python run_all_tests.py
python -m unittest discover tests/security

Q17: How do I check test coverage?

coverage run --source=src/sir_simulator -m unittest discover tests
coverage report
coverage html  # Opens HTML report

Q18: How do I build the package locally?

python -m build

Q19: How do I contribute to the project?

Check CONTRIBUTING.md

Q20: How do I report a security vulnerability?

Email: miladvf2014@gmail.com
See SECURITY.md


๐Ÿ› Troubleshooting

Q21: UnicodeEncodeError on Windows

Problem: Terminal can't display emojis.

Solution: Update to v1.0.1+:

pip install --upgrade sir-epidemic

Or set UTF-8 encoding:

chcp 65001

Q22: Tests are failing

Solution: Install all dependencies:

pip install -r requirements.txt

Q23: Streamlit dashboard shows blank page

Solution: Check console for errors. Try:

streamlit run src/sir_simulator/user_interface/app.py --server.enableCORS false

Q24: ImportError: cannot import name 'run_sir_simulation'

Solution: Install in development mode:

pip install -e .

Q25: MemoryError for large network

Solution: Reduce network size:

# Instead of
sim = SocialNetworkSimulator(num_nodes=5000)

# Try
sim = SocialNetworkSimulator(num_nodes=1000)

๐Ÿ’ก Feature Questions

Q26: Can I add my own ML model?

Yes! Extend the EpidemicPredictor class:

from sir_simulator.advanced_features.ml_prediction import EpidemicPredictor

class MyCustomPredictor(EpidemicPredictor):
    def __init__(self):
        super().__init__(model_type='custom')
        # Add your model here

Q27: Can I simulate multiple populations?

Currently not directly, but you can run multiple simulations with different parameters and compare results.

Q28: Is real-time data integration available?

Not yet. Planned for v1.1.0 (future release).

Q29: Can I export to JSON instead of CSV?

Currently only CSV. Feature request welcome!

Q30: Is there a REST API?

Not yet. Planned for v2.0.0 (future release).


๐Ÿค Contributing Questions

Q31: How do I set up a development environment?

git clone https://github.com/miladrezanezhad/sir_simulator.git
cd sir_simulator
pip install -e .
pip install -r requirements_dev.txt
pre-commit install

Q32: What code style is used?

  • Black for formatting (line length 88)
  • isort for import sorting
  • flake8 for linting
  • mypy for type checking

Run formatters:

black .
isort .
flake8 .

Q33: How do I add a new feature?

  1. Fork the repository
  2. Create a feature branch
  3. Write code with tests
  4. Run tests: python run_all_tests.py
  5. Submit a Pull Request

See CONTRIBUTING.md for details.

Q34: How do I write tests?

Add test files in tests/ directory:

import unittest
from sir_simulator.your_module import your_function

class TestYourFeature(unittest.TestCase):
    def test_something(self):
        result = your_function()
        self.assertEqual(result, expected)

Q35: How do I update documentation?

Update relevant .md files and submit a PR. For API docs, update docstrings.


๐Ÿ“ž Getting Help

Still have questions?

Channel Link
GitHub Issues Open an issue
Discussions Start a discussion
Email miladvf2014@gmail.com

๐Ÿ”— Useful Links


โฌ† Back to Home

Clone this wiki locally