-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Common questions and answers about the SIR Epidemic Simulator.
- Installation Questions
- Usage Questions
- Model Questions
- Technical Questions
- Troubleshooting
- Feature Questions
- Contributing Questions
pip install sir-epidemicPython 3.8 or higher. Check your version:
python --versionSolution: Install the package in development mode:
pip install -e .Or from PyPI:
pip install sir-epidemicSolution: Install pip first:
- Windows:
python -m ensurepip - Linux/Mac:
sudo apt install python3-pip(Ubuntu/Debian)
pip install xgboostOr install all dependencies:
pip install -r requirements.txtstreamlit run src/sir_simulator/user_interface/app.pyThen open http://localhost:8501 in your browser.
sir-simulator --beta 0.5 --gamma 0.2 --tmax 100CLI automatically saves to simulation_output.csv. In the dashboard, click the "Download CSV" button.
Yes! For parameter optimization, upload a CSV with 'day' and 'cases' columns.
# 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')| Feature | SIR | SEIR |
|---|---|---|
| Compartments | 3 | 4 |
| Incubation period | No | Yes |
| Realism | Basic | More realistic |
| Complexity | Simple | Moderate |
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
Network simulation captures social structure:
- Super-spreaders (highly connected individuals)
- Community structure (clusters)
- Targeted interventions (vaccinate influencers)
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
Combined (quarantine + vaccination) is usually most effective:
- Quarantine: immediate but temporary
- Vaccination: permanent but requires time
- Combined: best of both worlds
python run_all_tests.py
python -m unittest discover tests/securitycoverage run --source=src/sir_simulator -m unittest discover tests
coverage report
coverage html # Opens HTML reportpython -m buildCheck CONTRIBUTING.md
Email: miladvf2014@gmail.com
See SECURITY.md
Problem: Terminal can't display emojis.
Solution: Update to v1.0.1+:
pip install --upgrade sir-epidemicOr set UTF-8 encoding:
chcp 65001Solution: Install all dependencies:
pip install -r requirements.txtSolution: Check console for errors. Try:
streamlit run src/sir_simulator/user_interface/app.py --server.enableCORS falseSolution: Install in development mode:
pip install -e .Solution: Reduce network size:
# Instead of
sim = SocialNetworkSimulator(num_nodes=5000)
# Try
sim = SocialNetworkSimulator(num_nodes=1000)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 hereCurrently not directly, but you can run multiple simulations with different parameters and compare results.
Not yet. Planned for v1.1.0 (future release).
Currently only CSV. Feature request welcome!
Not yet. Planned for v2.0.0 (future release).
git clone https://github.com/miladrezanezhad/sir_simulator.git
cd sir_simulator
pip install -e .
pip install -r requirements_dev.txt
pre-commit install- Black for formatting (line length 88)
- isort for import sorting
- flake8 for linting
- mypy for type checking
Run formatters:
black .
isort .
flake8 .- Fork the repository
- Create a feature branch
- Write code with tests
- Run tests:
python run_all_tests.py - Submit a Pull Request
See CONTRIBUTING.md for details.
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)Update relevant .md files and submit a PR. For API docs, update docstrings.
| Channel | Link |
|---|---|
| GitHub Issues | Open an issue |
| Discussions | Start a discussion |
| miladvf2014@gmail.com |
- Main README
- Getting Started
- SIR Model Tutorial
- SEIR Model Tutorial
- Network Simulation Tutorial
- ML Prediction Tutorial
- Scenario Comparison Tutorial
- API Reference
- Contributing Guide