djgroen / flee

flee agent-based modelling code
BSD 3-Clause "New" or "Revised" License
6 stars 7 forks source link

KeyError in plot_output Plugin #65

Closed mzrghorbani closed 1 year ago

mzrghorbani commented 1 year ago

Describe the bug

The _plotoutput plugin encounters a KeyError when producing plots. The specific key causing the error is 'Date sim'. This issue prevents the plugin from generating the expected output and saving plots in the desired png format.

Steps to Reproduce:

  1. Execute the command fabsim localhost plot_output:output after fetching the processed data.
  2. Observe the KeyError raised with the specific key 'Date sim'.

Expected Behavior:

The _plotoutput plugin should successfully generate the desired plots without encountering a KeyError.

Proposed Solution:

To address the KeyError, a temporary solution has been implemented in the code by modifying the loop to start from the second element of the list. While this temporarily resolves the issue, it is important to investigate the root cause of why 'Date sim' is stored in the CSV file headers. Identifying the inconsistency in CSV file generation will help in achieving a more robust and consistent solution.

Additional Information:

Please let me know if any further information or clarification is needed.

djgroen commented 1 year ago

Actually, this sounds more like a Flee issue, so I'll move it there.

djgroen commented 1 year ago

@mzrghorbani I am actually not able to reproduce this error. I did the following:

  1. pull latest versions of Flee, FabFlee and FabSim3
  2. Run `fabsim localhost pflee:mali2012,simulation_period=10,cores=2
  3. Run fabsim localhost fetch_results
  4. Run fabsim localhost plot_output:mali2012_localhost_2

All this gave expected behavior without a KeyError. I also checked the FabFlee and Flee repo, but could not find the 'fix' you've implemented and described in your issue?

Could you perhaps give me more specific information as to what circumstances triggered this KeyError?

djgroen commented 1 year ago

No response for over a month, so I assume this one got fixed. If not, please reopen it :).