Skip to content

Commit

Permalink
A few changes - added scipy to requirements
Browse files Browse the repository at this point in the history
put more steps into __init__ all to ease import syntax
Did more work fitting SI/SIS, etc. models and got SIR model running
Switched transmission.py to exponential distribution for infectious period, to improve match to compartmental models
  • Loading branch information
KevinMcCarthyAtIDM committed Dec 6, 2024
1 parent e99e60b commit f9ea887
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions notebooks/example_SIS_nobirths.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -32,14 +32,14 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2024-12-06 18:10:18.916065: Creating the generic model…\n",
"2024-12-06 18:24:58.435154: Creating the generic model…\n",
"Initializing the generic model with 1 patches…\n"
]
}
Expand All @@ -57,33 +57,33 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2024-12-06 18:10:20.316939: Running the generic model for 730 ticks…\n"
"2024-12-06 18:24:58.949071: Running the generic model for 730 ticks…\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 730/730 [00:06<00:00, 107.24it/s]\n"
"100%|██████████| 730/730 [00:22<00:00, 32.50it/s] \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Completed the generic model at 2024-12-06 18:10:27.132344\n",
"Model : 5,006 µs\n",
"Transmission : 5,780,040 µs\n",
"Infection_SIS: 920,323 µs\n",
"Completed the generic model at 2024-12-06 18:25:21.424122\n",
"Model : 25,950 µs\n",
"Transmission : 14,722,149 µs\n",
"Infection_SIS: 6,900,775 µs\n",
"===============================\n",
"Total: 6,705,369 microseconds\n"
"Total: 21,648,874 microseconds\n"
]
}
],
Expand All @@ -96,16 +96,16 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x76f3e44bd6d0>]"
"[<matplotlib.lines.Line2D at 0x7b7f99a09820>]"
]
},
"execution_count": 50,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -140,19 +140,15 @@
{
"data": {
"text/plain": [
"0.8888888888888888"
"0.03333333333333333"
]
},
"execution_count": 51,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1-1/90/.1\n",
"\n",
"np.mean(model.patches.cases[-365:])"
]
"source": []
},
{
"cell_type": "code",
Expand Down

0 comments on commit f9ea887

Please sign in to comment.