Here are some comments on your code. It's all minor stuff, very impressive how much the code has come on.
I'm not sure if using a github issue is the best way to do this, but at least it makes it easy to reference the source directly.
First general comment: now that you're using gitub you don't need to save different file version (model1.py, model2.py, etc.). Every time you commits, github saves the old and new versions of the files, so you can go back to old file versions if you need to. You can also 'tag' the code to label it and make it easy to find a old version )
Hi Yannick,
Here are some comments on your code. It's all minor stuff, very impressive how much the code has come on.
I'm not sure if using a github issue is the best way to do this, but at least it makes it easy to reference the source directly.
First general comment: now that you're using gitub you don't need to save different file version (
model1.py
,model2.py
, etc.). Every time you commits, github saves the old and new versions of the files, so you can go back to old file versions if you need to. You can also 'tag' the code to label it and make it easy to find a old version )You should add a
.gitignore
file to your repository so that it contains the things you need to run the code (mainly source and documentation), but no temporary files that are created when you run it. Here's an example of one I have used: https://github.com/Urban-Analytics/dust/blob/main/.gitignore You should ignore things that are specific to your local installation, like temporary python compiled files (e.g.__pycache__
directory https://github.com/eeyouol/Covid_policy_response_abm/tree/master/__pycache__ ) and possibily your spyder project stuff (https://github.com/eeyouol/Covid_policy_response_abm/tree/master/.spyproject/config) (although maybe google 'sypder project files github' to see what should and shouldn't be included in a repository). These don't need to be in the repo because when someone runs the code they will be created automatically.Some specific comments:
current_model
variable will definitely represent a new model, not a model created in a previous loop iteration (if that's what you were worried about). The line: https://github.com/eeyouol/Covid_policy_response_abm/blob/f138e56bdae73af12edf47b75d54bcb6e72a6403/country_model_24_data_version.py#L478 creates a new object and assigns it to the variablecurrent_model
(whatever objectcurrent_model
used to point to, it doesn't point there now).weights
andweights_arg
) that point to the same thing. I think (unless I'm missing something) that you could re-define your function as follows, and then you don't need to do the variable assignment on lines 550 and 551:def resample_particles(cls, list_of_particles, weights):
Or, you could get rid of the
advance_particle
funtion entirely:will do the same thing.