epsproc.util.conversion module¶
ePSproc conversion functions
17/07/20 Added orb3DCoordConv(), for orbital file coord conversions. 12/03/20 Added multiDimXrToPD(), function adapted from lmPlot() code.
-
epsproc.util.conversion.
conv_BL_BLM
(data, to='sph', renorm=True)[source]¶ - Convert BL (Legendre Polynomial) <> BLM (Spherical Harmonic), plus parameter renomalisation.\[ \begin{align}\begin{aligned}eta^{Sph}_{L,0} = \sqrt{(2L+1)/4\pi}eta^{Lg}\\Note: other conventions may be used here, see https://shtools.github.io/SHTOOLS/complex-spherical-harmonics.html#supported-normalizations\\Parameters ---------- data : Xarray Values to convert. Currently assumes an Xarray, with dims .L and .M\\to : str, default = 'sph' - 'sph' to convert BL > BLM - 'lg' to convert BL0 > BL\\renorm : bool, optional, default = True If true, additionally renormalise paramters by L=0 term, such that B0 = 1.\\Notes ----- - Should add type to keep track of betas here. - Should generalise to other input structure & add error checking. - Implement SHTOOLS library....!\end{aligned}\end{align} \]
-
epsproc.util.conversion.
conv_ev_atm
(data, to='ev')[source]¶ Convert eV <> Hartree (atomic units)
Parameters: - data (int, float, np.array) – Values to convert.
- to (str, default = 'ev') –
- ‘ev’ to convert H > eV
- ’H’ to convert eV > H
Returns: Return type: data converted in converted units.
-
epsproc.util.conversion.
multiDimXrToPD
(da, colDims=None, rowDims=None, thres=None, squeeze=True, dropna=True, fillna=False, verbose=False)[source]¶ Convert multidim Xarray to stacked Pandas 2D array, (rowDims, colDims)
Parameters: - da (Xarray) – Array for conversion.
- colDims (list of dims for columns, default = None) –
- rowDims (list of dims for rows, default = None) –
- NOTE (if xDim is a MultiIndex, pass as a dictionary mapping, otherwise it may be unstacked during data prep.) –
- full control over dim stack ordering, specifiy both colDims and rowDims (For) –
- NOTE –
- for plotting stacked (L,M), set xDim = {'LM' (E.g.) –
- thres (float, optional, default = None) – Threshold values in output (pd table only) TODO: generalise this and use matEleSelector() for input?
- squeeze (bool, optional, default = True) – Drop singleton dimensions.
- dropna (bool, optional, default = True) – Drop all NaN dimensions from output pd data frame (columnwise and rowise).
- fillna (bool, optional, default = False) – Fill any NaN values with 0.0. Useful for plotting/making data contiguous.
Returns: - daRestackpd (pandas data frame (2D) with sorted data.)
- daRestack (Xarray with restacked data.)
Restack Xarray by specified dims, including basic dims checking, then use da.to_pandas().
12/03/20 Function adapted from lmPlot() code.
Note
This might casue
epsproc.lmPlot()
to fail for singleton x-dimensions if squeeze = True. TO do: add work-around, see lines 114-122.
-
epsproc.util.conversion.
orb3DCoordConv
(fileIn, coordMaxLen=50)[source]¶ Basic coord parse & conversion for volumetric wavefunction files from ePS.
Parameters: - fileIn (data from a single file) – List of values from a wavefunction file, as returned by
epsproc.readOrb3D()
. (Note this currently assumes a single file/set of values.) - coordMaxLen (int, optional, default=50) – Max coord grid size, assumed to demark native Cart (<coordMaxLen) from Spherical (>coordMaxLen) coords.
Returns: x,y,z
Return type: np.arrays of Cartesian coords (x,y,z)
- fileIn (data from a single file) – List of values from a wavefunction file, as returned by