GUI: L2 KeyError when running ERPYes100Trials.json
In dev version of the GUI, I noticed an L2 KeyError when running ERPYes100Trials.json. The plot is still generating correctly, but there's an error with serialize_simulation. See traceback below
KeyError Traceback (most recent call last) File ~/Documents/github_repos/hnn_testing/hnn_core_2/hnn_core/gui/gui.py:1532, in _serialize_simulation(log_out, sim_data, simulation_list_widget) 1530 with log_out: 1531 logger.info(f"Saving {sim_name}.txt") -> 1532 return serialize_simulation(sim_data, sim_name)
File ~/Documents/github_repos/hnn_testing/hnn_core_2/hnn_core/gui/gui.py:1553, in serialize_simulation(simulations_data, simulation_name) 1546 fmt = '%f, %f, %f, %f' 1548 for dpl_trial in simulation_data[simulation_name]['dpls']: 1549 # Combine all data columns at once 1550 signals_matrix = np.column_stack(( 1551 dpl_trial.times, 1552 dpl_trial.data['agg'], -> 1553 dpl_trial.data['L2'], 1554 dpl_trial.data['L5'] 1555 )) 1557 # Using StringIO to collect CSV data 1558 with io.StringIO() as output:
KeyError: 'L2'
cc @gtdang @kmilo9999
What is the data file you are using? Is it from the hnn-data repo? If so those are hierarchical json format, which hasn't been integrated in the new gui yet.
@dylansdaniels Can this be closed? I think the wrong file format was just being used.
This bug still appears to be active. I looked at this for a second, and it could be a backwards-compatibility issue with https://github.com/jonescompneurolab/hnn-data/blob/main/network-configurations/ERPYes100Trials.json . I got the same error AFTER it appeared to successfully simulate that file (i.e. it failed at the end). However, when I changed legacy_mode to False, the GUI refused to even load the network, suggesting that this network files needs some of the backwards-compatibility inherent in legacy_mode. If we can convert ERPYes100Trials.json into an equivalent version that doesn't need legacy config, then that should solve this issue. This implies the following: I don't think it's worth the trouble to enable legacy_mode support for the GUI.
This may be fixed by an unknown combination of prior changes to how our dipoles are calculated (maybe via github.com/jonescompneurolab/hnn-core/commit/6388f9f7c74f4943a1d9b06e9ae69314500913df ) and the bugfix in #1119.