Extend Step String Tagging Functionality
Description
This is a feature request covering multiple related feature additions surrounding the pybamm.step.string tags functionality. Currently there is the ability to add tags to pybamm step strings, and there is the ability to search an experiment for the indices where specific tags exist. There is not currently any additional functionality of the step string tags. The proposed added functionality is the following:
- The ability to search a solution object for specific steps based on tags
- The added functionality to export tags along with cycle and step indices when using the
Solution.get_data_dict()method
Motivation
I believe these features are the would-be natural evolution of additional functionality surrounding step string tags. I believe the true utility of these step string tags come when you can use them to filter a solution object, or to filter data exported from a solution object.
Possible Implementation
Core Implementation
I believe there are a number of steps for the proposed core implementation.
- Add a property to the
Solutionclass:.tags - By default, when running an experiment, each time a
step_solutionis generated, the tags from the associated step (from the experiment) should then be assigned as a property to theSolutionobject - The method
Solution.get_data_dict()should export a 'Tags' column along with 'Cycle' and 'Step' columns. - An additional method should be added:
Solution.search_tags(), similar toExperiment.search_tag(), allowing for searching of one of many tags in the solution sub_solutions
Additional Features
I also believe there are a number of additional changes that may be useful to include as well
- The inclusion of tags in the
__repr__of theSolutionobject - Similar to how tags would be associated with a
Solutionobject (as a property), there may also be the properties.cycleand.stepwhich are associated with aSolutionwhen the solution results from an experiment. - The
Solutionobject holds the additional variables, accessible through the__getitem__()method, being "Cycle", "Step", and "Tags"
Remaining Questions
- Should calling
Solution.get_data_dict()when there are no tags result in returning an empty "Tags" column, or no "Tags" column at all?
Additional context
No response
Should calling Solution.get_data_dict() when there are no tags result in returning an empty "Tags" column, or no "Tags" column at all?
I think an empty tags column is better for consistency