pybamm-team / PyBaMM

Fast and flexible physics-based battery models in Python
https://www.pybamm.org/
BSD 3-Clause "New" or "Revised" License
1.09k stars 539 forks source link

Improve documentation (ongoing) #3392

Open brosaplanella opened 1 year ago

brosaplanella commented 1 year ago

There are quite a few features that are not in the docs, and which would be fairly minor fixes. Opening a list here so we can keep track of them as we go and fix them in batches. Feel free to add more in the comments, and we can update the list.

User Guide

API Docs

API Docs - Small fixes suitable for first time contributors

ejfdickinson commented 1 year ago

I'd widen the one relating to "experiment steps" to make clear that it feels like bad practice to give detailed documentation for a constructor pybamm.step._Step() that is not supposed to be called in user code. Just list the permitted value formats and kwargs that can be used in the pybamm.step.[...] options.

ejfdickinson commented 1 year ago

Generally make clear where classes implement __getitem__ and/or __setitem__ and so these are the expected calling patterns.

Especially, make explicit that pybamm.Solution implements a dict of pybamm.ProcessedVariable instances, so that the standard calling pattern is using __getitem__() on the pybamm.Solution and then using a method of the pybamm.ProcessedVariable class.

ejfdickinson commented 1 year ago

pybamm.ProcessedVariable documents the public attribute data as "the same as entries" but doesn't document entries.

valentinsulzer commented 1 year ago

We could look into Google Season of Docs for this https://developers.google.com/season-of-docs/docs/timeline

Seems like there is a lot to be done to follow best practices, not requiring domain knowledge. @ejfdickinson seems like you have lots of good suggestions, would you be available to mentor?

ejfdickinson commented 1 year ago

@tinosulzer Yes in principle, but can you suggest what the time commitment and overall working period would be?

My suggestions are all provoked empirically by using the library for different tasks! I made a suggestion in DM to @brosaplanella which I'll copy here on how to identify areas where documentation is misaligned with expected use patterns.

My recommendation for the best thing you can do is get a couple of students who are good at Python but have never used PyBaMM before, and have them reproduce a few modelling papers, especially those that don't use PyBaMM. Then just sit over their shoulders and work out what is clear and what is not.

Here "sit over their shoulders" is not to be understood literally! Just get people writing down where things are non-obvious, touching base with power users, and then working out why the "power use" implementation couldn't be reasoned from the docs.