BDI-pathogens / OpenABM-Covid19

OpenABM-Covid19: an agent-based model for modelling the spread of SARS-CoV-2 (coronavirus) and control interventions for the Covid-19 epidemic
GNU General Public License v3.0
114 stars 76 forks source link

Changing household file breaks Jupyter kernel #47

Closed danilociaffi closed 4 years ago

danilociaffi commented 4 years ago

I changed the baseline_household_demographic.csv file in the repo to replace it with the same data about my country. When I run model = Model(params) in Jupyter the kernel dies and I get the following message:

Kernel Restarting
The kernel for dciaffi/analisi-dati/Covid/OpenABM-Covid19-master/examples/App_sim.ipynb appears to have died. It will restart automatically.

Note that I changed baseline_parameters.csv accordingly, so the population sampled in the households follows the same distribution as stated in the parameter file, and if I run the new parameter with the old household everything works fine.

Any idea on what's the problem here?

brynmathias commented 4 years ago

can you post a snippet of your household demographics file please @danilociaffi

danilociaffi commented 4 years ago

Sure. These are the first 10 rows:

a_0_9,a_10_19,a_20_29,a_30_39,a_40_49,a_50_59,a_60_69,a_70_79,a_80
0,0,0,1,0,0,2,0,0
0,1,0,0,0,1,0,0,0
1,1,0,0,2,0,0,0,0
0,0,0,1,0,0,0,0,0
0,2,0,0,2,0,0,0,0
0,0,0,0,0,0,0,1,0
0,0,0,0,0,0,0,2,0
0,2,0,0,2,0,0,0,0
0,1,1,0,2,0,0,0,0
0,0,0,0,0,0,0,1,0
...

We also cut to 10,000 lines to have it the same size as the original household.

For ease of comparison, here are the fist 10 rows of the original file:

a_0_9,a_10_19,a_20_29,a_30_39,a_40_49,a_50_59,a_60_69,a_70_79,a_80
0,0,0,0,2,0,0,0,0
0,1,0,0,0,0,0,0,0
0,0,0,1,0,0,2,0,0
0,2,0,0,1,0,0,0,0
0,0,1,0,1,0,0,0,0
0,0,2,0,0,0,0,0,0
0,0,0,0,1,0,0,0,0
0,0,0,0,0,0,0,1,0
0,0,0,0,1,0,1,1,0
1,2,0,2,0,0,0,0,0
...
brynmathias commented 4 years ago

Can you try loading it in pandas and passing the data frame to the params object? Its a bit slower but does the allocation on the fly

so

households = pd.read_csv("path")
params = Parameters(baseline_params, hosehold_params=households)
danilociaffi commented 4 years ago

Still breaks the kernel. However, I realized three of the rows had a household with more than 6 people, removing those made everything work (although still doesn't explain why the kernel breaks rather than returning an error message, but I reckon you probably have more important things to take care of).

Thank you for your assistance and your work!