-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
milad edited this page May 10, 2026
·
2 revisions
This guide will help you install and run your first epidemic simulation in minutes.
Before you begin, make sure you have:
| Requirement | Version | Check Command |
|---|---|---|
| Python | 3.8 or higher | python --version |
| pip | Latest | pip --version |
| Git (optional) | Any | git --version |
pip install sir-epidemicgit clone https://github.com/miladrezanezhad/sir_simulator.git
cd sir_simulator
pip install -e .git clone https://github.com/miladrezanezhad/sir_simulator.git
cd sir_simulator
pip install -r requirements.txtpython -c "import sir_simulator; print('โ
Success!')"sir-simulator --beta 0.5 --gamma 0.2 --tmax 100Expected output:
๐ฆ Running SIR Simulation...
Parameters: beta=0.5, gamma=0.2
โ
Simulation complete!
๐ Output shape: (500, 4)
๐ Last 5 rows:
time Susceptible Infected Recovered
495 99.198397 105.895275 0.003002 894.101723
496 99.398798 105.895244 0.002915 894.101842
...
๐พ Saved to: simulation_output.csv
streamlit run src/sir_simulator/user_interface/app.pyThen open http://localhost:8501 in your browser.
python main.pyYou'll see:
๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ
SIR EPIDEMIC SIMULATOR
๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ ๐ฆ
MAIN MENU
----------------------------------------
1. Run SIR Model
2. Run SEIR Model
3. Run Network Simulation
4. Parameter Optimization
5. ML Prediction
6. Scenario Comparison
7. Run All Tests
0. Exit
python run_all_tests.pyExpected output:
Ran 35 tests in 3.233s
OK
============================================================
โ
Tests Run: 35
โ
Successes: 35
โ Failures: 0
โ ๏ธ Errors: 0
============================================================
The CLI automatically saves results to simulation_output.csv with columns:
| Column | Description |
|---|---|
time |
Time in days |
Susceptible |
Number of susceptible individuals |
Infected |
Number of infected individuals |
Recovered |
Number of recovered individuals |
| Metric | Meaning |
|---|---|
| Rโ | Basic reproduction number (beta/gamma) |
| Peak Infected | Maximum number of infected individuals |
| Peak Day | Day when peak infection occurs |
| Final Size | Total number recovered at the end |
sir-simulator --beta 0.8 --gamma 0.1 --tmax 100sir-simulator --beta 0.2 --gamma 0.3 --tmax 100sir-simulator --beta 0.5 --gamma 0.5 --tmax 100sir-simulator --beta 0.5 --gamma 0.2 --S0 10000 --I0 100 --tmax 200Solution: Install the package in development mode:
pip install -e .Solution: Install streamlit:
pip install streamlitSolution: Update to the latest version (v1.0.1+):
pip install --upgrade sir-epidemicSolution: Install all dependencies:
pip install -r requirements.txtNow that you've run your first simulation, explore:
- SIR Model Tutorial - Deep dive into SIR model
- SEIR Model Tutorial - Learn about exposed compartment
- Network Simulation Tutorial - Simulate social network spread
- ML Prediction Tutorial - Use machine learning for forecasting
- FAQ - Common questions and answers