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

[Fix] UnExpectedValueRangeError when phase appending after prediction #1188

Closed
lisphilar opened this issue Sep 11, 2022 · 0 comments · Fixed by #1189
Closed

[Fix] UnExpectedValueRangeError when phase appending after prediction #1188

lisphilar opened this issue Sep 11, 2022 · 0 comments · Fixed by #1189
Labels
bug Something isn't working

Comments

@lisphilar
Copy link
Owner

lisphilar commented Sep 11, 2022

Summary

Codes

import covsirphy as cs
snr = cs.ODEScenario.auto_build(geo="Japan", model=cs.SIRFModel)
snr.build_with_template(name="Predicted", template="Baseline");
snr.predict(days=30, name="Predicted")

Outputs

 UnExpectedValueRangeError                 Traceback (most recent call last)
/tmp/ipykernel_4885/3249802525.py in <cell line: 1>()
----> 1 snr.predict(days=30, name="Predicted", verbose=0);

~/work/covid19-sir/covid19-sir/.venv/lib/python3.9/site-packages/covsirphy/science/ode_scenario.py in predict(self, days, name, seed, verbose, X, **kwargs)
    534             (phase_df.index[-1]) | (phase_df["end"] < phase_df["end"].shift(periods=-1) - timedelta(days=3))]
    535         for phase_dict in phase_df.to_dict(orient="records"):
--> 536             self._append(name=name, **phase_dict)
    537         return self
    538 

~/work/covid19-sir/covid19-sir/.venv/lib/python3.9/site-packages/covsirphy/science/ode_scenario.py in _append(self, name, end, **kwargs)
    463                 target = end.strftime(self.DATE_FORMAT)
    464                 _min = (param_df.index[-1] + timedelta(days=3)).strftime(self.DATE_FORMAT)
--> 465             raise UnExpectedValueRangeError(
    466                 name="end", target=target, value_range=(_min, None)) from None
    467         self._snr_alias.update(name=name, target=snr_dict.copy())

UnExpectedValueRangeError: 'end' must be over or equal to 12Sep2022, but 10Sep2022 was applied. 

Environment

  • CovsirPhy version: 2.26.1
  • Python version: 3.9.13
  • Installation: poetry
  • System: WSL (Ubuntu)
@lisphilar lisphilar added the bug Something isn't working label Sep 11, 2022
@lisphilar lisphilar added this to the Release v2.26.2 milestone Sep 11, 2022
lisphilar added a commit that referenced this issue Sep 11, 2022
@lisphilar lisphilar mentioned this issue Sep 11, 2022
lisphilar added a commit that referenced this issue Sep 11, 2022
@lisphilar lisphilar reopened this Sep 11, 2022
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

Successfully merging a pull request may close this issue.

1 participant