lib.plotting.BasePlotStyle

class lib.plotting.BasePlotStyle(style=None, **kwargs)

Bases: lib.utils.BaseClass

Base class to represent a plotting style. It holds attributes that can be set at initialization (style = BaseDataPlotStyle(color='r')) or at any time using update().

Methods

copy

Return shallow copy of self.

deepcopy

from_state

Instantiate and initalize class with state dictionary.

get

Return value if not None, else attribute name if not None, else default.

get_list

Same as get(), but ensuring returned value is a list.

is_mpi_broadcast

is_mpi_gathered

is_mpi_root

is_mpi_scattered

load

Load class in numpy binary format from disk.

load_auto

If different formats are possible, this method should between them based on file name extension.

log_critical

log_debug

log_error

log_info

log_warning

save

Save class to disk.

save_auto

If different formats are possible, this method should between them based on file name extension.

savefig

Save figure to filename.

update

Update attibutes with those in kwargs.

Attributes

logger

mpiattrs

MPI attributes

mpicomm

mpiroot

mpistate

copy()

Return shallow copy of self.

classmethod from_state(state, mpiroot=0, mpicomm=None)

Instantiate and initalize class with state dictionary.

get(name, value=None, default=None)

Return value if not None, else attribute name if not None, else default.

Parameters
  • name (string) – Attribute name. If None, defaults to default.

  • value (object, default=None) – Value. If None, returns attribute name.

  • default (object, default=None) – Default value.

get_list(name, value=None, default=None)

Same as get(), but ensuring returned value is a list. Default length (see make_list()) is taken as default length.

classmethod load(filename, mpiroot=0, mpicomm=None)

Load class in numpy binary format from disk. If the loaded state contains __class__ and that exists in cls._registry, return instance of cls._registry[__class__] (instead of cls).

load_auto(*args, **kwargs)

If different formats are possible, this method should between them based on file name extension.

property mpiattrs

MPI attributes

save(filename)

Save class to disk.

save_auto(*args, **kwargs)

If different formats are possible, this method should between them based on file name extension.

savefig(filename, fig=None)

Save figure to filename.

Parameters
  • filename (string) – Path where to save figure.

  • fig (matplotlib.figure.Figure, default=None) – Figure to save. Defaults to current figure.

update(**kwargs)

Update attibutes with those in kwargs.