You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use make_synthpop to add a population to a Sim object, with a synthpops population dict as my reference. I had been using this in a script previously, but with the latest update it no longer works, giving me an error originating in the "make_random_contacts" function.
The error message is:
TypeError Traceback (most recent call last)
<ipython-input-6-465ff658c7d6> in <module>()
3 use_waning=True))
4
----> 5 sim_household.popdict = cv.make_synthpop(sim=sim_household,population=sc.dcp(pop_dict))
1 frames
/usr/local/lib/python3.7/dist-packages/covasim/population.py in make_random_contacts(pop_size, n, overshoot, dispersion, mapping)
223
224 # Precalculate contacts
--> 225 n_all_contacts = int(pop_size*n*overshoot) # The overshoot is used so we won't run out of contacts if the Poisson draws happen to be higher than the expected value
226 all_contacts = cvu.choose_r(max_n=pop_size, n=n_all_contacts) # Choose people at random
227 if dispersion is None:
TypeError: unsupported operand type(s) for *: 'int' and 'dict'
The text was updated successfully, but these errors were encountered:
Thanks for your patience @cmerenstein and apologies it took much longer than we hoped to fix! We ended up completely revamping the way population loading/saving is handled, but the new system should be much easier to use. You can now do things like:
Hello,
I think there's an error in the newest version cv.make_synthpop, or at least a change in behavior that I can't find documentation on.
I made a minimal example of the issue in this colab: https://colab.research.google.com/drive/1fG8MxWYqhv44wpEDg0QzRpL1ySysfSp6?usp=sharing
which gets an error when running on the newest version of covasim, but not when installed with version 3.0.7. Below is more information on the bug:
I am trying to use make_synthpop to add a population to a Sim object, with a synthpops population dict as my reference. I had been using this in a script previously, but with the latest update it no longer works, giving me an error originating in the "make_random_contacts" function.
The error message is:
The text was updated successfully, but these errors were encountered: