I'm trying to parse the results of a simulation to extract all of the results that are numpy arrays. When simulating over a simple material, we might get a single dictionary with array values:
{'material1':array, 'material2':array, ...}
In more complex material simulations, we end up with nested dictionaries like:
{'material1': {'shellmaterial':array, 'corematerial':array}}
The depth of the nesting is arbitrary, and what I want to do is create a plot where all of the available arrays are returned to the user, named by their nesting. So for example,the above structure would end up like:
{'material1.shellmaterial' : array, 'material1.corematerial' : array}
We'd then put these in a dropdown menu. for easy viewing in a plot. Does anyone have a good way to iterate through an arbitrarily nested dictionary and return only the array type values with the new keys as shown above?
Results have to be stored this way for json compatibility, so I can't really go back and refactor to avoid this.