cavcalc.env.configure#

cavcalc.env.configure(plt_style=None, **param_units)#

Configure cavcalc plotting style, and parameter unit overrides.

This function can be used both regularly, and via context-managed scopes using the with statement. In the latter case, any changes made via these configuration options will be reset on exit from the context-managed block.

Parameters:
plt_stylestr | dict | Path | list

The style-sheet to use, see matplotlib.pyplot.style.use() for details. Note that, in addition to the options specified in the linked matplotlib documentation, one can set this to "cavcalc" to use the default style-sheet that this package provides. This argument defaults to None, such that no style modification is performed (and matplotlib not imported); this way, the default behaviour of this function is to have as minimal impact on the users’ development workflow as possible.

**param_unitsKeyword Arguments

Keyword arguments specifying overrides for the units of any cavcalc parameter or parameter category. The names of these correspond exactly to those in the units section of a cavcalc.ini config file.

Examples

If you simply want to set-up the plotting style to be the same as the default style used when running cavcalc from the command line, then do:

import cavcalc as cc
cc.configure(plt_style="cavcalc")

or, if you only want to use this style-sheet temporarily:

import numpy as np

with cc.configure(plt_style="cavcalc"):
    # do stuff with cavcalc, e.g:
    cc.calculate("w", L=1, Rc=np.linspace(1, 5, 101)).plot()