epsproc.geomFunc.geomUtils module¶
ePSproc utility functions for geometric terms and tensors.
26/02/20 v1
Code from ePSproc_MFBLM_Numba_dev_tests_120220.py
-
epsproc.geomFunc.geomUtils.
genKQStermsFromTensors
(EPR, AKQS, uniqueFlag=True, phaseConvention='S')[source]¶ Generate all QNs for \(\Delta_{L,M}(K,Q,S)\) from existing tensors (Xarrays) \(E_{P,R}\) and \(A^K_{Q,S}\).
Cf.
epsproc.geomFunc.genllpMatE()
, code adapted from there.Parameters: - matE (Xarray) – Xarray containing matrix elements, with QNs (l,m), as created by
readMatEle()
- uniqueFlag (bool, default = True) – Check for duplicates and remove (can occur with some forms of matrix elements).
- mFlag (bool, optional, default = True) – m, mp take all passed values if mFlag=True, or =0 only if mFlag=False
- phaseConvention (optional, str, default = 'S') – Set phase conventions with
epsproc.geomCalc.setPhaseConventions()
. To use preset phase conventions, pass existing dictionary. If matE.attrs[‘phaseCons’] is already set, this will be used instead of passed args.
Returns: - QNs1, QNs2 (two 2D np.arrays) – Values take all allowed combinations [‘P’,’K’,’L’,’R’,’Q’,’M’] and [‘P’,’K’,’L’,’Rp’,’S’,’S-Rp’] from supplied matE. Note phase conventions not applied to QN lists as yet.
- To do
- —–
- - Implement output options (see dev. function w3jTable).
- matE (Xarray) – Xarray containing matrix elements, with QNs (l,m), as created by
-
epsproc.geomFunc.geomUtils.
genllL
(Lmin=0, Lmax=10, mFlag=True)[source]¶ Generate quantum numbers for angular momentum contractions (l, lp, L)
Parameters: - Lmax (Lmin,) – Integer values for Lmin and Lmax respectively.
- mFlag (bool, optional, default = True) – m, mp take all values -l…+l if mFlag=True, or =0 only if mFlag=False
Returns: QNs – Values take all allowed combinations [‘l’,’lp’,’L’,’m’,’mp’,’M’] up to l=lp=Lmax, one set per row.
Return type: 2D np.array
Examples
>>> # Calculate up to Lmax = 2 >>> QNs = genllL(Lmax=2) >>> # Use with w3jTable function to calculate Wigner 3j terms >>> w3j = w3jTable(QNs = QNs)
- Implement output options (see dev. function w3jTable).
-
epsproc.geomFunc.geomUtils.
genllLList
(Llist, uniqueFlag=True, mFlag=True)[source]¶ Generate quantum numbers for angular momentum contractions (l, lp, L) from a passed list, (m, mp, M)=0 or all allowed terms.
Parameters: - Llist (list) – Values [l, lp, L] to use for calculations.
- uniqueFlag (bool, optional, default = True) – Drop duplicate [l,lp,L] sets from list.
- mFlag (bool, optional, default = True) – m, mp take all values -l…+l if mFlag=True, or =0 only if mFlag=False
Returns: QNs – Values take all allowed combinations [‘l’,’lp’,’L’,’m’,’mp’,’M’] up to l=lp=Lmax, one set per row.
Return type: 2D np.array
Examples
>>> # Set from an array >>> QNs = genllLList(np.array([[1,1,2],[1,3,2],[1,1,2]]), mFlag = True) >>> # Use with w3jTable function to calculate Wigner 3j terms >>> w3j = w3jTable(QNs = QNs)
- Implement output options (see dev. function w3jTable).
-
epsproc.geomFunc.geomUtils.
genllpMatE
(matE, uniqueFlag=True, mFlag=True, phaseConvention='S')[source]¶ Generate quantum numbers for angular momentum contractions (l, lp, L, m, mp, M) from sets of matrix elements.
Parameters: - matE (Xarray) – Xarray containing matrix elements, with QNs (l,m), as created by
readMatEle()
- uniqueFlag (bool, default = True) – Check for duplicates and remove (can occur with some forms of matrix elements).
- mFlag (bool, optional, default = True) – m, mp take all passed values if mFlag=True, or =0 only if mFlag=False
- phaseConvention (optional, str, default = 'S') – Set phase conventions with
epsproc.geomCalc.setPhaseConventions()
. To use preset phase conventions, pass existing dictionary. If matE.attrs[‘phaseCons’] is already set, this will be used instead of passed args.
Returns: QNs – Values take all allowed combinations [‘l’,’lp’,’L’,’m’,’mp’,’M’] from supplied matE
Return type: 2D np.array
Examples
>>> # From demo matrix elements >>> dataFile = os.path.join(dataPath, 'n2_3sg_0.1-50.1eV_A2.inp.out') # Set for sample N2 data for testing >>> # Scan data file >>> dataSet = ep.readMatEle(fileIn = dataFile) >>> QNs = genllpMatE(dataSet[0]) >>> # Use with w3jTable function to calculate Wigner 3j terms >>> w3j = w3jTable(QNs = QNs)
- Implement output options (see dev. function w3jTable).
- matE (Xarray) – Xarray containing matrix elements, with QNs (l,m), as created by
-
epsproc.geomFunc.geomUtils.
selQNsRow
(QNs, QNmask, fields=None, verbose=1)[source]¶ Basic routine for selecting/filtering valid rows from an input array of QNs.
This is similar to methods used in Matlab version, but likely rather slow.
Parameters: - QNs (np.array) – Values to be filtered.
- QNmask (list or np.array) – Values to be matched. Must be same dims as QNs, unless fields is also set. If set to None field will be skipped (i.e. match all values)
- fields (list or np.array, optional, default = None) – Which fields to match in QNs.
- verbose (int, optional, default = 1) – Print info to terminal.
Returns: - QNs[boolMask] (np.array of selected values.)
- boolMask (np.array corresponding to selected values.)
Examples
>>> QNsMask, mask = selQNsRow(QNs,[None, None, None, 0, 0, 0], verbose = False) >>> # With fields >>> QNsMask, mask = selQNsRow(QNs,[0, 0, 0], fields = [3,4,5], verbose = False)