Skip to content
Snippets Groups Projects
Commit c40fb95a authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 1.0.9

parent 6de1b864
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 1.0
Name: seirsplus
Version: 0.1.4
Version: 1.0.9
Summary: Models of SEIRS epidemic dynamics with extensions, including network-structured populations, testing, contact tracing, and social distancing.
Home-page: https://github.com/ryansmcgee/SEIRS-network-model
Author: Ryan Seamus McGee
Author-email: ryansmcgee@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
This diff is collapsed.
Metadata-Version: 1.0
Name: seirsplus
Version: 1.0.9
Summary: Models of SEIRS epidemic dynamics with extensions, including network-structured populations, testing, contact tracing, and social distancing.
Home-page: https://github.com/ryansmcgee/SEIRS-network-model
Author: Ryan Seamus McGee
Author-email: ryansmcgee@gmail.com
License: MIT
Description: UNKNOWN
Platform: UNKNOWN
README.md
setup.py
seirsplus/FARZ.py
seirsplus/__init__.py
seirsplus/legacy_models.py
seirsplus/models.py
seirsplus/networks.py
seirsplus/sim_loops.py
seirsplus/utilities.py
seirsplus.egg-info/PKG-INFO
seirsplus.egg-info/SOURCES.txt
seirsplus.egg-info/dependency_links.txt
seirsplus.egg-info/not-zip-safe
seirsplus.egg-info/requires.txt
seirsplus.egg-info/top_level.txt
\ No newline at end of file
numpy
scipy
networkx
seirsplus
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import numpy
import matplotlib.pyplot as pyplot
def gamma_dist(mean, coeffvar, N):
scale = mean*coeffvar**2
shape = mean/scale
return numpy.random.gamma(scale=scale, shape=shape, size=N)
def dist_info(dists, names=None, plot=False, bin_size=1, colors=None, reverse_plot=False):
dists = [dists] if not isinstance(dists, list) else dists
names = [names] if(names is not None and not isinstance(names, list)) else (names if names is not None else [None]*len(dists))
colors = [colors] if(colors is not None and not isinstance(colors, list)) else (colors if colors is not None else pyplot.rcParams['axes.prop_cycle'].by_key()['color'])
for i, (dist, name) in enumerate(zip(dists, names)):
print((name+": " if name else "")+" mean = %.2f, std = %.2f, 95%% CI = (%.2f, %.2f)" % (numpy.mean(dist), numpy.std(dist), numpy.percentile(dist, 2.5), numpy.percentile(dist, 97.5)))
print()
if(plot):
pyplot.hist(dist, bins=numpy.arange(0, int(max(dist)+1), step=bin_size), label=(name if name else False), color=colors[i], edgecolor='white', alpha=0.6, zorder=(-1*i if reverse_plot else i))
if(plot):
pyplot.ylabel('num nodes')
pyplot.legend(loc='upper right')
pyplot.show()
def network_info(networks, names=None, plot=False, bin_size=1, colors=None, reverse_plot=False):
import networkx
networks = [networks] if not isinstance(networks, list) else networks
names = [names] if not isinstance(names, list) else names
colors = [colors] if(colors is not None and not isinstance(colors, list)) else (colors if colors is not None else pyplot.rcParams['axes.prop_cycle'].by_key()['color'])
for i, (network, name) in enumerate(zip(networks, names)):
degree = [d[1] for d in network.degree()]
if(name):
print(name+":")
print("Degree: mean = %.2f, std = %.2f, 95%% CI = (%.2f, %.2f)\n coeff var = %.2f"
% (numpy.mean(degree), numpy.std(degree), numpy.percentile(degree, 2.5), numpy.percentile(degree, 97.5),
numpy.std(degree)/numpy.mean(degree)))
r = networkx.degree_assortativity_coefficient(network)
print("Assortativity: %.2f" % (r))
c = networkx.average_clustering(network)
print("Clustering coeff: %.2f" % (c))
print()
if(plot):
pyplot.hist(degree, bins=numpy.arange(0, int(max(degree)+1), step=bin_size), label=(name+" degree" if name else False), color=colors[i], edgecolor='white', alpha=0.6, zorder=(-1*i if reverse_plot else i))
if(plot):
pyplot.ylabel('num nodes')
pyplot.legend(loc='upper right')
pyplot.show()
def results_summary(model):
print("total percent infected: %0.2f%%" % ((model.total_num_infected()[-1]+model.total_num_recovered()[-1])/model.numNodes * 100) )
print("total percent fatality: %0.2f%%" % (model.numF[-1]/model.numNodes * 100) )
print("peak pct hospitalized: %0.2f%%" % (numpy.max(model.numH)/model.numNodes * 100) )
......@@ -6,7 +6,7 @@ import setuptools
setuptools.setup(
packages=setuptools.find_packages(),
name="seirsplus",
version='0.1.4',
version='1.0.9',
description='Models of SEIRS epidemic dynamics with extensions, including network-structured populations, testing, contact tracing, and social distancing.',
# long_description=long_description,
# long_description_content_type="text/markdown",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment