epsproc.basicPlotters module

ePSproc basic plotting functions

Some basic functions for 2D/3D plots.

19/11/19 Adding plotting routines for matrix elements & beta values, to supercede existing basic methods.

07/11/19 v1 Molecular plotter for job info.

class epsproc.basicPlotters.Arrow3D(xs, ys, zs, *args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Define Arrow3D plotting class

Code verbatim from StackOverflow post https://stackoverflow.com/a/22867877 Thanks to CT Zhu, https://stackoverflow.com/users/2487184/ct-zhu

draw(renderer)[source]
epsproc.basicPlotters.BLMplot(BLM, thres=0.01, thresType='abs', xDim='Eke', backend='xr')[source]

Plotting routines for BLM values from Xarray. Plot line or surface plot, with various backends available.

Parameters:
  • BLM (Xarray) – Input data for plotting, dims assumed to be as per ePSproc.util.BLMdimList()
  • thres (float, optional, default 1e-2) – Value used for thresholding results, only values > thres will be included in the plot. Either abs or relative (%) value, according to thresType setting.
  • thresType (str, optional, default = 'abs') – Set to ‘abs’ or ‘pc’ for absolute threshold, or relative value (%age of max value in dataset)
  • xDim (str, optional, default = 'Eke') – Dimension to use for x-axis, also used for thresholding. Default plots (Eke, BLM) surfaces with subplots for (Euler). Change to ‘Euler’ to plot (Euler, BLM) with (Eke) subplots.
  • backend (str, optional, default = 'xr') – Plotter to use. Default is ‘xr’ for Xarray internal plotting. May be switched according to plot type in future…
epsproc.basicPlotters.lmPlot(data, pType='a', thres=0.01, thresType='abs', SFflag=True, logFlag=False, eulerGroup=True, selDims=None, sumDims=None, plotDims=None, squeeze=False, fillna=False, xDim='Eke', backend='sns', cmap=None, figsize=None, verbose=False, mMax=10, titleString=None)[source]

Plotting routine for ePS matrix elements & BLMs.

First pass - based on new codes + util functions from sphPlot.py, and matE sorting codes.

Parameters:
  • data (Xarray, data to plot.) – Should work for any Xarray, but optimised for dataTypes: - matE, matrix elements - BLM paramters - ADMs
  • pType (char, optional, default 'a' (abs values)) – Set (data) type to plot. See plotTypeSelector().
  • thres (float, optional, default 1e-2) – Value used for thresholding results, only values > thres will be included in the plot. Either abs or relative (%) value, according to thresType setting.
  • thresType (str, optional, default = 'abs') – Set to ‘abs’ or ‘pc’ for absolute threshold, or relative value (%age of max value in dataset)
  • SFflag (bool, optional, default = True) – For dataType = matE: Multiply by E-dependent scale factor. For dataType = BLM: Multiply by cross-section (XS) (I.e. if False, normalised BLMs are plotted, with B00 = 1)
  • logFlag (bool, optional, default = False) – Plot values on log10 scale.
  • eulerGroup (bool, optional, default = True) – Group Euler angles by set and use labels (currenly a bit flakey…)
  • selDims (dict, optional, default = {'Type':'L'}) – Dimensions to select from input Xarray.
  • sumDims (tuple, optional, default = None) – Dimensions to sum over from the input Xarray.
  • plotDims (tuple, optional, default = None) – Dimensions to stack for plotting, also controls order of stacking (hence sorting and plotting). Default case plots all dims not included in (xDim, sumDims, selDims). E.g. for matrix elements this will be (‘l’,’m’,’mu’,’Cont’,’Targ’,’Total’,’it’,’Type’) TO DO: auto generation for different dataType, also based on selDims and sumDims selections. 11/03/20: partially fixed, now add any missing dims to plot automatically. NOTE: this currently fails for ‘Labels’ case, not sure why.
  • squeeze (bool, optional, default = True) – Drop singleton dimensions from plot.
  • fillna (bool, optional, default = False) – Fill NaN values with 0 if True.
  • xDim (str, optional, default = 'Eke') – Dimension to use for x-axis, also used for thresholding. Default plots (Eke, LM) surfaces. NOTE: if xDim is a MultiIndex, pass as a dictionary mapping, otherwise it may be unstacked during data prep. E.g. for plotting stacked (L,M), set xDim = {‘LM’:[‘L’,’M’]} NOTE: this is currently also passed to matEleSelector(), so stacked dims must exist in inital Xarray. THIS SHOULD BE FIXED, since it’s a pain.
  • backend (str, optional, default = 'sns') – Plotter to use. Default is ‘sns’ for Seaborn clustermap plot. Set to ‘xr’ for Xarray internal plotting (not all passed args will be used in this case). May be switched according to plot type in future…
  • cmap (str, optional, default = None) – Cmap option to pass to sns clustermap plot.
  • figsize (tuple, optional, default None) – Tuple for Seaborn figure size (ratio), e.g. figsize = (15,5). Useful for setting a long axis explicitly in cases with large dimensional disparity. Default results in a square (ish) aspect.
  • verbose (bool, optional, default False) – Print debug info.
  • mMax (int, optional, default = 10) – Used as default for m colour mapping, in cases where coords are not parsed. TODO: fix this, it’s ugly.
  • titleString (str, optional, default = None) – Set main title for plot. If not set, filename or data.attr[‘jobLabel’] will be used if present. Some plot settings labels will also be appended to this.
Returns:

  • daPlot (Xarray) – Data subset as plotted.
  • legendList (list) – Labels & colour maps
  • g (figure object)

Notes

  • Improved dim handling, maybe use epsproc.util.matEdimList() (and related functions) to avoid hard-coding multiple cases here.
    • Partially implemented in dimMap.
    • Currently throws an error for None in symmetry plotting cases for unrecognised dataType. TO FIX!
      • 14/01/21 fixed, but possibly introduced other issues!
    • Consider consolidating mapping styles further, and keeping a global list of parent and child dims? Or otherwise pulling from stacked Xarray?
  • Improved handling of sets of polarization geometries (angles).
  • CONSOLIDATE stacked/unstacked dim handling. At the moment some functions use stacked, some unstacked, which is leading to annoying bugs.
  • 14/01/21 - Fixed bug in handling nested dims for unknown datatypes (hopefully), specifically for Sym dims.
  • 27/02/20 - handling for MultiIndex cases for Wigner 3j type data (function of (l,lp,L,m,mp,M))
    • Fixed issue with conversion to Pandas table - should now handle dims better.
    • Improved multidim dropna() using Xarray version (previously used Pandas version).
    • Added xDim as dict mapping capability.
  • 05/12/19 - debug
  • 29/11/19 - initial version.

Examples

(See https://github.com/phockett/ePSproc/blob/master/epsproc/tests/ePSproc_demo_matE_plotting_Nov2019.ipynb)

epsproc.basicPlotters.molPlot(molInfo)[source]

Basic 3D scatter plot from molInfo data.

epsproc.basicPlotters.symListGen(data)[source]