Skip to content

Commit 1fcfee9

Browse files
committed
Fix documentation issues.
1 parent c25b5f9 commit 1fcfee9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

docs/source/tutorials/disease_model.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ initial population of simulants. It also notes that there is a
9191
`'population_size'` key. This key has a default value set by Vivarium's
9292
population management system.
9393

94-
Where's the ``__init__()``?
95-
+++++++++++++++++++++++++++
94+
The ``__init__()`` method
95+
+++++++++++++++++++++++++
9696

9797
Though Vivarium components are represented are represented by Python
9898
`classes <https://docs.python.org/3/tutorial/classes.html>`_ you'll notice
99-
that many of the classes we write lack the typical ``__init__`` constructor.
99+
that many of the classes have very sparse ``__init__`` methods.
100100
Due to the way the simulation bootstraps itself, the ``__init__`` method is
101101
usually only used to assign names to generic components and muck with
102102
the ``configuration_defaults`` a bit. We'll see more of this later.
@@ -108,7 +108,7 @@ Instead of the ``__init__`` method, most of the component initialization
108108
takes place in the ``setup`` method.
109109

110110
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
111-
:lines: 28, 40-59
111+
:lines: 31, 43-62
112112
:dedent: 4
113113
:linenos:
114114

@@ -154,7 +154,7 @@ Line 2 simply grabs a copy of the simulation
154154
a dictionary that supports ``.``-access notation.
155155

156156
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
157-
:lines: 40
157+
:lines: 43
158158
:dedent: 4
159159
:linenos:
160160
:lineno-start: 2
@@ -169,7 +169,7 @@ it easier to perform counterfactual analysis. It's not important to have a full
169169
grasp of this system at this point.
170170

171171
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
172-
:lines: 42-47
172+
:lines: 45-50
173173
:dedent: 4
174174
:linenos:
175175
:lineno-start: 4
@@ -210,7 +210,7 @@ The next thing we do is grab actual
210210
from the framework.
211211

212212
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
213-
:lines: 49-51
213+
:lines: 52-54
214214
:dedent: 4
215215
:linenos:
216216
:lineno-start: 11
@@ -241,7 +241,7 @@ know that it is responsible for generating the ``'age'``, ``'sex'``,
241241
``'alive'``, and ``'entrance_time'`` columns in the population state table.
242242

243243
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
244-
:lines: 53-55
244+
:lines: 56-58
245245
:dedent: 4
246246
:linenos:
247247
:lineno-start: 15
@@ -261,7 +261,7 @@ know that it is responsible for generating the ``'age'``, ``'sex'``,
261261
Next we get a view into the population table.
262262

263263
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
264-
:lines: 57
264+
:lines: 60
265265
:dedent: 4
266266
:linenos:
267267
:lineno-start: 19
@@ -280,7 +280,7 @@ simulation. Any time the ``'time_step'`` event is called, the ``age_simulants``
280280
method will be called as well.
281281

282282
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
283-
:lines: 59
283+
:lines: 62
284284
:dedent: 4
285285
:linenos:
286286
:lineno-start: 21
@@ -304,7 +304,7 @@ describe where in the simulation life-cycle they occur. This helps me think
304304
more clearly about what's going on and helps debugging.
305305

306306
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
307-
:lines: 61, 87-111
307+
:lines: 64, 90-114
308308
:dedent: 4
309309
:linenos:
310310

@@ -348,7 +348,7 @@ we specified an ``'age_start'`` and ``'age_end'``. Here we use these
348348
to generate the age distribution of our initial population.
349349

350350
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
351-
:lines: 87-95
351+
:lines: 90-98
352352
:dedent: 4
353353
:linenos:
354354
:lineno-start: 2
@@ -388,7 +388,7 @@ These ``key_columns`` are what the randomness system uses to uniquely
388388
identify simulants across simulations.
389389

390390
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
391-
:lines: 97-102
391+
:lines: 100-105
392392
:dedent: 4
393393
:linenos:
394394
:lineno-start: 2
@@ -408,7 +408,7 @@ If we're not using CRN, we can just generate the full set of simulant
408408
attributes straightaway.
409409

410410
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
411-
:lines: 103-109
411+
:lines: 106-112
412412
:dedent: 4
413413
:linenos:
414414
:lineno-start: 2
@@ -434,7 +434,7 @@ The last piece of our population component is the ``'time_step'`` listener
434434
method ``age_simulants``.
435435

436436
.. literalinclude:: ../../../src/vivarium/examples/disease_model/population.py
437-
:lines: 113, 123-125
437+
:lines: 116, 126-128
438438
:dedent: 4
439439
:linenos:
440440

@@ -585,7 +585,7 @@ Many of the tools we explored in the ``BasePopulation`` component are
585585
used again here. There are two new things to look at.
586586

587587
.. literalinclude:: ../../../src/vivarium/examples/disease_model/mortality.py
588-
:lines: 25, 37-43
588+
:lines: 28, 40-46
589589
:dedent: 4
590590
:linenos:
591591

@@ -629,7 +629,7 @@ a ``pandas.Series`` that assigns each individual the mortality rate
629629
specified in the configuration.
630630

631631
.. literalinclude:: ../../../src/vivarium/examples/disease_model/mortality.py
632-
:lines: 45, 58
632+
:lines: 48, 61
633633
:dedent: 4
634634
:linenos:
635635

@@ -646,7 +646,7 @@ Like our aging method in the population component, our ``determine_deaths``
646646
method responds to ``'time_step'`` events.
647647

648648
.. literalinclude:: ../../../src/vivarium/examples/disease_model/mortality.py
649-
:lines: 60, 70-74
649+
:lines: 63, 73-77
650650
:dedent: 4
651651
:linenos:
652652

@@ -659,7 +659,7 @@ steps we're taking.
659659

660660
In lines 3-5, we determine who died this time step. We turn our mortality rate
661661
into a probability of death in the given time step by assuming deaths are
662-
`exponentially distributed`__ and using the inverse distribution function.
662+
`exponentially distributed`_ and using the inverse distribution function.
663663
We then draw a uniformly distributed random number for each person and
664664
determine who died by comparing that number to the computed probability of
665665
death for the individual.

0 commit comments

Comments
 (0)