Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Claudio Fronterre
covid19uk
Commits
992a19a8
Commit
992a19a8
authored
Mar 26, 2020
by
Barry Rowlingson
Browse files
take args processing into __main__
parent
511d23be
Changes
1
Hide whitespace changes
Inline
Side-by-side
covid_ode.py
View file @
992a19a8
...
...
@@ -180,15 +180,13 @@ def plot_age_attack_rate(ax, sim, N, label):
ax
.
plot
(
age_groups
,
attack_rate
,
'o-'
,
label
=
label
)
if
__name__
==
'__main__'
:
def
main
(
configfile
):
parser
=
optparse
.
OptionParser
()
parser
.
add_option
(
"--config"
,
"-c"
,
dest
=
"config"
,
help
=
"configuration file"
)
options
,
args
=
parser
.
parse_args
()
with
open
(
options
.
config
,
'r'
)
as
ymlfile
:
with
open
(
configfile
,
'r'
)
as
ymlfile
:
config
=
yaml
.
load
(
ymlfile
)
global
age_groups
K_tt
,
age_groups
=
load_age_mixing
(
config
[
'data'
][
'age_mixing_matrix_term'
])
K_hh
,
_
=
load_age_mixing
(
config
[
'data'
][
'age_mixing_matrix_hol'
])
...
...
@@ -232,3 +230,11 @@ if __name__ == '__main__':
fig_uk
.
gca
().
grid
(
True
)
plt
.
show
()
if
__name__
==
'__main__'
:
parser
=
optparse
.
OptionParser
()
parser
.
add_option
(
"--config"
,
"-c"
,
dest
=
"config"
,
help
=
"configuration file"
)
options
,
args
=
parser
.
parse_args
()
main
(
options
.
config
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment