lib.data_vector.plotting.BaseDataPlotStyle¶
- class lib.data_vector.plotting.BaseDataPlotStyle(style=None, **kwargs)¶
Bases:
cosmopipe.lib.plotting.BasePlotStyleBase data plotting class. It holds default attributes (
xlabel,ylabel,colors, etc.) that can be set at initialization (style = BaseDataPlotStyle(colors='r')) or at any time usingupdate().Initialize
BaseDataPlotStyle.- Parameters
style (BaseDataPlotStyle, default=None) – A plotting style to start from, which will be updated with
kwargs.kwargs (dict) – Attributes for
BaseDataPlotStyle.
Methods
Return shallow copy of
self.deepcopyInstantiate and initalize class with state dictionary.
Return
valueif notNone, else attributenameif notNone, elsedefault.Return color corresponding to projection name
proj.Return standard deviation corresponding to the input covariance matrix.
Return x-coordinates of input covariance matrix.
Return mean y-coordinates provided in the input covariance matrix.
Return label corresponding to projection name
proj.Same as
get(), but ensuring returned value is a list.Return projection names of input data vector.
Return x-coordinates of input data vector.
Return y-coordinates of input data vector.
Return y-label, to be overriden.
is_mpi_broadcastis_mpi_gatheredis_mpi_rootis_mpi_scatteredLoad class in numpy binary format from disk.
If different formats are possible, this method should between them based on file name extension.
log_criticallog_debuglog_errorlog_infolog_warningPlot data vectors, optionally with error bars / shaded area from covariance.
Save class to disk.
If different formats are possible, this method should between them based on file name extension.
Save figure to
filename.Update attibutes with those in
kwargs.Attributes
loggerMPI attributes
mpicommmpirootmpistate- 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
valueif notNone, else attributenameif notNone, elsedefault.- Parameters
name (string) – Attribute name. If
None, defaults todefault.value (object, default=None) – Value. If
None, returns attributename.default (object, default=None) – Default value.
- get_color(proj, projs=None)¶
Return color corresponding to projection name
proj. Ifcolorsis a list, return colors at index ofprojin list of projection namesprojs.
- get_covstd(covariance, *args, **kwargs)¶
Return standard deviation corresponding to the input covariance matrix.
- get_covx(covariance, *args, **kwargs)¶
Return x-coordinates of input covariance matrix.
- get_covy(covariance, *args, **kwargs)¶
Return mean y-coordinates provided in the input covariance matrix.
- get_label(proj)¶
Return label corresponding to projection name
proj.
- get_list(name, value=None, default=None)¶
Same as
get(), but ensuring returned value is a list. Default length (seemake_list()) is taken asdefaultlength.
- get_projs(data_vector=None)¶
Return projection names of input data vector.
- get_x(data_vector, *args, **kwargs)¶
Return x-coordinates of input data vector.
- get_y(data_vector, *args, **kwargs)¶
Return y-coordinates of input data vector.
- get_ylabel()¶
Return y-label, to be overriden.
- classmethod load(filename, mpiroot=0, mpicomm=None)¶
Load class in numpy binary format from disk. If the loaded state contains
__class__and that exists incls._registry, return instance ofcls._registry[__class__](instead ofcls).
- load_auto(*args, **kwargs)¶
If different formats are possible, this method should between them based on file name extension.
- property mpiattrs¶
MPI attributes
- plot(data_vectors=None, covariance=None, error_mean=None, ax=None, filename=None)¶
Plot data vectors, optionally with error bars / shaded area from covariance.
- Parameters
data_vectors (list, DataVector, default=None) – Data vector(s) to plot. If
None,data_vectorsattribute is used.covariance (CovarianceMatrix, default=None) – If not
None, covariance matrix to use for error bars.error_mean (int, default=None) – If not
None, index of data vector indata_vectorsto use as mean when plotting error bars.ax (matplotlib.axes.Axes, default=None) – Axes where to plot data vectors. If
None, takes current axes.filename (string, default=None) – If not
None, file name where to save figure.
- Returns
ax
- Return type
matplotlib.axes.Axes
- 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.