Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in scneario analysis with theoretical dataset #155

Closed
lisphilar opened this issue Jul 31, 2020 · 2 comments
Closed

Errors in scneario analysis with theoretical dataset #155

lisphilar opened this issue Jul 31, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@lisphilar
Copy link
Owner

lisphilar commented Jul 31, 2020

Summary

When use theoretical data, we know the parameter values without estimation. It is the best way to apply parameter values with Scenario.add(), but this failed with errors.

Codes and outputs:

import covsirphy as cs
# Instance to save population values
population_data = cs.PopulationData(filename=None)
# Set tau value and start date of records
example_data = cs.ExampleData(tau=1440, start_date="01Jan2020")
# Preset of SIR-F parameters
preset_dict = cs.SIRF.EXAMPLE["param_dict"]
# Create dataset from 01Jan2020 to 31Jan2020
area = {"country": "Theoretical"}
example_data.add(cs.SIRF, step_n=30, **area)
# Register population value
population_data.update(cs.SIRF.EXAMPLE["population"], **area)
# Create Scenario class
snl = cs.Scenario(example_data, population_data, tau=1440, **area)
# Set 0th phase from 02Jan2020 to 31Jan2020 with preset parameter values
snl.clear(include_past=True)
snl.add(end_date="31Jan2020", model=cs.SIRF, **preset_dict)
# Add main scenario
snl.add(end_date="31Dec2020", name="Main")
# Add lockdown scenario
rho_lock = snl.get("rho", phase="0th") / 2
snl.add(end_date="31Dec2020", name="Lockdown", rho=rho_lock)
# Add medicine scenario
kappa_med = snl.get("kappa", phase="0th") / 2
sigma_med = snl.get("sigma", phase="0th") * 2
snl.add(end_date="31Dec2020", name="Medicine", kappa=kappa_med, sigma=sigma_med)
# Add vaccine scenario
snl.add(end_date="31Dec2020", name="Vaccine", model=cs.SIRFV, omega=0.001)
# Summarize
snl.summary()
# Compare scenarios
snl.describe(y0_dict={"Vaccinated": 0})

This causes KeyError in creation of PopulationData instance, IndexError in Scenario.add() and KeyError in Scenario.describe() when model was change in the future phases.

Environment

  • CovsirPhy version: 2.6.0-alpha.fix.120
  • Python version; 3.8
  • Installation: pipenv
  • OS: WSL
@lisphilar lisphilar added the bug Something isn't working label Jul 31, 2020
@lisphilar lisphilar added this to the CovsirPhy version 2.7.0 milestone Jul 31, 2020
@lisphilar lisphilar changed the title Errors in scneario analysis with theoritical dataset Errors in scneario analysis with theoretical dataset Jul 31, 2020
@lisphilar
Copy link
Owner Author

Parameter name "alpha1" must be change to "alpha1 [-]" as the same as that of SIR-F model.

@lisphilar
Copy link
Owner Author

Fixed in version 2.6.0-beta.fix.120.155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant