Open kpelechrinis opened 4 years ago
Strange, did you pull an older version? I had the designated line like that: moving_population_size = int(1.0 / self.places[venue1].get_total_movements() )
Again for the second bit, try to pull the newest version :)
I am not sure when you forked!
Hmm is it the https://github.com/tnoulas/UrbanEpidemicSim/blob/master/UrbanEpidemicsSim.ipynb ? Because if it is, I still see the line for the moving_population_size
without the integer casting.
No this is the notebook version which is not up to date I think! Try to use python PlaceNetSim_v2.py as I noted in my last email. I will update the notebooks later. I am sorry for the confusion.
I am sorry about it. I even realised that I have two notebooks with slightly similar name ... That's what happens when you do things too fast I guess...
Reopening this as it happens to be the same line of code you mentioned that is buggy: moving_population_size = int(1.0 / self.places[venue1].get_total_movements() ) has been actually always reason.
for the time being I am setting each transition to just move one person: moving_population_size = 1
will try to think about it tomorrow with clear head :)
@tnoulas can take a look at it as well... maybe I can be of help.
I was getting an error at the following line:
moving_pop = random.sample(venue1_population_set, moving_population_size)
and the reason is that
moving_population_size
is defined as:moving_population_size = 1.0 / self.places[venue1].get_total_movements()
random.sample()
expects an integer as its second argument, so I assume that since each entry at thedf_transition_snap
is one transition, we can have:moving_pop = random.sample(venue1_population_set, 1)
Also at the population exchange, the following line was giving me a Typerror (
TypeError: unhashable type: 'list'
):new_venue2_pop = venue2_population_set.add(moving_pop)
and I changed it to
new_venue2_pop = venue2_population_set.union(moving_pop)
and works now.
Also I think that the following two lines at the end of this function should be one level of indentation to the left:
epoch+=1
date1 = date2