[med-svn] [Git][med-team/epigrass][upstream] New upstream version 3.0.2+dfsg
Andreas Tille
gitlab at salsa.debian.org
Sun Feb 21 16:28:40 GMT 2021
Andreas Tille pushed to branch upstream at Debian Med / epigrass
Commits:
8d3694db by Andreas Tille at 2021-02-21T16:23:57+01:00
New upstream version 3.0.2+dfsg
- - - - -
15 changed files:
- Epigrass/__version__.py
- − Epigrass/epidash.py
- − Epigrass/epimodels.c
- Epigrass/epipanel.py
- Epigrass/manager.py
- Epigrass/epimodels.py → Epigrass/models.py
- Epigrass/simobj.py
- demos/rio.epg
- demos/spread.gml
- demos/spread.graphml
- demos/spread.json
- docs/source/using.rst
- requirements.txt
- setup.py
- tests/test_models.py
Changes:
=====================================
Epigrass/__version__.py
=====================================
@@ -1 +1 @@
-version = "3.0"
+version = "3.0.1"
=====================================
Epigrass/epidash.py deleted
=====================================
@@ -1,203 +0,0 @@
-import dash
-import dash_core_components as dcc
-import dash_html_components as html
-from dash.dependencies import Input, Output
-import pandas as pd
-import geopandas as gpd
-import plotly.express as px
-import json
-from sqlalchemy import create_engine
-import os, glob
-from functools import lru_cache
-import warnings
-warnings.filterwarnings('ignore')
-
-is_epigrass_folder = os.path.exists('Epigrass.sqlite')
-
-maps = glob.glob('*.shp')
-if maps:
- mapdf = gpd.read_file('Data.shp')
- mapdf.to_file('Data.geojson', driver='GeoJSON')
- mapjson = json.load(open('Data.geojson', 'r'))
-
- at lru_cache(2)
-def load_sim(sim):
- if sim is None:
- return pd.DataFrame(data={'time': range(2), 'name': 0})
- con = create_engine('sqlite:///Epigrass.sqlite?check_same_thread=False').connect()
- data = pd.read_sql_table(sim, con)
- con.close()
- return data
-
-
-def get_sims():
- if is_epigrass_folder:
- con = create_engine('sqlite:///Epigrass.sqlite?check_same_thread=False').connect()
- sims = con.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;")
- return [s[0] for s in sims if not (s[0].endswith('_meta') or s[0].endswith('e'))]
- else:
- return ['No simulations found']
-
-
-def generate_table(dataframe, max_rows=10):
- return html.Table(
- # Header
- [html.Tr([html.Th(col) for col in dataframe.columns])] +
-
- # Body
- [html.Tr([
- html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
- ]) for i in range(min(len(dataframe), max_rows))]
- )
-
-
-external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
-
-app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
-
-app.layout = html.Div(children=[
- html.H1(children='Epigrass Dashboard'),
-
- html.Div(children='''
- Visualize your Simulations.
- '''),
- html.H3('Simulations:'),
- dcc.Dropdown(
- id='sim-drop',
- options=[{'label': s, 'value': s} for s in get_sims()],
- ),
- html.Div(id='sim-table'),
- dcc.Loading(
- id="loading-1",
- type="default",
- children=html.Div(id="sim-table-loading")
- ),
- html.Div(children=[
- html.B('Series:'),
- dcc.Dropdown(id='columns', multi=True, searchable=True, )], style={'width': '48%', 'display': 'inline-block'}),
- html.Div(children=[
- html.B('Localities:'),
- dcc.Dropdown(id='localities', multi=True, searchable=True),
- ], style={'width': '48%', 'display': 'inline-block', 'float': 'right'}, ),
- html.H3('Series:'),
- dcc.Graph(id='series-plot'),
- html.H3('Map:'),
- # dcc.Loading(
- # id="loading-map",
- # type="default",
- # children=html.Div(id="map-loading")
- # ),
- # dcc.Graph(id='bubble-map'),
-
-])
-
-
-## Callbacks
-
- at app.callback(Output(component_id='sim-table', component_property='children'),
- [Input(component_id='sim-drop', component_property='value')]
-)
-def update_sim_table(sim_name):
- try:
- df = load_sim(sim_name)
- return generate_table(df)
- except TypeError as e:
- return html.P('No data')
-
- at app.callback(Output("sim-table-loading", "children"),
- [Input(component_id='sim-drop', component_property='value')])
-def table_spinner(value):
- pass
-
-# @app.callback(Output("map-loading", "children"),
-# [Input(component_id='sim-drop', component_property='value')])
-# def map_spinner(value):
-# pass
-
- at app.callback(
- Output(component_id='series-plot', component_property='figure'),
- [Input(component_id='columns', component_property='value'),
- Input(component_id='sim-drop', component_property='value'),
- Input(component_id='localities', component_property='value')]
-)
-def update_series_plot(columns_selected, sim_name, localities):
- df = load_sim(sim_name)
- if localities and localities[0] is not None:
- df = df[df.name.isin(localities)]
- tf = df.time.max()
- traces = []
- cols = columns_selected
- if not cols:
- cols = df.columns[5:7]
- for c in cols:
- if c in ['geocode,' 'time', 'name', 'lat', 'longit']:
- continue
- traces.append(dict(
- x=df.time,
- y=df[c],
- text=df['name'],
- mode='line',
- opacity=0.7,
- name=c
- ))
- return {
- 'data': traces,
- 'layout': dict(
- xaxis={'type': 'linear', 'title': 'time',
- 'range': [0, tf]},
- yaxis={'title': 'Individuals'},
- margin={'l': 40, 'b': 40, 't': 10, 'r': 10},
- legend={'x': 0, 'y': 1},
- hovermode='closest',
- transition={'duration': 500},
- )
- }
-
-
- at app.callback(
- Output(component_id='columns', component_property='options'),
- [Input(component_id='sim-drop', component_property='value')]
-)
-def fill_columns(sim_name):
- try:
- df = load_sim(sim_name)
- return [{'label': c, 'value': c} for c in df.columns if
- c not in ['geocode,' 'time', 'name', 'lat', 'longit']]
- except (TypeError, ValueError) as e:
- return []
-
-
- at app.callback(
- Output(component_id='localities', component_property='options'),
- [Input(component_id='sim-drop', component_property='value')]
-)
-def fill_localities(sim_name):
- try:
- df = load_sim(sim_name)
- return [{'label': c, 'value': c} for c in set(df.name)]
- except (TypeError, ValueError) as e:
- return []
-
-
-# @app.callback(
-# Output(component_id='bubble-map', component_property='figure'),
-# [Input(component_id='sim-drop', component_property='value')]
-# )
-# def draw_bubble_map(val):
-# fig = None
-# if maps:
-# namecol = mapdf.columns[0]
-# locations = mapdf.columns[1]
-# fig = px.choropleth(mapdf, geojson=mapjson, locations=locations, color='prevalence', hover_name=namecol,
-# hover_data=['prevalence'],
-# color_continuous_scale='viridis', scope='south america'
-# )
-# return fig
-
-
-def main():
- app.run_server(debug=True)
-
-
-if __name__ == '__main__':
- main()
=====================================
Epigrass/epimodels.c deleted
=====================================
The diff for this file was not included because it is too large.
=====================================
Epigrass/epipanel.py
=====================================
@@ -10,6 +10,7 @@ import hvplot.pandas
import holoviews as hv
import geoviews as gv
from holoviews.operation.datashader import datashade, bundle_graph
+from datashader.bundling import hammer_bundle
from holoviews import opts
from bokeh.resources import INLINE
import param
@@ -50,9 +51,10 @@ def get_sims(fname):
def get_graph(pth):
full_path = os.path.join(os.path.abspath(pth), 'network.gml')
if os.path.exists(full_path):
- G = NX.read_gml(full_path)
+ G = NX.read_gml(full_path,destringizer=int)
else:
G = NX.MultiDiGraph()
+
return G
@@ -118,7 +120,7 @@ def get_subgraph(G, node):
:param node: node defining the subgraph
"""
nodes = [node]
- nodes.extend(list(G.neighbors(node)))
+ nodes.extend([int(n) for n in G.neighbors(node)])
H = G.subgraph(nodes).copy()
return H
@@ -177,7 +179,7 @@ class SeriesViewer(param.Parameterized):
### Model Type
{df['epidemiological_model$modtype'].iloc[0]}
### Epidemic Events
-Seed: {df['epidemic_events$seed']}
+Seed: {df['epidemic_events$seed'].iloc[0]}
"""
)
@@ -246,7 +248,7 @@ Seed: {df['epidemic_events$seed']}
partial_map = partial_map.to_crs(3857) # Converting to web mercator
centroids = [(c.x, c.y) for c in partial_map.centroid]
# Draw the graph using Altair
- gcs = [str(int(gc)) for gc in partial_map.geocode]
+ gcs = [int(gc) for gc in partial_map.geocode]
pos = dict(zip(gcs, centroids))
# viz = nxa.draw_networkx(
@@ -336,7 +338,7 @@ Seed: {df['epidemic_events$seed']}
base = alt.Chart(df).mark_line(interpolate='step-after').encode(
x='time:Q',
- y='incidence:Q',
+ y='incidence:Q'
).properties(
width='container',
height=300
@@ -347,7 +349,7 @@ Seed: {df['epidemic_events$seed']}
row = alt.hconcat()
row |= base.encode(x='time', y=y_enc)
if i < len(variables):
- row |= base.encode(x='time', y=variables[i + 1])
+ row |= base.encode(x='time', y=variables[i + 1], tooltip=['time', 'incidence', 'Infectious'])
chart &= row
return chart
=====================================
Epigrass/manager.py
=====================================
@@ -1048,15 +1048,18 @@ def main():
def end_pools():
- PO.close()
- PO.terminate()
- simobj.PO.close()
- simobj.PO.terminate()
+ # PO.close()
+ # PO.terminate()
+ # simobj.PO.close()
+ # simobj.PO.terminate()
+
+ # kill all subprocesses
+ os.killpg(os.getpid(), signal.SIGTERM)
PO = multiprocessing.Pool()
if __name__ == '__main__':
- import atexit
+ import atexit, signal
atexit.register(end_pools)
main()
=====================================
Epigrass/epimodels.py → Epigrass/models.py
=====================================
@@ -11,7 +11,7 @@ from numpy import inf, nan, nan_to_num
import numpy as np
import sys
import redis
-# import cython
+from epimodels.continuous.models import SIR, SEIR
import numba
from numba.typed import List
@@ -20,12 +20,14 @@ redisclient = redis.StrictRedis()
vnames = {
'SIR': ['Exposed', 'Infectious', 'Susceptible'],
'SIR_s': ['Exposed', 'Infectious', 'Susceptible'],
+ 'SIR_cont': ['Exposed', 'Infectious', 'Susceptible'],
'SIS': ['Exposed', 'Infectious', 'Susceptible'],
'SIS_s': ['Exposed', 'Infectious', 'Susceptible'],
'SEIS': ['Exposed', 'Infectious', 'Susceptible'],
'SEIS_s': ['Exposed', 'Infectious', 'Susceptible'],
'SEIR': ['Exposed', 'Infectious', 'Susceptible'],
'SEIR_s': ['Exposed', 'Infectious', 'Susceptible'],
+ 'SEIR_cont': ['Exposed', 'Infectious', 'Susceptible'],
'SIpRpS': ['Exposed', 'Infectious', 'Susceptible'],
'SIpRpS_s': ['Exposed', 'Infectious', 'Susceptible'],
'SEIpRpS': ['Exposed', 'Infectious', 'Susceptible'],
@@ -125,6 +127,8 @@ def selectModel(modtype):
return stepSIR
elif modtype == b'SIR_s':
return stepSIR_s
+ elif modtype == b'SIR_cont':
+ return stepSIR_cont
elif modtype == b'SIS':
return stepSIS
elif modtype == b'SIS_s':
@@ -137,6 +141,8 @@ def selectModel(modtype):
return stepSEIR
elif modtype == b'SEIR_s':
return stepSEIR_s
+ elif modtype == b'SEIR_cont':
+ return stepSEIR_cont
elif modtype == b'SIpRpS':
return stepSIpRpS
elif modtype == b'SIpRpS_s':
@@ -188,13 +194,21 @@ def stepFlu(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=N
'Susc_age4', 'Incub_age4', 'Subc_age4', 'Sympt_age4', 'Comp_age4',)
if simstep == 0: # get initial values
S1, E1, Is1, Ic1, Ig1 = (
- bi.get('susc_age1', bi.get(b'susc_age1')), bi.get('incub_age1', bi.get(b'incub_age1')), bi.get('subc_age1', bi.get(b'subc_age1')), bi.get('sympt_age1', bi.get(b'sympt_age1')), bi.get('comp_age1', bi.get(b'comp_age1')))
+ bi.get('susc_age1', bi.get(b'susc_age1')), bi.get('incub_age1', bi.get(b'incub_age1')),
+ bi.get('subc_age1', bi.get(b'subc_age1')), bi.get('sympt_age1', bi.get(b'sympt_age1')),
+ bi.get('comp_age1', bi.get(b'comp_age1')))
S2, E2, Is2, Ic2, Ig2 = (
- bi.get('susc_age2', bi.get(b'susc_age2')), bi.get('incub_age2', bi.get(b'incub_age2')), bi.get('subc_age2', bi.get(b'subc_age2')), bi.get('sympt_age2', bi.get(b'sympt_age2')), bi.get('comp_age2', bi.get(b'comp_age2')))
+ bi.get('susc_age2', bi.get(b'susc_age2')), bi.get('incub_age2', bi.get(b'incub_age2')),
+ bi.get('subc_age2', bi.get(b'subc_age2')), bi.get('sympt_age2', bi.get(b'sympt_age2')),
+ bi.get('comp_age2', bi.get(b'comp_age2')))
S3, E3, Is3, Ic3, Ig3 = (
- bi.get('susc_age3', bi.get(b'susc_age3')), bi.get('incub_age3', bi.get(b'incub_age3')), bi.get('subc_age3', bi.get(b'subc_age3')), bi.get('sympt_age3', bi.get(b'sympt_age3')), bi.get('comp_age3', bi.get(b'comp_age3')))
+ bi.get('susc_age3', bi.get(b'susc_age3')), bi.get('incub_age3', bi.get(b'incub_age3')),
+ bi.get('subc_age3', bi.get(b'subc_age3')), bi.get('sympt_age3', bi.get(b'sympt_age3')),
+ bi.get('comp_age3', bi.get(b'comp_age3')))
S4, E4, Is4, Ic4, Ig4 = (
- bi.get('susc_age4', bi.get(b'susc_age4')), bi.get('incub_age4', bi.get(b'incub_age4')), bi.get('subc_age4', bi.get(b'subc_age4')), bi.get('sympt_age4', bi.get(b'sympt_age4')), bi.get('comp_age4', bi.get(b'comp_age4')))
+ bi.get('susc_age4', bi.get(b'susc_age4')), bi.get('incub_age4', bi.get(b'incub_age4')),
+ bi.get('subc_age4', bi.get(b'subc_age4')), bi.get('sympt_age4', bi.get(b'sympt_age4')),
+ bi.get('comp_age4', bi.get(b'comp_age4')))
else: # get values from last time step
# print(len(inits))
S1, E1, Is1, Ic1, Ig1, S2, E2, Is2, Ic2, Ig2, S3, E3, Is3, Ic3, Ig3, S4, E4, Is4, Ic4, Ig4 = inits
@@ -378,6 +392,7 @@ def stepSIR(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=N
else:
E, I, S = inits
N = totpop
+ R = N - (E + I + S)
beta = bp.get('beta', bp.get(b'beta'));
alpha = bp.get('alpha', bp.get(b'alpha'));
# e = bp.get('e', bp.get(b'e'));
@@ -392,7 +407,7 @@ def stepSIR(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=N
# Model
Ipos = (1 - r) * I + Lpos
Spos = S + b - Lpos
- Rpos = R + r*I
+ Rpos = R + r * I
# Migrating infecctious
migInf = Ipos
@@ -400,11 +415,6 @@ def stepSIR(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=N
return (0, Ipos, Spos), Lpos, migInf
-# @cython.locals(inits=list, simstep='long', totpop='long', theta='double', npass='double', bi=dict, bp=dict,
-# beta='double', alpha='double', E='double', I='double', S='double', N='long',
-# r='double', b='double', w='double', Lpos='double', Lpos_esp='double', R='double',
-# Ipos='double', Spos='double', Rpos='double')
-# @numba.jit(forceobj=True, cache=True)
def stepSIR_s(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=None, model=None,
dist='poisson') -> tuple:
"""
@@ -417,6 +427,7 @@ def stepSIR_s(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values
else:
E, I, S = inits
N = totpop
+ R = N - (E + I + S)
beta = bp.get('beta', bp.get(b'beta'));
alpha = bp.get('alpha', bp.get(b'alpha'));
# e = bp.get('e', bp.get(b'e'));
@@ -437,7 +448,7 @@ def stepSIR_s(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values
# Model
Ipos = (1 - r) * I + Lpos
Spos = S + b - Lpos
- Rpos = N - (Spos + Ipos)
+ Rpos = R + r * I
# Migrating infecctious
migInf = Ipos
@@ -445,6 +456,41 @@ def stepSIR_s(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values
return [0, Ipos, Spos], Lpos, migInf
+def stepSIR_cont(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=None, model=None) -> tuple:
+ """
+ ODE SIR without births and deaths
+ :param inits:
+ :param simstep:
+ :param totpop:
+ :param theta:
+ :param npass:
+ :param bi:
+ :param bp:
+ :param values:
+ :param model:
+ :return:
+ """
+ sir = SIR()
+ if simstep == 0: # get initial values
+ E, I, S = (bi.get('e', bi.get(b'e')), bi.get('i', bi.get(b'i')), bi.get('s', bi.get(b's')))
+ else:
+ E, I, S = inits
+ N = totpop
+ R = N - (E + I + S)
+ beta = bp.get('beta', bp.get(b'beta'));
+ alpha = bp.get('alpha', bp.get(b'alpha'));
+ r = bp.get('r', bp.get(b'r'));
+ b = bp.get('b', bp.get(b'b'));
+
+ sir([S, I, R], [0, 1], N, {'beta': beta, 'gamma': r})
+
+ Spos = sir.traces['S'][-1]
+ Ipos = sir.traces['I'][-1]
+ Lpos = sir.traces['I'][-1] - sir.traces['I'][0]
+
+ return [0, Ipos, Spos], Lpos, Ipos
+
+
# @cython.locals(inits=list, simstep='long', totpop='long', theta='double', npass='double', bi=dict, bp=dict,
# beta='double', alpha='double', E='double', I='double', S='double', N='long',
# r='double', b='double', w='double', Lpos='double', Lpos_esp='double', R='double',
@@ -618,6 +664,42 @@ def stepSEIR_s(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, value
return [Epos, Ipos, Spos], Lpos, migInf
+def stepSEIR_cont(inits, simstep, totpop, theta=0, npass=0, bi=None, bp=None, values=None, model=None) -> tuple:
+ """
+ ODE SIR without births and deaths
+ :param inits:
+ :param simstep:
+ :param totpop:
+ :param theta:
+ :param npass:
+ :param bi:
+ :param bp:
+ :param values:
+ :param model:
+ :return:
+ """
+ seir = SEIR()
+ if simstep == 0: # get initial values
+ E, I, S = (bi.get('e', bi.get(b'e')), bi.get('i', bi.get(b'i')), bi.get('s', bi.get(b's')))
+ else:
+ E, I, S = inits
+ N = totpop
+ R = N - (E + I + S)
+ beta = bp.get('beta', bp.get(b'beta'));
+ alpha = bp.get('alpha', bp.get(b'alpha'));
+ e = bp.get('e', bp.get(b'e'))
+ r = bp.get('r', bp.get(b'r'));
+ b = bp.get('b', bp.get(b'b'));
+
+ seir([S, E, I, R], [0, 1], N, {'beta': beta, 'gamma': r, 'epsilon': e})
+
+ Spos = seir.traces['S'][-1]
+ Epos = seir.traces['E'][-1]
+ Ipos = seir.traces['I'][-1]
+ Lpos = seir.traces['I'][-1] - seir.traces['I'][0]
+
+ return [Epos, Ipos, Spos], Lpos, Ipos
+
# @cython.locals(inits=list, simstep='long', totpop='long', theta='double', npass='double', bi=dict, bp=dict,
# beta='double', alpha='double', E='double', I='double', S='double', N='long',
# r='double', b='double', w='double', Lpos='double', Lpos_esp='double', R='double',
=====================================
Epigrass/simobj.py
=====================================
@@ -16,7 +16,7 @@ from networkx.readwrite import json_graph
import redis
from Epigrass.data_io import *
-from Epigrass import epimodels
+from Epigrass import models
try:
sys.path.insert(0, os.getcwd())
@@ -126,8 +126,8 @@ class siteobj:
self.model = CustomModel.Model
self.vnames = CustomModel.vnames
else:
- self.model = epimodels.Epimodel(self.geocode, self.modtype)
- self.vnames = epimodels.vnames[modtype]
+ self.model = models.Epimodel(self.geocode, self.modtype)
+ self.vnames = models.vnames[modtype]
try:
# self.ts = [[bi[vn.lower()] for vn in self.vnames]]
self.ts.append(list(bi.values())) # This is fine since bi is an OrderedDict
=====================================
demos/rio.epg
=====================================
@@ -33,9 +33,9 @@ encoding =
#==============================================================#
[EPIDEMIOLOGICAL MODEL]
#==============================================================#
-#model types available: SIS, SIS_s ,SIR, SIR_s, SEIS, SEIS_s, SEIR, SEIR_s,
+#model types available: SIS, SIS_s ,SIR, SIR_s, SIR_cont, SEIS, SEIS_s, SEIR, SEIR_cont, SEIR_s,
# SIpRpS, SIpRpS_s,SIpR,SIpR_s,Influenza or Custom (see documentation for description).
-modtype = SEIR
+modtype = SEIR_cont
#==============================================================#
[MODEL PARAMETERS]
=====================================
demos/spread.gml
=====================================
The diff for this file was not included because it is too large.
=====================================
demos/spread.graphml
=====================================
The diff for this file was not included because it is too large.
=====================================
demos/spread.json
=====================================
The diff for this file was not included because it is too large.
=====================================
docs/source/using.rst
=====================================
@@ -436,11 +436,11 @@ The Web Dashboard
To interact and explore the simulations stored in the database, Epigrass offers an interactive dashboard. It allows you to
navigate to any simulation previously done for a given model, and inspect it interactively.
-You can ask for it to open right after a simulation is done::
+You can ask for it to open **right after a simulation is done**::
$ epirunner -D mymodel.epg
-or you can open it for a given model by typing from the directory where the *epg* file is located::
+or you can simplu open it to inspect previous simulations of given model by typing from the directory where the *epg* file is located::
$ epirunner -V mymodel.epg
=====================================
requirements.txt
=====================================
@@ -1,12 +1,8 @@
pandas
geopandas
numpy
-dash
matplotlib
-dash_html_components
-dash_core_components
networkx
-plotly
SQLAlchemy
SQLObject
tqdm
@@ -17,4 +13,10 @@ pymysql
fiona
shapely
altair
-redis
\ No newline at end of file
+redis
+epimodels
+panel
+holoviews
+geoviews
+scikit-image
+datashader
=====================================
setup.py
=====================================
@@ -22,10 +22,9 @@ setup(name='epigrass',
entry_points={
'console_scripts': [
'epirunner = Epigrass.manager:main',
- 'epidash = Epigrass.epidash:main'
],
},
- # ext_modules=cythonize('Epigrass/epimodels.py'),
+ # ext_modules=cythonize('Epigrass/models.py'),
zip_safe=False,
include_package_data=True,
package_data={'': ['COPYING', 'epigrass.desktop', '*.rst', '*.tex', '*.png', '*.jpg']},
=====================================
tests/test_models.py
=====================================
@@ -8,7 +8,7 @@ import unittest
import numpy as np
# from Epigrass.manager import *
from Epigrass.simobj import siteobj, graph, edge
-from Epigrass.epimodels import Epimodel
+from Epigrass.models import Epimodel
class TestModels(unittest.TestCase):
@@ -355,6 +355,16 @@ class test_model_run(unittest.TestCase):
P.title('$SEIR$')
P.legend(['E', 'I', 'S'])
+ def test_run_SEIR_cont(self):
+ model = Epimodel(1, modtype=b'SEIR_cont')
+ res = run(model, [(0, 10, 990), 0, 10000, 0, 0,
+ self.bi,
+ self.bp],
+ 100)
+ P.plot(res)
+ P.title('$SEIR_{cont}$')
+ P.legend(['E', 'I', 'S'])
+
def test_run_SEIS_s(self):
model = Epimodel(1, modtype=b'SEIS_s')
res = run(model, [(0, 10, 990), 0, 10000, 0, 0,
@@ -395,6 +405,16 @@ class test_model_run(unittest.TestCase):
P.title('$SIR$')
P.legend(['E', 'I', 'S'])
+ def test_run_SIR_cont(self):
+ model = Epimodel(1, modtype=b'SIR_cont')
+ res = run(model, [(0, 10, 990), 0, 10000, 0, 0,
+ self.bi,
+ self.bp],
+ 100)
+ P.plot(res)
+ P.title('$SIR_{cont}$')
+ P.legend(['E', 'I', 'S'])
+
def test_run_SIS_s(self):
model = Epimodel(1, modtype=b'SIS_s')
res = run(model, [(0, 10, 990), 0, 10000, 0, 0,
View it on GitLab: https://salsa.debian.org/med-team/epigrass/-/commit/8d3694db7c2de1dfc2d04e5db69397e8488039f0
--
View it on GitLab: https://salsa.debian.org/med-team/epigrass/-/commit/8d3694db7c2de1dfc2d04e5db69397e8488039f0
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210221/d6b0bdf0/attachment-0001.htm>
More information about the debian-med-commit
mailing list