COVID-IWG / epimargin

networked, stochastic SIRD epidemiological model with Bayesian parameter estimation and policy scenario comparison tools
https://www.adaptivecontrol.org/
MIT License
9 stars 5 forks source link

Fixes post #129 #131

Open dilawar opened 3 years ago

dilawar commented 3 years ago
File "/opt/hostedtoolcache/Python/3.7.11/x64/lib/python3.7/site-packages/epimargin-0.5.2-py3.7.egg/epimargin/models.py", line 151, in parallel_forward_epi_step
    S = max(0, S)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

This is most likely because S is np.array when tutorial.py is run and max(0, S) didn't like it.

Here is a small test case.

In [1]: import numpy as np

In [2]: a = np.random.random(10)

In [3]: a
Out[3]: 
array([0.74161063, 0.13805871, 0.28817543, 0.12530074, 0.79157786,
       0.32060232, 0.33857339, 0.94873227, 0.36442055, 0.65926711])

In [4]: max(0, a)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-beaec02e5a36> in <module>
----> 1 max(0, a)

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Related: https://github.com/openjournals/joss-reviews/issues/3464