Skip to content

Commit

Permalink
Add units and groundings fror scenario 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bgyori committed Jul 8, 2023
1 parent cac7c2f commit a3ebf01
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 45 deletions.
30 changes: 17 additions & 13 deletions notebooks/hackathon_2023.07/scenario1.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "c947d97c",
"metadata": {},
Expand Down Expand Up @@ -38,13 +39,14 @@
"day_units = Unit(expression=sympy.Symbol('day'))\n",
"per_day_units = Unit(expression=1/sympy.Symbol('day'))\n",
"dimensionless_units = Unit(expression=sympy.Integer('1'))\n",
"per_day_per_person_units = Unit(expression=1/(sympy.Symbol('day')*sympy.Symbol('person')))\n",
"\n",
"c = {\n",
" 'S': Concept(name='S', units=person_units),\n",
" 'E': Concept(name='E', units=person_units),\n",
" 'I': Concept(name='I', units=person_units),\n",
" 'R': Concept(name='R', units=person_units),\n",
" 'D': Concept(name='D', units=person_units)\n",
" 'S': Concept(name='S', units=person_units, identifiers={'ido': '0000514'}),\n",
" 'E': Concept(name='E', units=person_units, identifiers={'apollosv': '0000154'}),\n",
" 'I': Concept(name='I', units=person_units, identifiers={'ido': '0000511'}),\n",
" 'R': Concept(name='R', units=person_units, identifiers={'ido': '0000592'}),\n",
" 'D': Concept(name='D', units=person_units, identifiers={'ncit': 'C28554'}),\n",
"}\n",
"\n",
"\n",
Expand All @@ -54,13 +56,13 @@
" 'alpha': Parameter(name='alpha', value=0.000064, units=dimensionless_units),\n",
" 'rho': Parameter(name='rho', value=1/9, units=per_day_units),\n",
" 'N': Parameter(name='N', value=5_600_000, units=person_units),\n",
" 'beta_s': Parameter(name='beta_s', value=1),\n",
" 'beta_c': Parameter(name='beta_c', value=0.4),\n",
" 't_0': Parameter(name='t_0', value=89, unts=day_units),\n",
" 'beta_s': Parameter(name='beta_s', value=1, units=per_day_per_person_units),\n",
" 'beta_c': Parameter(name='beta_c', value=0.4, units=per_day_per_person_units),\n",
" 't_0': Parameter(name='t_0', value=89, unts=day_units, units=day_units),\n",
" # D=11, gamma = 1/D, R_0 = 5 and\n",
" # beta = R_0 * gamma * mask(t) so kappa = 5/11\n",
" 'kappa': Parameter(name='kappa', value=5/11),\n",
" 'k': Parameter(name='k', value=5.0)\n",
" 'kappa': Parameter(name='kappa', value=5/11, units=per_day_units),\n",
" 'k': Parameter(name='k', value=5.0, units=dimensionless_units),\n",
"}\n",
"\n",
"initials = {\n",
Expand Down Expand Up @@ -118,6 +120,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "48e4ed6a",
"metadata": {},
Expand All @@ -137,8 +140,8 @@
"outputs": [],
"source": [
"k_1, k_2, t_1, beta_nc = sympy.symbols('k_1 k_2 t_1 beta_nc')\n",
"parameters['k_1'] = Parameter(name='k_1', value=5.0)\n",
"parameters['k_2'] = Parameter(name='k_2', value=1.0)\n",
"parameters['k_1'] = Parameter(name='k_1', value=5.0, units=dimensionless_units)\n",
"parameters['k_2'] = Parameter(name='k_2', value=1.0, units=dimensionless_units)\n",
"parameters['t_1'] = Parameter(name='t_1', value=154, units=day_units)\n",
"parameters['beta_nc'] = Parameter(name='beta_nc', value=0.5)\n",
"tm.parameters = parameters\n",
Expand Down Expand Up @@ -191,6 +194,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "6e3374f9",
"metadata": {},
Expand All @@ -207,7 +211,7 @@
"outputs": [],
"source": [
"epsilon = sympy.Symbol('epsilon')\n",
"parameters['epsilon'] = Parameter(name='epsilon', value=1/90)\n",
"parameters['epsilon'] = Parameter(name='epsilon', value=1/90, units=per_day_units)\n",
"tm.parameters = parameters\n",
"tm.annotations = Annotations(name='Scenario 1d')\n",
"t5 = NaturalConversion(subject=c['R'],\n",
Expand Down
50 changes: 40 additions & 10 deletions notebooks/hackathon_2023.07/scenario1_a.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"id": "S",
"name": "S",
"grounding": {
"identifiers": {},
"identifiers": {
"ido": "0000514"
},
"modifiers": {}
},
"units": {
Expand All @@ -23,7 +25,9 @@
"id": "I",
"name": "I",
"grounding": {
"identifiers": {},
"identifiers": {
"ido": "0000511"
},
"modifiers": {}
},
"units": {
Expand All @@ -35,7 +39,9 @@
"id": "E",
"name": "E",
"grounding": {
"identifiers": {},
"identifiers": {
"apollosv": "0000154"
},
"modifiers": {}
},
"units": {
Expand All @@ -47,7 +53,9 @@
"id": "R",
"name": "R",
"grounding": {
"identifiers": {},
"identifiers": {
"ido": "0000592"
},
"modifiers": {}
},
"units": {
Expand All @@ -59,7 +67,9 @@
"id": "D",
"name": "D",
"grounding": {
"identifiers": {},
"identifiers": {
"ncit": "C28554"
},
"modifiers": {}
},
"units": {
Expand Down Expand Up @@ -183,23 +193,43 @@
},
{
"id": "beta_c",
"value": 0.4
"value": 0.4,
"units": {
"expression": "1/(day*person)",
"expression_mathml": "<apply><divide/><cn>1</cn><apply><times/><ci>day</ci><ci>person</ci></apply></apply>"
}
},
{
"id": "beta_s",
"value": 1.0
"value": 1.0,
"units": {
"expression": "1/(day*person)",
"expression_mathml": "<apply><divide/><cn>1</cn><apply><times/><ci>day</ci><ci>person</ci></apply></apply>"
}
},
{
"id": "k",
"value": 5.0
"value": 5.0,
"units": {
"expression": "1",
"expression_mathml": "<cn>1</cn>"
}
},
{
"id": "kappa",
"value": 0.45454545454545453
"value": 0.45454545454545453,
"units": {
"expression": "1/day",
"expression_mathml": "<apply><power/><ci>day</ci><cn>-1</cn></apply>"
}
},
{
"id": "t_0",
"value": 89.0
"value": 89.0,
"units": {
"expression": "day",
"expression_mathml": "<ci>day</ci>"
}
},
{
"id": "delta",
Expand Down
56 changes: 45 additions & 11 deletions notebooks/hackathon_2023.07/scenario1_c.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"id": "S",
"name": "S",
"grounding": {
"identifiers": {},
"identifiers": {
"ido": "0000514"
},
"modifiers": {}
},
"units": {
Expand All @@ -23,7 +25,9 @@
"id": "I",
"name": "I",
"grounding": {
"identifiers": {},
"identifiers": {
"ido": "0000511"
},
"modifiers": {}
},
"units": {
Expand All @@ -35,7 +39,9 @@
"id": "E",
"name": "E",
"grounding": {
"identifiers": {},
"identifiers": {
"apollosv": "0000154"
},
"modifiers": {}
},
"units": {
Expand All @@ -47,7 +53,9 @@
"id": "R",
"name": "R",
"grounding": {
"identifiers": {},
"identifiers": {
"ido": "0000592"
},
"modifiers": {}
},
"units": {
Expand All @@ -59,7 +67,9 @@
"id": "D",
"name": "D",
"grounding": {
"identifiers": {},
"identifiers": {
"ncit": "C28554"
},
"modifiers": {}
},
"units": {
Expand Down Expand Up @@ -175,31 +185,55 @@
"parameters": [
{
"id": "beta_c",
"value": 0.4
"value": 0.4,
"units": {
"expression": "1/(day*person)",
"expression_mathml": "<apply><divide/><cn>1</cn><apply><times/><ci>day</ci><ci>person</ci></apply></apply>"
}
},
{
"id": "beta_nc",
"value": 0.5
},
{
"id": "beta_s",
"value": 1.0
"value": 1.0,
"units": {
"expression": "1/(day*person)",
"expression_mathml": "<apply><divide/><cn>1</cn><apply><times/><ci>day</ci><ci>person</ci></apply></apply>"
}
},
{
"id": "k_1",
"value": 5.0
"value": 5.0,
"units": {
"expression": "1",
"expression_mathml": "<cn>1</cn>"
}
},
{
"id": "k_2",
"value": 1.0
"value": 1.0,
"units": {
"expression": "1",
"expression_mathml": "<cn>1</cn>"
}
},
{
"id": "kappa",
"value": 0.45454545454545453
"value": 0.45454545454545453,
"units": {
"expression": "1/day",
"expression_mathml": "<apply><power/><ci>day</ci><cn>-1</cn></apply>"
}
},
{
"id": "t_0",
"value": 89.0
"value": 89.0,
"units": {
"expression": "day",
"expression_mathml": "<ci>day</ci>"
}
},
{
"id": "t_1",
Expand Down
Loading

0 comments on commit a3ebf01

Please sign in to comment.