<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Simon Dobson (Posts about epydemic)</title><link>https://simondobson.org/</link><description></description><atom:link href="https://simondobson.org/categories/epydemic.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:simoninireland@gmail.com"&gt;Simon Dobson&lt;/a&gt; </copyright><lastBuildDate>Fri, 07 Aug 2026 09:08:09 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>New release of epydemic</title><link>https://simondobson.org/2024/11/29/new-release-of-epydemic/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div id="outline-container-org0c1efed" class="outline-2"&gt;
&lt;h2 id="org0c1efed"&gt;New release of epydemic&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org0c1efed"&gt;
&lt;p&gt;
It's been a while – about 15 months since v.1.13.1 – but today I
finally released v.1.14.1 of &lt;code&gt;epydemic&lt;/code&gt;, a library for epidemic (and)
other simulation over complex networks.
&lt;/p&gt;

&lt;p&gt;
This release include several bug-fixes and two major changes.
&lt;/p&gt;
&lt;/div&gt;
&lt;div id="outline-container-orgb28d1d3" class="outline-3"&gt;
&lt;h3 id="orgb28d1d3"&gt;Better Newman-Ziff percolation&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-orgb28d1d3"&gt;
&lt;p&gt;
The Newman-Ziff algorithm for bond and site percolation is widely
used. The version that's been in &lt;code&gt;epydemic&lt;/code&gt; for a while emphasise
speed over everything. However, in the course of some work by one
of my MSc students on how grids of different dimensions respond to
random failure, we discovered that we needed to be able to do some
more flexible operations. In particular, we wanted to sample things
other than just the size of the largest connected component, and
wanted to be able to dig into to exactly how the network was
deforming.
&lt;/p&gt;

&lt;p&gt;
The problem was that this information wasn't readily available. It
&lt;i&gt;was&lt;/i&gt; encoded within the algorithm's data structure, but it wasn't
being reflected as an evolving network that was easy to get at. So
we upgraded the algorithm to build a working copy of the network as
it was constructed, so that it could be interrogated by
normal &lt;code&gt;networkx&lt;/code&gt; operations within the sampling process. This adds
some time penalty, but it's acceptable slowdown for the extra
capability.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org88cc177" class="outline-3"&gt;
&lt;h3 id="org88cc177"&gt;Multiple process instances&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org88cc177"&gt;
&lt;p&gt;
&lt;code&gt;epydemic&lt;/code&gt; defines different epidemic processes (and indeed
non-disease processes like pulse-coupled oscillators). Until now
these have been usable alone in a simulation, but not together: one
couldn't run &lt;i&gt;two&lt;/i&gt; diseases in the &lt;i&gt;same&lt;/i&gt; simulation over the &lt;i&gt;same&lt;/i&gt;
population simultaneously. Doing so is obviously very desirable,
especially if you want to explore co-infecting diseases.
&lt;/p&gt;

&lt;p&gt;
Co-infection is a difficult problem. As a first step we've added
multiple process instances which can have their own parameters and
results – or can share parameters if required. This involves
assigning distinct names to each instance, and then optionally
using them to decorate parameter/result names.
&lt;/p&gt;

&lt;p&gt;
This is fiddly if done manually, so we also added some methods on
the &lt;code&gt;Process&lt;/code&gt; class to get and set parameters and results using any
instance name on the calling process. For example:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;   &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

   &lt;span class="c1"&gt;# network&lt;/span&gt;
   &lt;span class="n"&gt;N&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;
   &lt;span class="n"&gt;kmean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
   &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;ERNetwork&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;
   &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;ERNetwork&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;KMEAN&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;kmean&lt;/span&gt;

   &lt;span class="c1"&gt;# first infection&lt;/span&gt;
   &lt;span class="n"&gt;p1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Disease1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setParameters&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;P_INFECT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;P_INFECTED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;5.0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;
                         &lt;span class="p"&gt;})&lt;/span&gt;

   &lt;span class="c1"&gt;# second infection&lt;/span&gt;
   &lt;span class="n"&gt;p2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Disease2"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="n"&gt;p2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setParameters&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;P_INFECT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;P_INFECTED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;5.0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;
                         &lt;span class="p"&gt;})&lt;/span&gt;

   &lt;span class="c1"&gt;# common removal rate&lt;/span&gt;
   &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SIR&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;P_REMOVE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.005&lt;/span&gt;

   &lt;span class="c1"&gt;# run the processes together&lt;/span&gt;
   &lt;span class="n"&gt;ps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ProcessSequence&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
   &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;StochasticDynamics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ERNetwork&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
   &lt;span class="n"&gt;rc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fatal&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
The &lt;code&gt;setParameters&lt;/code&gt; call sets the parameters decorated with the name
of the process, if it has one. There are other operations for
extracting the parameters, and for interacting with experimental
results without getting into the details of decoration.
&lt;/p&gt;

&lt;p&gt;
See &lt;a href="https://pypi.org/project/epydemic/"&gt;the project documentation&lt;/a&gt; for more details, as well as an
updated tutorial and a cookbook recipe for co-infection (which is
based around the code above). The &lt;a href="https://github.com/simoninireland/epydemic"&gt;Github repo&lt;/a&gt; is also available. To
upgrade, just run:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;   &lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;upgrade&lt;/span&gt; &lt;span class="n"&gt;epydemic&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
or delete and re-build any virtual environments.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>epydemic</category><category>network science</category><category>software</category><guid>https://simondobson.org/2024/11/29/new-release-of-epydemic/</guid><pubDate>Fri, 29 Nov 2024 16:35:46 GMT</pubDate></item><item><title>epydemic hits 100,000 downloads</title><link>https://simondobson.org/2024/05/08/epydemic-100000/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div id="outline-container-org9f8632c" class="outline-2"&gt;
&lt;h2 id="org9f8632c"&gt;epydemic hits 100,000 downloads&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org9f8632c"&gt;
&lt;p&gt;
Downloads of &lt;code&gt;epydemic&lt;/code&gt;, my &lt;a href="/development/projects/epydemic/"&gt;library&lt;/a&gt; for epidemic (and other) process
simulation on networks (and hopefully other combinatorial structures
soon…) recently passed 100,000.
&lt;/p&gt;

&lt;p&gt;
That number comes from the project's &lt;a href="https://www.pepy.tech/projects/epydemic"&gt;PePy page&lt;/a&gt;, which tracks
downloads from the main &lt;a href="https://pypi.org/project/epydemic/"&gt;PyPi page&lt;/a&gt; as used by &lt;code&gt;pip&lt;/code&gt;. I can't say
whether or not that number is accurate. Quite honestly it's at least
98,000 more than I ever expected, but 100,000 feels like something
of a milestone to be pleased about.
&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;epydemic&lt;/code&gt; came about because of a lack of standard tooling for doing
epidemic simulation. This involves a lot of stochastic simulation,
which is quite tricky code to write and to make efficient. Testing
the system actually involved us thinking more deeply about the
effectiveness of unit testing for stochastic code, which then led to
a &lt;a href="/softcopy/stochastic-testing-21.pdf"&gt;presentation at UK Systems in 2021&lt;/a&gt; explaining the problems we'd
had.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>epydemic</category><category>software</category><guid>https://simondobson.org/2024/05/08/epydemic-100000/</guid><pubDate>Wed, 08 May 2024 15:21:29 GMT</pubDate></item><item><title>Notes on using Jupyter in the cloud</title><link>https://simondobson.org/2022/12/02/jupyter-in-the-cloud/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div id="outline-container-org5aafa10" class="outline-2"&gt;
&lt;h2 id="org5aafa10"&gt;Notes on using Jupyter in the cloud&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org5aafa10"&gt;
&lt;p&gt;
I've been thinking about running &lt;a href="https://jupyter.org"&gt;Jupyter notebooks&lt;/a&gt; in the cloud for
some fairly compute-intensive simulation. Specifically I want to do
epidemic and other simulations over complex networks. These are
CPU-intensive and don't make use of GPU acceleration (yet, anyway).
Using the cloud would make things easier to scale-out, especially
for those without access to a local compute cluster.
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://simondobson.org/2022/12/02/jupyter-in-the-cloud/"&gt;Read more…&lt;/a&gt; (6 min remaining to read)&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</description><category>cloud computing</category><category>computational science</category><category>epydemic</category><category>jupyter</category><category>python</category><guid>https://simondobson.org/2022/12/02/jupyter-in-the-cloud/</guid><pubDate>Fri, 02 Dec 2022 16:36:55 GMT</pubDate></item><item><title>Talk at UK Systems on unit testing stochastic code</title><link>https://simondobson.org/2021/12/06/talk-at-uk-systems-on-unit-testing-stochastic-code/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div&gt;&lt;p&gt;Last week I went to my first scientific meeting since February 2021 to
talk about unit testing of stochastic code.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://simondobson.org/2021/12/06/talk-at-uk-systems-on-unit-testing-stochastic-code/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>epydemic</category><category>python</category><category>talk</category><category>unit testing</category><guid>https://simondobson.org/2021/12/06/talk-at-uk-systems-on-unit-testing-stochastic-code/</guid><pubDate>Mon, 06 Dec 2021 16:49:30 GMT</pubDate></item><item><title>Generating functions for epydemic</title><link>https://simondobson.org/2021/06/10/generating-functions-for-epydemic/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div&gt;&lt;p&gt;The next version of &lt;code&gt;epydemic&lt;/code&gt; has just been released. It now
includes a generating functions library.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://simondobson.org/2021/06/10/generating-functions-for-epydemic/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>complex networks</category><category>development</category><category>epidemic spreading</category><category>epydemic</category><category>generating functions</category><category>python</category><category>simulation</category><guid>https://simondobson.org/2021/06/10/generating-functions-for-epydemic/</guid><pubDate>Thu, 10 Jun 2021 17:22:16 GMT</pubDate></item><item><title>New, faster, release of epydemic</title><link>https://simondobson.org/2021/05/14/new-faster-release-of-epydemic/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div&gt;&lt;p&gt;I just made a new release of &lt;code&gt;epydemic&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://simondobson.org/2021/05/14/new-faster-release-of-epydemic/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>complex networks</category><category>development</category><category>epidemic spreading</category><category>epydemic</category><category>python</category><category>simulation</category><guid>https://simondobson.org/2021/05/14/new-faster-release-of-epydemic/</guid><pubDate>Fri, 14 May 2021 08:33:17 GMT</pubDate></item><item><title>A talk on "Exploring epidemic spreading using network models"</title><link>https://simondobson.org/2020/12/19/ima-talk/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;figure&gt;&lt;img src="https://simondobson.org/images/posts/20201219-waterfall.png"&gt;&lt;/figure&gt; &lt;div&gt;&lt;p&gt;I gave a talk by Zoom to the &lt;a href="https://ima.org.uk"&gt;Institute of Mathematics and its Applications&lt;/a&gt;
arising from my epidemic modelling &lt;a href="https://simondobson.org/writing/em-book/"&gt;book&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://simondobson.org/2020/12/19/ima-talk/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>complex networks</category><category>epidemic spreading</category><category>epydemic</category><category>talk</category><guid>https://simondobson.org/2020/12/19/ima-talk/</guid><pubDate>Sat, 19 Dec 2020 09:10:00 GMT</pubDate></item><item><title>Backporting Python type annotations</title><link>https://simondobson.org/2020/12/09/backporting-python-types/</link><dc:creator>Simon Dobson</dc:creator><description>&lt;div&gt;&lt;p&gt;I recently added type annotations to my
&lt;a href="https://simondobson.org/development/epyc/"&gt;&lt;code&gt;epyc&lt;/code&gt;&lt;/a&gt; and
&lt;a href="https://simondobson.org/development/epydemic/"&gt;&lt;code&gt;epydemic&lt;/code&gt;&lt;/a&gt; libraries. Making these work
while not sacrificing interoperability a wide range of Python versions
is quite delicate.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://simondobson.org/2020/12/09/backporting-python-types/"&gt;Read more…&lt;/a&gt; (5 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>epyc</category><category>epydemic</category><category>programming</category><category>python</category><guid>https://simondobson.org/2020/12/09/backporting-python-types/</guid><pubDate>Wed, 09 Dec 2020 10:45:43 GMT</pubDate></item></channel></rss>