imperialCHEPI / healthgps

Global Health Policy Simulation model (Health-GPS)
https://imperialchepi.github.io/healthgps/
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

Correct calculation of size of `calculated_stats_` vector #466

Closed TinyMarsh closed 3 months ago

TinyMarsh commented 3 months ago

In #453 I introduced the calculated_factors_ vector to store the calculated stats for each bin for each factor the user wants to calculate stats for. The size of this vector is calculated and set in initialise_vector method, but initially I only allowed one "channel" per factor. This PR fixes this by including the other "channels" in the vector resize calculation, namely those specified in the already-existing initialise_output_channels method:

https://github.com/imperialCHEPI/healthgps/blob/46677a62b0f66b650fb57edae14ca2a8688d5ca6/src/HealthGPS/analysis_module.cpp#L530-L559

I have also renamed the vector to calculated_stats_ as it seems more appropriate.

TinyMarsh commented 3 months ago

So I did some bits, but then realised that all I was doing was simple duplicating what the initialise_output_channels method was doing with the channels_ vector, so I have decided to just reuse that. @alexdewar you might want to take another look because this changes the changes in the PR a bit.