diff --git a/.gitignore b/.gitignore index ffdfa61..785494c 100644 --- a/.gitignore +++ b/.gitignore @@ -70,7 +70,7 @@ instance/ # Sphinx documentation docs/_build/ -docs/emodpy-typhoid*.rst +docs/emodpy_typhoid*.rst docs/modules.rst # PyBuilder diff --git a/docs/_templates/breadcrumbs.html b/docs/_templates/breadcrumbs.html index 391b9d0..fb68032 100644 --- a/docs/_templates/breadcrumbs.html +++ b/docs/_templates/breadcrumbs.html @@ -1,9 +1,9 @@ {% extends '!breadcrumbs.html' %} {% block breadcrumbs %}
  • IDM docs »
  • -
  • emodpy-malaria »
  • +
  • emodpy-typhoid »
  • {% for doc in parents %}
  • {{ doc.title }} »
  • {% endfor %}
  • {{ title }}
  • -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/docs/_templates/footer.html b/docs/_templates/footer.html index d93abae..ff9a591 100644 --- a/docs/_templates/footer.html +++ b/docs/_templates/footer.html @@ -1,8 +1,8 @@ {% extends '!footer.html' %} {% block extrafooter %} -

    emodpy-malaria is licensed under the Creative Commons +

    emodpy-typhoid is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.

    Send documentation feedback to feedback@idmod.org

    Privacy and Cookies Notice   |    Terms of Use

    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 87daa25..df7d08e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,7 @@ else: subprocess.check_output(["make.bat", "generate-api"], cwd=os.path.dirname(os.path.abspath(__file__))) -# Rename "emodpy-malaria" to "API reference" +# Rename "emodpy-typhoid" to "API reference" filename = 'modules.rst' # This must match the Makefile with open(filename) as f: # Read existing file lines = f.readlines() @@ -59,10 +59,27 @@ 'sphinx_copybutton', 'sphinx.ext.intersphinx', 'sphinxext.remoteliteralinclude', - 'myst_parser', - 'sphinx_search.extension' + 'myst_parser', # source files written in MD or RST + 'sphinx_search.extension', # search across entire IDM docs domain + 'sphinx.ext.viewcode' # link to view source code ] +myst_enable_extensions = [ + "amsmath", + "attrs_inline", + "colon_fence", + "deflist", + "dollarmath", + "fieldlist", + "html_admonition", + "html_image", + "linkify", + "replacements", + "smartquotes", + "strikethrough", + "substitution", + "tasklist", +] plantuml = 'plantweb' autodoc_default_options = { @@ -208,15 +225,14 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". + html_static_path = ['_static'] -html_context = { - 'css_files': [ - '_static/theme_overrides.css', - '_static/copy_button.css' - ] -} -html_js_files = ['show_block_by_os.js'] +html_css_files = ['theme_overrides.css'] + +html_js_files = ['show_block_by_os.js'] + + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the docs. @@ -310,7 +326,7 @@ # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'emodpy-malaria' +htmlhelp_basename = 'emodpy-typhoid' # -- Options for LaTeX output --------------------------------------------- @@ -336,7 +352,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'emodpy-malaria-docs.tex', u'emodpy-malaria', + (master_doc, 'emodpy-typhoid-docs.tex', u'emodpy-typhoid', u'Institute for Disease Modeling', 'manual'), ] @@ -378,7 +394,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'emodpy-malaria-docs', u'emodpy-malaria', + (master_doc, 'emodpy-typhoid-docs', u'emodpy-typhoid', [author], 1) ] @@ -392,8 +408,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'emodpy-malaria-docs', u'emodpy-malaria', - author, 'Institute for Disease Modeling', 'How to use emodpy for malaria simulations.', + (master_doc, 'emodpy-typhoid-docs', u'emodpy-typhoid', + author, 'Institute for Disease Modeling', 'How to use emodpy for typhoid simulations.', 'Miscellaneous'), ] @@ -420,6 +436,6 @@ 'emod_api': ('https://docs.idmod.org/projects/emod-api/en/latest/', None), 'emodpy': ('https://docs.idmod.org/projects/emodpy/en/latest/', None), 'idmtools': ('https://docs.idmod.org/projects/idmtools/en/latest/', None), - 'emod-malaria': ('https://docs.idmod.org/projects/emod-malaria/en/latest/', None), + 'emod-typhoid': ('https://docs.idmod.org/projects/emod-typhoid/en/latest/', None), 'pycomps': ('https://docs.idmod.org/projects/pycomps/en/latest/', None) - } \ No newline at end of file + } diff --git a/docs/index.rst b/docs/index.rst index c2faa97..677e143 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,13 +3,13 @@ ============================== |EMODPY_typhoid| is a collection of Python scripts and utilities created to -streamline user interactions with |EMOD_s| and |IT_s| for modeling malaria. +streamline user interactions with |EMOD_s| and |IT_s| for modeling typhoid. Much of the functionality is inherited from the :doc:`emod_api:emod_api` and :doc:`emodpy:emodpy`. Additional information about how to use |IT_s| can be found in -:doc:`idmtools:index`. Additional information about |EMOD_s| malaria -parameters can be found in :doc:`emod-malaria:parameter-overview`. +:doc:`idmtools:index`. Additional information about |EMOD_s| typhoid +parameters can be found in :doc:`emod-typhoid:parameter-overview`. See :doc:`idmtools:index` for a diagram showing how |IT_s| and each of the related packages are used in an end-to-end workflow using |EMOD_s| as the diff --git a/docs/variables.txt b/docs/variables.txt index 83678f9..49e015a 100644 --- a/docs/variables.txt +++ b/docs/variables.txt @@ -16,7 +16,7 @@ .. |IDM_l| replace:: Institute for Disease Modeling (IDM) .. |EMODPY_s| replace:: emodpy -.. |EMODPY_typhoid| replace:: typhoid +.. |EMODPY_typhoid| replace:: emodpy-typhoid .. |emod_api| replace:: emod-api .. |IDM_s| replace:: IDM .. |EMOD_l| replace:: Epidemiological MODeling software (EMOD) diff --git a/emodpy_typhoid/config.py b/emodpy_typhoid/config.py new file mode 100644 index 0000000..28245c6 --- /dev/null +++ b/emodpy_typhoid/config.py @@ -0,0 +1,12 @@ +def cleanup_for_2018_mode( config ): + # when using 2018 binary + config.parameters.pop( "Serialized_Population_Filenames" ) + config.parameters.pop( "Serialization_Time_Steps" ) + config.parameters.pop( "Demographics_Filename" ) + + config.parameters.Incubation_Period_Distribution = "FIXED_DURATION" # hack + config.parameters.Infectious_Period_Distribution = "FIXED_DURATION" # hack + config.parameters.Base_Incubation_Period = 1 + config.parameters.Base_Infectious_Period = 1 + config.parameters["Listed_Events"] = [] + diff --git a/emodpy_typhoid/demographics/TyphoidDemographics.py b/emodpy_typhoid/demographics/TyphoidDemographics.py index 8eb577f..89edbf2 100644 --- a/emodpy_typhoid/demographics/TyphoidDemographics.py +++ b/emodpy_typhoid/demographics/TyphoidDemographics.py @@ -9,6 +9,10 @@ class TyphoidDemographics(Demographics): """ def __init__(self, nodes, idref="Gridded world grump2.5arcmin", base_file=None): super().__init__( nodes, idref, base_file ) + # The following is for back-compat with older versions of the model which looked for these keys unconditionally. + self.raw["Defaults"]["IndividualAttributes"]["PrevalenceDistributionFlag"] = 0 + self.raw["Defaults"]["IndividualAttributes"]["PrevalenceDistribution1"] = 0 + self.raw["Defaults"]["IndividualAttributes"]["PrevalenceDistribution2"] = 0 #super().SetDefaultProperties() def fromBasicNode(lat=0, lon=0, pop=1e6, name=1, forced_id=1): @@ -77,7 +81,7 @@ def from_csv( pop_filename_in, site="No_Site", min_node_pop = 0 ): site: A string to identify the country, village, or trial site. Returns: - A :py:class:`~emodpy_malaria.demographics.MalariaDemographics` instance. + A :py:class:`~emodpy_typhoid.demographics.MalariaDemographics` instance. """ typhoid_demog = Demog.from_csv( pop_filename_in ) nodes = [] diff --git a/emodpy_typhoid/interventions/typhoid_vaccine.py b/emodpy_typhoid/interventions/typhoid_vaccine.py index e3cc410..8c2414a 100644 --- a/emodpy_typhoid/interventions/typhoid_vaccine.py +++ b/emodpy_typhoid/interventions/typhoid_vaccine.py @@ -3,18 +3,36 @@ from emod_api.interventions import common import json -def new_intervention( camp, efficacy=1.0, mode="Shedding" ): - """ - TyphoidVaccine intervention wrapper. Just the intervention. No configuration yet. +def new_intervention( camp, efficacy=0.82, mode="Shedding", constant_period=0, decay_constant=6935.0 ): """ + Create a new TyphoidVaccine intervention with specified parameters. If you use this function directly, you'll need to distribute the intervention with a function like ScheduledCampaignEvent or TriggeredCampaignEvent from emod_api.interventions.common. + + Args: + camp (Camp): The camp to which the intervention is applied. + efficacy (float, optional): The efficacy of the Typhoid vaccine. Default is 0.82. + mode (str, optional): The mode of the intervention. Default is "Shedding". + constant_period (float, optional): The constant period of the waning effect in days. Default is 0. + decay_constant (float, optional): The decay time constant for the waning effect. Default is 6935.0. + + Returns: + TyphoidVaccine: A fully configured instance of the TyphoidVaccine intervention with the specified parameters. + """ + intervention = s2c.get_class_with_defaults( "TyphoidVaccine", camp.schema_path ) intervention.Effect = efficacy intervention.Mode = mode - # WaningEffect is TBD. + intervention.Changing_Effect = s2c.get_class_with_defaults( "WaningEffectBoxExponential" ) + intervention.Changing_Effect.Initial_Effect = efficacy + intervention.Changing_Effect.Box_Duration = constant_period + intervention.Changing_Effect.Decay_Time_Constant = decay_constant return intervention def new_triggered_intervention( camp, + efficacy=0.82, + mode="Shedding", + constant_period=0, + decay_constant=6935.0, start_day=1, triggers=[ "Births" ], coverage=1.0, @@ -23,18 +41,36 @@ def new_triggered_intervention( co_event=None # expansion slot ): """ - Distribute TyphoidVaccine when something happens as determined by a signal published from the - model or another campaign event. + Create a new triggered TyphoidVaccine intervention based on specified parameters. + + Args: + camp (Camp): The camp to which the intervention is applied. + efficacy (float, optional): The efficacy of the Typhoid vaccine. Default is 0.82. + mode (str, optional): The mode of the intervention. Default is "Shedding". + constant_period (float, optional): The constant period of the waning effect in days. Default is 0. + decay_constant (float, optional): The decay time constant for the waning effect. Default is 6935.0. + start_day (int, optional): The day on which the intervention starts. Default is 1. + triggers (list, optional): List of triggers for the intervention. Default is ["Births"]. + coverage (float, optional): Demographic coverage of the intervention. Default is 1.0. + node_ids (list, optional): List of node IDs where the intervention is applied. Default is None. + property_restrictions_list (list, optional): List of property restrictions for the intervention. Default is an empty list. + co_event (None, optional): Expansion slot for future use. + + Returns: + TriggeredCampaignEvent: An instance of a triggered campaign event with the TyphoidVaccine intervention. """ - iv = new_intervention( camp ) + iv = new_intervention( camp, efficacy=efficacy, mode=mode, constant_period=constant_period, decay_constant=decay_constant ) - #event = common.ScheduledCampaignEvent( camp, Start_Day=start_day, Demographic_Coverage=coverage, Intervention_List=[ act_intervention, bcast_intervention ], Node_Ids=nodeIDs, Property_Restrictions=property_restrictions_list ) event = common.TriggeredCampaignEvent( camp, Start_Day=start_day, Triggers=triggers, Demographic_Coverage=coverage, Intervention_List=[ iv ], Node_Ids=node_ids, Property_Restrictions=property_restrictions_list, Event_Name="Triggered Typhoid Vax" ) return event def new_scheduled_intervention( camp, + efficacy=0.82, + mode="Shedding", + constant_period=0, + decay_constant=6935.0, start_day=1, coverage=1.0, node_ids=None, @@ -42,10 +78,25 @@ def new_scheduled_intervention( co_event=None # expansion slot ): """ - Distribute TyphoidVaccine when something happens as determined by a signal published from the - model or another campaign event. + Create a new scheduled TyphoidVaccine intervention based on specified parameters. + + Args: + camp (Camp): The camp to which the intervention is applied. + efficacy (float, optional): The efficacy of the Typhoid vaccine. Default is 0.82. + mode (str, optional): The mode of the intervention. Default is "Shedding". + constant_period (float, optional): The constant period of the waning effect in days. Default is 0. + decay_constant (float, optional): The decay time constant for the waning effect. Default is 6935.0. + start_day (int, optional): The day on which the intervention starts. Default is 1. + coverage (float, optional): Demographic coverage of the intervention. Default is 1.0. + node_ids (list, optional): List of node IDs where the intervention is applied. Default is None. + property_restrictions_list (list, optional): List of property restrictions for the intervention. Default is an empty list. + co_event (None, optional): Expansion slot for future use. + + Returns: + ScheduledCampaignEvent: An instance of a scheduled campaign event with the TyphoidVaccine intervention. + """ - iv = new_intervention( camp ) + iv = new_intervention( camp, efficacy=efficacy, mode=mode, constant_period=constant_period, decay_constant=decay_constant ) #event = common.ScheduledCampaignEvent( camp, Start_Day=start_day, Demographic_Coverage=coverage, Intervention_List=[ act_intervention, bcast_intervention ], Node_Ids=nodeIDs, Property_Restrictions=property_restrictions_list ) event = common.ScheduledCampaignEvent( camp, Start_Day=start_day, Demographic_Coverage=coverage, Intervention_List=[ iv ], Node_Ids=node_ids, Property_Restrictions=property_restrictions_list ) @@ -54,7 +105,7 @@ def new_scheduled_intervention( def new_intervention_as_file( camp, start_day, filename=None ): import emod_api.campaign as camp - camp.add( new_triggered_intervention( camp, start_day ), first=True ) + camp.add( new_triggered_intervention( camp, start_day=start_day ), first=True ) if filename is None: filename = "TyphoidVaccine.json" camp.save( filename ) diff --git a/examples/blantyre_noHINT/from_files/TestDemographics_Blantyre.json b/examples/blantyre_noHINT/from_files/TestDemographics_Blantyre.json new file mode 100644 index 0000000..b4207e3 --- /dev/null +++ b/examples/blantyre_noHINT/from_files/TestDemographics_Blantyre.json @@ -0,0 +1,1850 @@ +{ + "Metadata": { + "DateCreated": "Sun Sep 25 23:19:55 2011", + "Tool": "convertdemog.py", + "Author": "jsteinkraus", + "IdReference": "Gridded world grump2.5arcmin", + "NodeCount": 1 + }, + "Nodes": [ + { + "NodeID": 340461476, + "NodeAttributes": { + "Latitude": -8.5, + "Longitude": 36.5, + "Altitude": 0, + "Airport": 0, + "Region": 1, + "Seaport": 0, + "InitialPopulation": 16000, + "BirthRate": 0 + }, + "IndividualAttributes": { + "AgeDistributionFlag": 3, + "AgeDistribution1": 0.0001, + "AgeDistribution2": 0, + "PrevalenceDistributionFlag": 0, + "PrevalenceDistribution1": 0, + "PrevalenceDistribution2": 0, + "ImmunityDistributionFlag": 0, + "ImmunityDistribution1": 1, + "ImmunityDistribution2": 0, + "RiskDistributionFlag": 0, + "RiskDistribution1": 1, + "RiskDistribution2": 0, + "MigrationHeterogeneityDistributionFlag": 0, + "MigrationHeterogeneityDistribution1": 1, + "MigrationHeterogeneityDistribution2": 0, + "AgeDistribution": { + "NumDistributionAxes": 0, + "ResultUnits": "years", + "ResultScaleFactor": 365, + "ResultValues": [ + 0, + 5, + 10, + 15, + 20, + 25, + 30, + 35, + 40, + 45, + 50, + 55, + 60, + 65, + 70, + 75, + 80, + 100, + 120 + ], + "DistributionValues": [ + 0, + 0.192773, + 0.3371, + 0.4569, + 0.558371, + 0.643779, + 0.715447, + 0.780933, + 0.82994, + 0.86586, + 0.89963, + 0.927119, + 0.95044, + 0.969203, + 0.983359, + 0.992669, + 0.997585, + 1, + 1 + ] + }, + "MortalityDistributionMale": { + "NumDistributionAxes": 2, + "AxisNames": [ + "age", + "year" + ], + "AxisUnits": [ + "years", + "simulation year" + ], + "AxisScaleFactors": [ + 365, + 1 + ], + "NumPopulationGroups": [ + 38, + 13 + ], + "PopulationGroups": [ + [ + 0, + 0.999, + 1, + 4.999, + 5, + 9.999, + 10, + 14.999, + 15, + 19.999, + 20, + 24.999, + 25, + 29.999, + 30, + 34.999, + 35, + 39.999, + 40, + 44.999, + 45, + 49.999, + 50, + 54.999, + 55, + 59.999, + 60, + 64.999, + 65, + 69.999, + 70, + 74.999, + 75, + 79.999, + 80, + 84.999, + 85, + 100 + ], + [ + 1952.5, + 1957.5, + 1962.5, + 1967.5, + 1972.5, + 1977.5, + 1982.5, + 1987.5, + 1992.5, + 1997.5, + 2002.5, + 2007.5, + 2012.5 + ] + ], + "ResultUnits": "Mortality rate in units of 1/year", + "ResultScaleFactor": 0.0027, + "ResultValues": [ + [ + 0.2396, + 0.2321, + 0.2233, + 0.2155, + 0.2, + 0.1873, + 0.1784, + 0.1757, + 0.1604, + 0.1374, + 0.1182, + 0.0891, + 0.0668 + ], + [ + 0.2396, + 0.2321, + 0.2233, + 0.2155, + 0.2, + 0.1873, + 0.1784, + 0.1757, + 0.1604, + 0.1374, + 0.1182, + 0.0891, + 0.0668 + ], + [ + 0.0522, + 0.05, + 0.0473, + 0.0449, + 0.0399, + 0.0357, + 0.0318, + 0.0291, + 0.0233, + 0.0165, + 0.0118, + 0.0073, + 0.0046 + ], + [ + 0.0522, + 0.05, + 0.0473, + 0.0449, + 0.0399, + 0.0357, + 0.0318, + 0.0291, + 0.0233, + 0.0165, + 0.0118, + 0.0073, + 0.0046 + ], + [ + 0.0085, + 0.0082, + 0.0078, + 0.0074, + 0.0065, + 0.0059, + 0.0053, + 0.0048, + 0.0043, + 0.0039, + 0.0034, + 0.0028, + 0.002 + ], + [ + 0.0085, + 0.0082, + 0.0078, + 0.0074, + 0.0065, + 0.0059, + 0.0053, + 0.0048, + 0.0043, + 0.0039, + 0.0034, + 0.0028, + 0.002 + ], + [ + 0.0042, + 0.004, + 0.0038, + 0.0037, + 0.0033, + 0.0031, + 0.0028, + 0.0026, + 0.0022, + 0.0026, + 0.0033, + 0.0034, + 0.003 + ], + [ + 0.0042, + 0.004, + 0.0038, + 0.0037, + 0.0033, + 0.0031, + 0.0028, + 0.0026, + 0.0022, + 0.0026, + 0.0033, + 0.0034, + 0.003 + ], + [ + 0.0063, + 0.0061, + 0.0058, + 0.0056, + 0.0051, + 0.0047, + 0.0043, + 0.0041, + 0.0033, + 0.0028, + 0.0032, + 0.003, + 0.0024 + ], + [ + 0.0063, + 0.0061, + 0.0058, + 0.0056, + 0.0051, + 0.0047, + 0.0043, + 0.0041, + 0.0033, + 0.0028, + 0.0032, + 0.003, + 0.0024 + ], + [ + 0.0097, + 0.0093, + 0.0089, + 0.0086, + 0.0078, + 0.0072, + 0.0068, + 0.0072, + 0.0067, + 0.0053, + 0.0044, + 0.003, + 0.002 + ], + [ + 0.0097, + 0.0093, + 0.0089, + 0.0086, + 0.0078, + 0.0072, + 0.0068, + 0.0072, + 0.0067, + 0.0053, + 0.0044, + 0.003, + 0.002 + ], + [ + 0.0096, + 0.0093, + 0.0089, + 0.0085, + 0.0077, + 0.0071, + 0.0072, + 0.0101, + 0.0134, + 0.0134, + 0.0121, + 0.0082, + 0.004 + ], + [ + 0.0096, + 0.0093, + 0.0089, + 0.0085, + 0.0077, + 0.0071, + 0.0072, + 0.0101, + 0.0134, + 0.0134, + 0.0121, + 0.0082, + 0.004 + ], + [ + 0.0098, + 0.0095, + 0.0091, + 0.0088, + 0.0081, + 0.0075, + 0.0078, + 0.0127, + 0.0197, + 0.0224, + 0.0218, + 0.0148, + 0.0074 + ], + [ + 0.0098, + 0.0095, + 0.0091, + 0.0088, + 0.0081, + 0.0075, + 0.0078, + 0.0127, + 0.0197, + 0.0224, + 0.0218, + 0.0148, + 0.0074 + ], + [ + 0.011, + 0.0106, + 0.0102, + 0.0098, + 0.0091, + 0.0085, + 0.0089, + 0.0152, + 0.0265, + 0.0333, + 0.0345, + 0.0244, + 0.0122 + ], + [ + 0.011, + 0.0106, + 0.0102, + 0.0098, + 0.0091, + 0.0085, + 0.0089, + 0.0152, + 0.0265, + 0.0333, + 0.0345, + 0.0244, + 0.0122 + ], + [ + 0.0133, + 0.0129, + 0.0124, + 0.012, + 0.0111, + 0.0105, + 0.0104, + 0.0142, + 0.0221, + 0.0291, + 0.032, + 0.0236, + 0.0127 + ], + [ + 0.0133, + 0.0129, + 0.0124, + 0.012, + 0.0111, + 0.0105, + 0.0104, + 0.0142, + 0.0221, + 0.0291, + 0.032, + 0.0236, + 0.0127 + ], + [ + 0.016, + 0.0156, + 0.015, + 0.0146, + 0.0136, + 0.0129, + 0.0125, + 0.0144, + 0.0187, + 0.023, + 0.0262, + 0.0202, + 0.0119 + ], + [ + 0.016, + 0.0156, + 0.015, + 0.0146, + 0.0136, + 0.0129, + 0.0125, + 0.0144, + 0.0187, + 0.023, + 0.0262, + 0.0202, + 0.0119 + ], + [ + 0.021, + 0.0204, + 0.0198, + 0.0192, + 0.0181, + 0.0172, + 0.0166, + 0.0174, + 0.0182, + 0.0184, + 0.0189, + 0.015, + 0.0108 + ], + [ + 0.021, + 0.0204, + 0.0198, + 0.0192, + 0.0181, + 0.0172, + 0.0166, + 0.0174, + 0.0182, + 0.0184, + 0.0189, + 0.015, + 0.0108 + ], + [ + 0.0284, + 0.0278, + 0.027, + 0.0263, + 0.0249, + 0.0238, + 0.023, + 0.0235, + 0.0231, + 0.0213, + 0.0199, + 0.016, + 0.0127 + ], + [ + 0.0284, + 0.0278, + 0.027, + 0.0263, + 0.0249, + 0.0238, + 0.023, + 0.0235, + 0.0231, + 0.0213, + 0.0199, + 0.016, + 0.0127 + ], + [ + 0.0424, + 0.0415, + 0.0403, + 0.0393, + 0.0372, + 0.0356, + 0.0343, + 0.0344, + 0.033, + 0.0297, + 0.0269, + 0.0217, + 0.0178 + ], + [ + 0.0424, + 0.0415, + 0.0403, + 0.0393, + 0.0372, + 0.0356, + 0.0343, + 0.0344, + 0.033, + 0.0297, + 0.0269, + 0.0217, + 0.0178 + ], + [ + 0.0632, + 0.0617, + 0.06, + 0.0586, + 0.0557, + 0.0534, + 0.0513, + 0.0504, + 0.0477, + 0.0429, + 0.0388, + 0.0319, + 0.0271 + ], + [ + 0.0632, + 0.0617, + 0.06, + 0.0586, + 0.0557, + 0.0534, + 0.0513, + 0.0504, + 0.0477, + 0.0429, + 0.0388, + 0.0319, + 0.0271 + ], + [ + 0.0999, + 0.0977, + 0.0952, + 0.093, + 0.0888, + 0.0855, + 0.0823, + 0.0796, + 0.0736, + 0.0663, + 0.0603, + 0.0514, + 0.0457 + ], + [ + 0.0999, + 0.0977, + 0.0952, + 0.093, + 0.0888, + 0.0855, + 0.0823, + 0.0796, + 0.0736, + 0.0663, + 0.0603, + 0.0514, + 0.0457 + ], + [ + 0.1582, + 0.1551, + 0.1514, + 0.1484, + 0.1423, + 0.1378, + 0.1334, + 0.1296, + 0.1211, + 0.1096, + 0.1023, + 0.09, + 0.0823 + ], + [ + 0.1582, + 0.1551, + 0.1514, + 0.1484, + 0.1423, + 0.1378, + 0.1334, + 0.1296, + 0.1211, + 0.1096, + 0.1023, + 0.09, + 0.0823 + ], + [ + 0.2448, + 0.2406, + 0.2356, + 0.2314, + 0.2233, + 0.2172, + 0.2115, + 0.2065, + 0.1954, + 0.1806, + 0.1712, + 0.1548, + 0.1444 + ], + [ + 0.2448, + 0.2406, + 0.2356, + 0.2314, + 0.2233, + 0.2172, + 0.2115, + 0.2065, + 0.1954, + 0.1806, + 0.1712, + 0.1548, + 0.1444 + ], + [ + 0.3806, + 0.3757, + 0.37, + 0.3652, + 0.3561, + 0.3495, + 0.3433, + 0.338, + 0.3262, + 0.311, + 0.3018, + 0.285, + 0.2745 + ], + [ + 0.3806, + 0.3757, + 0.37, + 0.3652, + 0.3561, + 0.3495, + 0.3433, + 0.338, + 0.3262, + 0.311, + 0.3018, + 0.285, + 0.2745 + ] + ] + }, + "MortalityDistributionFemale": { + "NumDistributionAxes": 2, + "AxisNames": [ + "age", + "year" + ], + "AxisUnits": [ + "years", + "simulation year" + ], + "AxisScaleFactors": [ + 365, + 1 + ], + "NumPopulationGroups": [ + 38, + 13 + ], + "PopulationGroups": [ + [ + 0, + 0.999, + 1, + 4.999, + 5, + 9.999, + 10, + 14.999, + 15, + 19.999, + 20, + 24.999, + 25, + 29.999, + 30, + 34.999, + 35, + 39.999, + 40, + 44.999, + 45, + 49.999, + 50, + 54.999, + 55, + 59.999, + 60, + 64.999, + 65, + 69.999, + 70, + 74.999, + 75, + 79.999, + 80, + 84.999, + 85, + 100 + ], + [ + 1952.5, + 1957.5, + 1962.5, + 1967.5, + 1972.5, + 1977.5, + 1982.5, + 1987.5, + 1992.5, + 1997.5, + 2002.5, + 2007.5, + 2012.5 + ] + ], + "ResultUnits": "Mortality rate in units of 1/year", + "ResultScaleFactor": 0.0027, + "ResultValues": [ + [ + 0.2156, + 0.2088, + 0.2004, + 0.1931, + 0.1801, + 0.1688, + 0.1607, + 0.1585, + 0.1462, + 0.1265, + 0.1084, + 0.0802, + 0.0593 + ], + [ + 0.2156, + 0.2088, + 0.2004, + 0.1931, + 0.1801, + 0.1688, + 0.1607, + 0.1585, + 0.1462, + 0.1265, + 0.1084, + 0.0802, + 0.0593 + ], + [ + 0.055, + 0.0525, + 0.0493, + 0.0466, + 0.0413, + 0.0368, + 0.0325, + 0.0293, + 0.0235, + 0.0165, + 0.0118, + 0.0071, + 0.0045 + ], + [ + 0.055, + 0.0525, + 0.0493, + 0.0466, + 0.0413, + 0.0368, + 0.0325, + 0.0293, + 0.0235, + 0.0165, + 0.0118, + 0.0071, + 0.0045 + ], + [ + 0.0093, + 0.0089, + 0.0084, + 0.008, + 0.007, + 0.0062, + 0.0055, + 0.0049, + 0.0043, + 0.0037, + 0.0033, + 0.0026, + 0.0019 + ], + [ + 0.0093, + 0.0089, + 0.0084, + 0.008, + 0.007, + 0.0062, + 0.0055, + 0.0049, + 0.0043, + 0.0037, + 0.0033, + 0.0026, + 0.0019 + ], + [ + 0.0051, + 0.0049, + 0.0046, + 0.0044, + 0.0039, + 0.0035, + 0.0032, + 0.0028, + 0.0023, + 0.0025, + 0.0031, + 0.0032, + 0.0027 + ], + [ + 0.0051, + 0.0049, + 0.0046, + 0.0044, + 0.0039, + 0.0035, + 0.0032, + 0.0028, + 0.0023, + 0.0025, + 0.0031, + 0.0032, + 0.0027 + ], + [ + 0.0071, + 0.0068, + 0.0064, + 0.0062, + 0.0056, + 0.005, + 0.0046, + 0.0043, + 0.0035, + 0.0028, + 0.0031, + 0.0025, + 0.002 + ], + [ + 0.0071, + 0.0068, + 0.0064, + 0.0062, + 0.0056, + 0.005, + 0.0046, + 0.0043, + 0.0035, + 0.0028, + 0.0031, + 0.0025, + 0.002 + ], + [ + 0.0089, + 0.0086, + 0.0081, + 0.0077, + 0.007, + 0.0064, + 0.0061, + 0.0072, + 0.0075, + 0.0065, + 0.0055, + 0.0036, + 0.0021 + ], + [ + 0.0089, + 0.0086, + 0.0081, + 0.0077, + 0.007, + 0.0064, + 0.0061, + 0.0072, + 0.0075, + 0.0065, + 0.0055, + 0.0036, + 0.0021 + ], + [ + 0.0097, + 0.0093, + 0.0088, + 0.0085, + 0.0077, + 0.007, + 0.007, + 0.0113, + 0.0189, + 0.0215, + 0.0206, + 0.0125, + 0.0058 + ], + [ + 0.0097, + 0.0093, + 0.0088, + 0.0085, + 0.0077, + 0.007, + 0.007, + 0.0113, + 0.0189, + 0.0215, + 0.0206, + 0.0125, + 0.0058 + ], + [ + 0.0101, + 0.0097, + 0.0092, + 0.0088, + 0.008, + 0.0073, + 0.0071, + 0.0115, + 0.0224, + 0.0308, + 0.0323, + 0.0201, + 0.01 + ], + [ + 0.0101, + 0.0097, + 0.0092, + 0.0088, + 0.008, + 0.0073, + 0.0071, + 0.0115, + 0.0224, + 0.0308, + 0.0323, + 0.0201, + 0.01 + ], + [ + 0.0108, + 0.0104, + 0.0099, + 0.0095, + 0.0087, + 0.0079, + 0.0076, + 0.0109, + 0.0215, + 0.034, + 0.0409, + 0.0273, + 0.0146 + ], + [ + 0.0108, + 0.0104, + 0.0099, + 0.0095, + 0.0087, + 0.0079, + 0.0076, + 0.0109, + 0.0215, + 0.034, + 0.0409, + 0.0273, + 0.0146 + ], + [ + 0.0114, + 0.011, + 0.0105, + 0.01, + 0.0092, + 0.0086, + 0.008, + 0.0091, + 0.0134, + 0.0206, + 0.0274, + 0.0205, + 0.0122 + ], + [ + 0.0114, + 0.011, + 0.0105, + 0.01, + 0.0092, + 0.0086, + 0.008, + 0.0091, + 0.0134, + 0.0206, + 0.0274, + 0.0205, + 0.0122 + ], + [ + 0.0124, + 0.012, + 0.0115, + 0.011, + 0.0102, + 0.0096, + 0.0091, + 0.0099, + 0.0117, + 0.014, + 0.0173, + 0.0134, + 0.0086 + ], + [ + 0.0124, + 0.012, + 0.0115, + 0.011, + 0.0102, + 0.0096, + 0.0091, + 0.0099, + 0.0117, + 0.014, + 0.0173, + 0.0134, + 0.0086 + ], + [ + 0.0164, + 0.0159, + 0.0152, + 0.0147, + 0.0136, + 0.0128, + 0.0121, + 0.0124, + 0.0129, + 0.0127, + 0.0125, + 0.0092, + 0.0066 + ], + [ + 0.0164, + 0.0159, + 0.0152, + 0.0147, + 0.0136, + 0.0128, + 0.0121, + 0.0124, + 0.0129, + 0.0127, + 0.0125, + 0.0092, + 0.0066 + ], + [ + 0.0226, + 0.022, + 0.0211, + 0.0204, + 0.019, + 0.0179, + 0.0168, + 0.0165, + 0.0158, + 0.0143, + 0.0128, + 0.0093, + 0.007 + ], + [ + 0.0226, + 0.022, + 0.0211, + 0.0204, + 0.019, + 0.0179, + 0.0168, + 0.0165, + 0.0158, + 0.0143, + 0.0128, + 0.0093, + 0.007 + ], + [ + 0.0373, + 0.0361, + 0.0347, + 0.0334, + 0.0311, + 0.0292, + 0.0275, + 0.0262, + 0.0239, + 0.0205, + 0.0178, + 0.0131, + 0.0104 + ], + [ + 0.0373, + 0.0361, + 0.0347, + 0.0334, + 0.0311, + 0.0292, + 0.0275, + 0.0262, + 0.0239, + 0.0205, + 0.0178, + 0.0131, + 0.0104 + ], + [ + 0.0585, + 0.0568, + 0.0546, + 0.0528, + 0.0494, + 0.0467, + 0.044, + 0.0417, + 0.037, + 0.0316, + 0.0272, + 0.021, + 0.0174 + ], + [ + 0.0585, + 0.0568, + 0.0546, + 0.0528, + 0.0494, + 0.0467, + 0.044, + 0.0417, + 0.037, + 0.0316, + 0.0272, + 0.021, + 0.0174 + ], + [ + 0.096, + 0.0933, + 0.09, + 0.0872, + 0.0822, + 0.0781, + 0.0741, + 0.0706, + 0.0636, + 0.0543, + 0.0481, + 0.0385, + 0.0331 + ], + [ + 0.096, + 0.0933, + 0.09, + 0.0872, + 0.0822, + 0.0781, + 0.0741, + 0.0706, + 0.0636, + 0.0543, + 0.0481, + 0.0385, + 0.0331 + ], + [ + 0.1539, + 0.1499, + 0.145, + 0.1408, + 0.1335, + 0.1278, + 0.1223, + 0.1174, + 0.1076, + 0.0946, + 0.086, + 0.072, + 0.0636 + ], + [ + 0.1539, + 0.1499, + 0.145, + 0.1408, + 0.1335, + 0.1278, + 0.1223, + 0.1174, + 0.1076, + 0.0946, + 0.086, + 0.072, + 0.0636 + ], + [ + 0.2418, + 0.2362, + 0.2294, + 0.2236, + 0.2133, + 0.2061, + 0.1988, + 0.1923, + 0.1794, + 0.1626, + 0.1514, + 0.1324, + 0.1202 + ], + [ + 0.2418, + 0.2362, + 0.2294, + 0.2236, + 0.2133, + 0.2061, + 0.1988, + 0.1923, + 0.1794, + 0.1626, + 0.1514, + 0.1324, + 0.1202 + ], + [ + 0.3702, + 0.3636, + 0.3558, + 0.3492, + 0.3377, + 0.3299, + 0.3221, + 0.3153, + 0.3019, + 0.2853, + 0.2746, + 0.2558, + 0.243 + ], + [ + 0.3702, + 0.3636, + 0.3558, + 0.3492, + 0.3377, + 0.3299, + 0.3221, + 0.3153, + 0.3019, + 0.2853, + 0.2746, + 0.2558, + 0.243 + ] + ] + }, + "FertilityDistribution": { + "NumDistributionAxes": 2, + "AxisNames": [ + "age", + "year" + ], + "AxisUnits": [ + "years", + "simulation year" + ], + "AxisScaleFactors": [ + 365, + 1 + ], + "NumPopulationGroups": [ + 14, + 26 + ], + "PopulationGroups": [ + [ + 15, + 19.9999, + 20, + 24.9999, + 25, + 29.9999, + 30, + 34.9999, + 35, + 39.9999, + 40, + 44.9999, + 45, + 50 + ], + [ + 1950, + 1954.999, + 1955, + 1959.999, + 1960, + 1964.999, + 1965, + 1969.999, + 1970, + 1974.999, + 1975, + 1979.999, + 1980, + 1984.999, + 1985, + 1989.999, + 1990, + 1994.999, + 1995, + 1999.999, + 2000, + 2004.999, + 2005, + 2009.999, + 2010, + 2015 + ] + ], + "ResultUnits": "annual births per 1000 individuals", + "ResultScaleFactor": 2.7397e-006, + "ResultValues": [ + [ + 182.6, + 182.6, + 183.9, + 183.9, + 186.6, + 186.6, + 192, + 192, + 197.3, + 197.3, + 202.5, + 202.5, + 202.5, + 202.5, + 194.5, + 194.5, + 164.2, + 164.2, + 166.1, + 166.1, + 158.3, + 158.3, + 156.4, + 156.4, + 140.2, + 140.2 + ], + [ + 182.6, + 182.6, + 183.9, + 183.9, + 186.6, + 186.6, + 192, + 192, + 197.3, + 197.3, + 202.5, + 202.5, + 202.5, + 202.5, + 194.5, + 194.5, + 164.2, + 164.2, + 166.1, + 166.1, + 158.3, + 158.3, + 156.4, + 156.4, + 140.2, + 140.2 + ], + [ + 288.3, + 288.3, + 290.4, + 290.4, + 294.7, + 294.7, + 303.2, + 303.2, + 311.5, + 311.5, + 319.8, + 319.8, + 319.8, + 319.8, + 307.2, + 307.2, + 297, + 297, + 305.3, + 305.3, + 291, + 291, + 271.4, + 271.4, + 251.8, + 251.8 + ], + [ + 288.3, + 288.3, + 290.4, + 290.4, + 294.7, + 294.7, + 303.2, + 303.2, + 311.5, + 311.5, + 319.8, + 319.8, + 319.8, + 319.8, + 307.2, + 307.2, + 297, + 297, + 305.3, + 305.3, + 291, + 291, + 271.4, + 271.4, + 251.8, + 251.8 + ], + [ + 279.2, + 279.2, + 281.3, + 281.3, + 285.5, + 285.5, + 293.7, + 293.7, + 301.7, + 301.7, + 309.8, + 309.8, + 309.8, + 309.8, + 297.6, + 297.6, + 272.3, + 272.3, + 274.5, + 274.5, + 261.6, + 261.6, + 242, + 242, + 220.3, + 220.3 + ], + [ + 279.2, + 279.2, + 281.3, + 281.3, + 285.5, + 285.5, + 293.7, + 293.7, + 301.7, + 301.7, + 309.8, + 309.8, + 309.8, + 309.8, + 297.6, + 297.6, + 272.3, + 272.3, + 274.5, + 274.5, + 261.6, + 261.6, + 242, + 242, + 220.3, + 220.3 + ], + [ + 246.7, + 246.7, + 248.5, + 248.5, + 252.2, + 252.2, + 259.5, + 259.5, + 266.6, + 266.6, + 273.7, + 273.7, + 273.7, + 273.7, + 262.9, + 262.9, + 244.8, + 244.8, + 217.8, + 217.8, + 207.6, + 207.6, + 207.8, + 207.8, + 190.3, + 190.3 + ], + [ + 246.7, + 246.7, + 248.5, + 248.5, + 252.2, + 252.2, + 259.5, + 259.5, + 266.6, + 266.6, + 273.7, + 273.7, + 273.7, + 273.7, + 262.9, + 262.9, + 244.8, + 244.8, + 217.8, + 217.8, + 207.6, + 207.6, + 207.8, + 207.8, + 190.3, + 190.3 + ], + [ + 181.6, + 181.6, + 183, + 183, + 185.7, + 185.7, + 191, + 191, + 196.3, + 196.3, + 201.5, + 201.5, + 201.5, + 201.5, + 193.6, + 193.6, + 185.9, + 185.9, + 168.1, + 168.1, + 160.2, + 160.2, + 161.8, + 161.8, + 140.1, + 140.1 + ], + [ + 181.6, + 181.6, + 183, + 183, + 185.7, + 185.7, + 191, + 191, + 196.3, + 196.3, + 201.5, + 201.5, + 201.5, + 201.5, + 193.6, + 193.6, + 185.9, + 185.9, + 168.1, + 168.1, + 160.2, + 160.2, + 161.8, + 161.8, + 140.1, + 140.1 + ], + [ + 116.6, + 116.6, + 117.4, + 117.4, + 119.2, + 119.2, + 122.6, + 122.6, + 126, + 126, + 129.3, + 129.3, + 129.3, + 129.3, + 124.2, + 124.2, + 115.5, + 115.5, + 98.5, + 98.5, + 93.8, + 93.8, + 84.8, + 84.8, + 80.5, + 80.5 + ], + [ + 116.6, + 116.6, + 117.4, + 117.4, + 119.2, + 119.2, + 122.6, + 122.6, + 126, + 126, + 129.3, + 129.3, + 129.3, + 129.3, + 124.2, + 124.2, + 115.5, + 115.5, + 98.5, + 98.5, + 93.8, + 93.8, + 84.8, + 84.8, + 80.5, + 80.5 + ], + [ + 75, + 75, + 75.6, + 75.6, + 76.7, + 76.7, + 78.9, + 78.9, + 81.1, + 81.1, + 83.2, + 83.2, + 83.2, + 83.2, + 79.9, + 79.9, + 60.3, + 60.3, + 49.7, + 49.7, + 47.4, + 47.4, + 35.8, + 35.8, + 26.8, + 26.8 + ], + [ + 75, + 75, + 75.6, + 75.6, + 76.7, + 76.7, + 78.9, + 78.9, + 81.1, + 81.1, + 83.2, + 83.2, + 83.2, + 83.2, + 79.9, + 79.9, + 60.3, + 60.3, + 49.7, + 49.7, + 47.4, + 47.4, + 35.8, + 35.8, + 26.8, + 26.8 + ] + ] + } + } + } + ] +} + diff --git a/examples/blantyre_noHINT/from_files/campaign_feb162019.json b/examples/blantyre_noHINT/from_files/campaign_feb162019.json new file mode 100644 index 0000000..c71f783 --- /dev/null +++ b/examples/blantyre_noHINT/from_files/campaign_feb162019.json @@ -0,0 +1,30 @@ +{ + "Events": [ + { + "Event_Coordinator_Config": { + "Demographic_Coverage": 0.01, + "Intervention_Config": { + "Delay_Distribution": "UNIFORM_DURATION", + "Delay_Period_Max": 30, + "Delay_Period_Min": 1, + "Outbreak_Source": "PrevalenceIncrease", + "class": "OutbreakIndividual" + }, + "Number_Repetitions": 5, + "Property_Restrictions": [], + "Property_Restrictions__KP_OutbreakSeed": "<--MARKER", + "Timesteps_Between_Repetitions": 730, + "class": "StandardInterventionDistributionEventCoordinator" + }, + "Event_Name": "Outbreak", + "Nodeset_Config": { + "class": "NodeSetAll" + }, + "Start_Day": 1, + "Target_Demographic": "Everyone", + "class": "CampaignEvent" + } + ], + "Use_Defaults": 1, + "class": "Campaign" +} \ No newline at end of file diff --git a/examples/blantyre_noHINT/from_files/config_comps_ref.json b/examples/blantyre_noHINT/from_files/config_feb162019.json similarity index 62% rename from examples/blantyre_noHINT/from_files/config_comps_ref.json rename to examples/blantyre_noHINT/from_files/config_feb162019.json index 9482ced..818c9b3 100644 --- a/examples/blantyre_noHINT/from_files/config_comps_ref.json +++ b/examples/blantyre_noHINT/from_files/config_feb162019.json @@ -1,48 +1,42 @@ { "parameters": { - "Custom_Coordinator_Events": [], - "Custom_Individual_Events": [], - "Custom_Node_Events": [], - "Enable_Abort_Zero_Infectivity": 0, - "Enable_Maternal_Protection": 0, - "Enable_Natural_Mortality": 1, - "Enable_Susceptibility_Scaling": 0, - "Report_Coordinator_Event_Recorder": 0, - "Report_Node_Event_Recorder": 0, - "Report_Surveillance_Event_Recorder": 0, - + "Enable_Abort_Zero_Infectivity": 0, + "Typhoid_Immunity_Memory": 36500, "Acquisition_Blocking_Immunity_Decay_Rate": 0.1, "Acquisition_Blocking_Immunity_Duration_Before_Decay": 60, "Age_Initialization_Distribution_Type": "DISTRIBUTION_COMPLEX", - "Air_Temperature_Filename": "", + "Air_Temperature_Filename": "Namawala_single_node_air_temperature_daily.bin", "Air_Temperature_Offset": 0, "Air_Temperature_Variance": 2, "Animal_Reservoir_Type": "NO_ZOONOSIS", "Base_Air_Temperature": 30, "Base_Incubation_Period": 3000000, - "Base_Individual_Sample_Rate": 0.25, + "Base_Individual_Sample_Rate": 1, "Base_Infectious_Period": 70000000, "Base_Infectivity": 0.3, "Base_Land_Temperature": 30, "Base_Mortality": 0, - "Base_Population_Scale_Factor": 1.64, + "Base_Population_Scale_Factor": 0.03, "Base_Rainfall": 100, "Base_Relative_Humidity": 0.5, - "Base_Year": 1917, + "Base_Year": 1920, "Birth_Rate_Dependence": "INDIVIDUAL_PREGNANCIES_BY_AGE_AND_YEAR", "Birth_Rate_Time_Dependence": "NONE", "Burnin_Cache_Mode": "none", "Burnin_Cache_Period": 0, "Burnin_Name": "", - "Campaign_Filename": "campaign_routine_exp.json", + "Campaign_Filename": "campaign_feb162019.json", "Climate_Model": "CLIMATE_OFF", "Climate_Update_Resolution": "CLIMATE_UPDATE_DAY", "Config_Name": "149_Typhoid", - "Death_Rate_Dependence": "NONDISEASE_MORTALITY_BY_AGE_AND_GENDER", + "Custom_Coordinator_Events": [], + "Custom_Individual_Events": [], + "Custom_Node_Events": [], + "Death_Rate_Dependence": "NONDISEASE_MORTALITY_BY_YEAR_AND_AGE_FOR_EACH_GENDER", "Default_Geography_Initial_Node_Population": 1000, "Default_Geography_Torus_Size": 10, "Demographics_Filenames": [ - "TestDemographics_Mystery_Fert.json" + "TestDemographics_Blantyre.json" ], "Enable_Absolute_Time": "NO", "Enable_Aging": 1, @@ -60,32 +54,39 @@ "Enable_Heterogeneous_Intranode_Transmission": 0, "Enable_Immune_Decay": 0, "Enable_Immunity": 0, + "Enable_Immunity_Distribution": 0, "Enable_Immunity_Initialization_Distribution": 0, + "Enable_Initial_Prevalence": 0, "Enable_Interventions": 1, + "Enable_Maternal_Antibodies_Transmission": 0, + "Enable_Maternal_Infection_Transmission": 0, + "Enable_Maternal_Protection": 0, "Enable_Maternal_Transmission": 0, + "Enable_Natural_Mortality": 1, "Enable_Property_Output": 0, "Enable_Rainfall_Stochasticity": 1, - "_Enable_Skipping": 1, - "Enable_Skipping": 0, + "Enable_Skipping": 1, "Enable_Spatial_Output": 0, "Enable_Superinfection": 0, + "Enable_Susceptibility_Scaling": 0, "Enable_Vital_Dynamics": 1, "Environmental_Incubation_Period": 1, - "Geography": "", + "Exposure_Days": 7300, + "Geography": "Santiago", "Immunity_Acquisition_Factor": 0, "Immunity_Initialization_Distribution_Type": "DISTRIBUTION_OFF", "Immunity_Mortality_Factor": 0, "Immunity_Transmission_Factor": 0, "Incubation_Period_Distribution": "FIXED_DURATION", - "Individual_Sampling_Type": "FIXED_SAMPLING", + "Individual_Sampling_Type": "TRACK_ALL", "Infection_Updates_Per_Timestep": 1, "Infectious_Period_Distribution": "EXPONENTIAL_DURATION", "Infectivity_Scale_Type": "CONSTANT_INFECTIVITY", - "Inset_Chart_Reporting_Start_Year": 1917, - "Inset_Chart_Reporting_Stop_Year": 2100, + "Inset_Chart_Reporting_Start_Year": 1920, + "Inset_Chart_Reporting_Stop_Year": 2020, "Job_Node_Groups": "Chassis08", "Job_Priority": "BELOWNORMAL", - "Land_Temperature_Filename": "", + "Land_Temperature_Filename": "Namawala_single_node_land_temperature_daily.bin", "Land_Temperature_Offset": 0, "Land_Temperature_Variance": 2, "Listed_Events": [], @@ -100,9 +101,10 @@ "Mortality_Blocking_Immunity_Decay_Rate": 0.001, "Mortality_Blocking_Immunity_Duration_Before_Decay": 60, "Mortality_Time_Course": "DAILY_MORTALITY", - "Node_Contagion_Decay_Rate": 0.056278, + "Node_Contagion_Decay_Rate": 0.24, "Node_Grid_Size": 0.009, "Num_Cores": 1, + "Num_Retries": 5, "Number_Basestrains": 1, "Number_Substrains": 1, "PKPD_Model": "FIXED_DURATION_CONSTANT_EFFECT", @@ -110,15 +112,18 @@ "Population_Density_Infectivity_Correction": "CONSTANT_INFECTIVITY", "Population_Scale_Type": "FIXED_SCALING", "Python_Script_Path": "\\\\idmppfil01\\idm\\home\\jgauld\\input\\Python_Scripts\\", - "Rainfall_Filename": "", + "Rainfall_Filename": "Namawala_single_node_rainfall_daily.bin", "Rainfall_Scale_Factor": 1, - "Relative_Humidity_Filename": "", + "Relative_Humidity_Filename": "Namawala_single_node_relative_humidity_daily.bin", "Relative_Humidity_Scale_Factor": 1, "Relative_Humidity_Variance": 0.05, + "Report_Coordinator_Event_Recorder": 0, "Report_Event_Recorder": 0, - "Report_Typhoid_ByAgeAndGender_Start_Year": 2000, - "Report_Typhoid_ByAgeAndGender_Stop_Year": 2100, - "Run_Number": 130, + "Report_Node_Event_Recorder": 0, + "Report_Surveillance_Event_Recorder": 0, + "Report_Typhoid_ByAgeAndGender_Start_Year": 2010, + "Report_Typhoid_ByAgeAndGender_Stop_Year": 2020, + "Run_Number": 835116, "Sample_Rate_0_18mo": 1, "Sample_Rate_10_14": 1, "Sample_Rate_15_19": 1, @@ -127,36 +132,38 @@ "Sample_Rate_5_9": 1, "Sample_Rate_Birth": 2, "Serialization_Test_Cycles": 0, - "Simulation_Duration": 44533, + "Simulation_Duration": 36500, "Simulation_Timestep": 1, "Simulation_Type": "TYPHOID_SIM", "Start_Time": 0, - "Susceptibility_Scaling_Type": "CONSTANT_SUSCEPTIBILITY", + "Susceptibility_Scale_Type": "CONSTANT_SUSCEPTIBILITY", "Transmission_Blocking_Immunity_Decay_Rate": 0.1, "Transmission_Blocking_Immunity_Duration_Before_Decay": 60, "Typhoid_3year_Susceptible_Fraction": 0, "Typhoid_6month_Susceptible_Fraction": 0, "Typhoid_6year_Susceptible_Fraction": 0, - "Typhoid_Acute_Infectiousness": 13436, - "Typhoid_Carrier_Probability": 1, + "Typhoid_Acute_Infectiousness": 13435, + "Typhoid_Carrier_Probability": 0.108, "Typhoid_Carrier_Removal_Year": 2500, - "Typhoid_Chronic_Relative_Infectiousness": 0.5, - "Typhoid_Contact_Exposure_Rate": 0.44535910269531453, - "Environmental_Cutoff_Days": 1, - "Typhoid_Environmental_Exposure_Rate": 0.24619971394455994, - "__Typhoid_Environmental_Exposure_Rate": 0.024619971394455994, - "Environmental_Peak_Start": 287.2811494864098, - "Environmental_Ramp_Down_Duration": 1, - "Environmental_Ramp_Up_Duration": 1, - "Typhoid_Exposure_Days": 3864.6481790944667, - "Typhoid_Exposure_Lambda": -0.6982908373479506, - "Typhoid_Immunity_Memory": 22750.6416223787, + "Typhoid_Chronic_Relative_Infectiousness": 0.241, + "Typhoid_Contact_Exposure_Rate": 0.06918859049226553, + "Typhoid_Environmental_Exposure_Rate": 0.06169346985005757, + + "Typhoid_Environmental_Cutoff_Days": 157.20690133538764, + "Typhoid_Environmental_Peak_Start": 355.0579483941714, + "Typhoid_Environmental_Ramp_Down_Duration": 112.30224910440123, + "Typhoid_Environmental_Ramp_Up_Duration": 39.540475369174146, + "Environmental_Cutoff_Days": 157.20690133538764, + "Environmental_Peak_Start": 355.0579483941714, + "Environmental_Ramp_Down_Duration": 112.30224910440123, + "Environmental_Ramp_Up_Duration": 39.540475369174146, + "Typhoid_Exposure_Lambda": 7.0, "Typhoid_Prepatent_Relative_Infectiousness": 0.5, - "Typhoid_Protection_Per_Infection": 0.7932246576828436, - "Typhoid_Subclinical_Relative_Infectiousness": 0.5, - "Typhoid_Symptomatic_Fraction": 0.04594935339672988, - "__sample_index__": 0, - "logLevel_default": "ERROR", + "Typhoid_Protection_Per_Infection": 0.98, + "Typhoid_Subclinical_Relative_Infectiousness": 1, + "Typhoid_Symptomatic_Fraction": 0.07, + "__sample_index__": 416, + "logLevel_default": "WARNING", "x_Air_Migration": 1, "x_Birth": 1, "x_Local_Migration": 1, diff --git a/examples/blantyre_noHINT/from_files/dtk_centos_2018.id b/examples/blantyre_noHINT/from_files/dtk_centos_2018.id new file mode 100644 index 0000000..f31211e --- /dev/null +++ b/examples/blantyre_noHINT/from_files/dtk_centos_2018.id @@ -0,0 +1 @@ +79791913-ee50-ee11-aa0a-b88303911bc1::Asset Collection \ No newline at end of file diff --git a/examples/blantyre_noHINT/from_files/example.py b/examples/blantyre_noHINT/from_files/example.py index 0ad9471..a568f6a 100755 --- a/examples/blantyre_noHINT/from_files/example.py +++ b/examples/blantyre_noHINT/from_files/example.py @@ -18,15 +18,24 @@ import manifest +sim_idx = 0 def update_sim_random_seed(simulation, value): - return {"Run_Number": value} + global sim_idx + sim_idx += 1 + simulation.task.config["Run_Number"] = value + return {"Run_Number": value, "idx": sim_idx } + +def update_sim_param(simulation, value): + simulation.task.config["Typhoid_Acute_Infectiousness"] = 13435+value + return {"Typhoid_Acute_Infectiousness": 13435+value} def run(): # Create a platform # Show how to dynamically set priority and node_group platform = Platform("SLURM", node_group="idm_48cores", priority="Highest") - task = EMODTask.from_files(config_path="config_comps_ref.json", eradication_path=manifest.eradication_path, campaign_path="campaign_routine_exp.json", demographics_paths=["TestDemographics_Mystery_Fert.json"], ep4_path=None) + task = EMODTask.from_files(config_path="config_feb162019.json", eradication_path=manifest.eradication_path, campaign_path="campaign_feb162019.json", demographics_paths=["TestDemographics_Blantyre.json"], ep4_path=None) + print("Adding asset dir...") task.common_assets.add_directory(assets_directory=manifest.reporters, relative_path="reporter_plugins") @@ -35,22 +44,27 @@ def run(): # Create simulation sweep with builder builder = SimulationBuilder() - builder.add_sweep_definition( update_sim_random_seed, range(1) ) + builder.add_sweep_definition( update_sim_random_seed, range(4) ) + builder.add_sweep_definition( update_sim_param, range(4) ) + exp_name = "Typhoid Blantyre NoHINT emodpy from_files" # create experiment from builder - experiment = Experiment.from_builder(builder, task, name="Typhoid Blantyre emodpy") + experiment = Experiment.from_builder(builder, task, name=exp_name ) # The last step is to call run() on the ExperimentManager to run the simulations. experiment.run(wait_until_done=True, platform=platform) task.handle_experiment_completion( experiment ) # download and plot some stuff. - EMODTask.get_file_from_comps( experiment.uid, [ "InsetChart.json", "SpatialOutput_Prevalence.bin" ] ) - task.cache_experiment_metadata_in_sql( experiment.uid ) - import emod_api.channelreports.plot_icj_means as plotter - chan_data = plotter.collect( str( experiment.uid ), "Infected" ) - plotter.display( chan_data, False, "Infected", str( experiment.uid ) ) + EMODTask.get_file_from_comps( experiment.uid, [ "InsetChart.json" ] ) + task.cache_experiment_metadata_in_sql( experiment.uid, path=exp_name ) + #import emod_api.channelreports.plot_icj_means as plotter + #chan_data = plotter.collect( "Typhoid Blantyre NoHINT emodpy from_files".replace( " ", "_" ), "Infected" ) + #plotter.display( chan_data, False, "Infected", str( experiment.uid ) ) if __name__ == "__main__": + # Uncomment these two lines just for when you run first time after installing a new emod-typhoid module. + #import emod_typhoid.bootstrap as dtk + #dtk.setup( manifest.model_dl_dir ) run() diff --git a/examples/blantyre_noHINT/from_files/manifest.py b/examples/blantyre_noHINT/from_files/manifest.py index 7821ad8..361640b 100644 --- a/examples/blantyre_noHINT/from_files/manifest.py +++ b/examples/blantyre_noHINT/from_files/manifest.py @@ -1,10 +1,12 @@ import os requirements = "./requirements.txt" #model_dl_dir = "stash" -model_dl_dir = "model-from-to" +#model_dl_dir = "model-from-to" +model_dl_dir = "model_2018" schema_file=os.path.join(model_dl_dir, "schema.json") eradication_path=os.path.join(model_dl_dir, "Eradication") assets_input_dir="Assets" reporters=model_dl_dir -sif="dtk_centos.id" +#sif="dtk_centos.id" +sif="dtk_centos_2018.id" world_bank_dataset="../world_bank_dataset.csv" diff --git a/examples/start_here/example.py b/examples/start_here/example.py index e3eb2c8..1f79a10 100755 --- a/examples/start_here/example.py +++ b/examples/start_here/example.py @@ -31,13 +31,17 @@ def set_param_fn( config ): config.parameters.Simulation_Type = "TYPHOID_SIM" config.parameters.Simulation_Duration = 365.0 config.parameters.Base_Individual_Sample_Rate = 0.25 - #config.parameters.Enable_Birth = 0 # temporary - config.parameters.Minimum_End_Time = 90 + #config.parameters.Minimum_End_Time = 90 # cover up for default bugs in schema - config.parameters.Inset_Chart_Reporting_Start_Year = 1850 + config.parameters.Inset_Chart_Reporting_Start_Year = 1900 config.parameters.Inset_Chart_Reporting_Stop_Year = 2050 config.parameters.Enable_Demographics_Reporting = 0 + config.parameters.Node_Contagion_Decay_Rate = 0.33 + + # when using 2018 binary + import emodpy_typhoid.config as config_utils + config_utils.cleanup_for_2018_mode( config ) return config @@ -92,15 +96,16 @@ def run_test(): task.handle_experiment_completion( experiment ) # download and plot some stuff. - EMODTask.get_file_from_comps( experiment.uid, [ "InsetChart.json" ] ) - task.cache_experiment_metadata_in_sql( experiment.uid ) - import emod_api.channelreports.plot_icj_means as plotter - chan_data = plotter.collect( str( experiment.uid ), "Infected" ) - plotter.display( chan_data, False, "Infected", str( experiment.uid ) ) + if experiment.succeeded: + EMODTask.get_file_from_comps( experiment.uid, [ "InsetChart.json", "ReportTyphoidByAgeAndGender.csv" ], group=True ) + task.cache_experiment_metadata_in_sql( experiment.uid ) + #import emod_api.channelreports.plot_icj_means as plotter + #chan_data = plotter.collect( str( experiment.uid ), "Infected" ) + #plotter.display( chan_data, False, "Infected", str( experiment.uid ) ) if __name__ == "__main__": import emod_typhoid.bootstrap as dtk - dtk.setup( manifest.model_dl_dir ) + #dtk.setup( manifest.model_dl_dir ) run_test() diff --git a/examples/start_here/manifest.py b/examples/start_here/manifest.py index 5648b1d..17f8239 100644 --- a/examples/start_here/manifest.py +++ b/examples/start_here/manifest.py @@ -5,5 +5,5 @@ eradication_path=os.path.join(model_dl_dir, "Eradication") assets_input_dir="Assets" reporters=model_dl_dir -sif="dtk_centos.id" +sif="dtk_centos_2018.id" world_bank_dataset="../world_bank_dataset.csv" diff --git a/requirements_2018.txt b/requirements_2018.txt new file mode 100644 index 0000000..456a266 --- /dev/null +++ b/requirements_2018.txt @@ -0,0 +1,3 @@ +emodpy==1.22.0.dev3 +emod-api==1.30.0.dev4 +emod-typhoid==0.0.2.dev2