Utility functions#

pybamm.get_git_commit_info()[source]#

Get the git commit info for the current PyBaMM version, e.g. v22.8-39-gb25ce8c41 (version 22.8, commit b25ce8c41)

pybamm.root_dir()[source]#

return the root directory of the PyBaMM install directory

class pybamm.Timer[source]#

Provides accurate timing.

Example

timer = pybamm.Timer() print(timer.time())

reset()[source]#

Resets this timer’s start time.

time()[source]#

Returns the time (float, in seconds) since this timer was created, or since meth:reset() was last called.

class pybamm.TimerTime(value)[source]#
class pybamm.FuzzyDict[source]#
copy() a shallow copy of D[source]#
get_best_matches(key)[source]#

Get best matches from keys

search(key, print_values=False)[source]#

Search dictionary for keys containing ‘key’. If print_values is True, then both the keys and values will be printed. Otherwise just the values will be printed. If no results are found, the best matches are printed.

pybamm.load(filename)[source]#

Load a saved object

pybamm.install_jax(arguments=None)[source]#

Install compatible versions of jax, jaxlib.

Command Line Interface:

$ pybamm_install_jax
optional arguments:
-h, –help show help message
-f, –force force install compatible versions of jax and jaxlib
pybamm.have_jax()[source]#

Check if jax and jaxlib are installed with the correct versions

Returns:

True if jax and jaxlib are installed with the correct versions, False if otherwise

Return type:

bool

pybamm.is_jax_compatible()[source]#

Check if the available versions of jax and jaxlib are compatible with PyBaMM

Returns:

True if jax and jaxlib are compatible with PyBaMM, False if otherwise

Return type:

bool