epsproc.geomFunc.afblmGeom module
- epsproc.geomFunc.afblmGeom.AFwfExp(matE, AKQS=None, thres=0.01, thresDims='Eke', selDims={'Type': 'L', 'it': 1})[source]
Implement (approximate) LF/AF wavefunction expansion,
\[\begin{split}\begin{equation} ^{AF}T_{\mu_{0}}^{p_{i}\mu_{i},p_{f}\mu_{f}}(\hat{k}_{L})=8\pi^{2}\sum_{K,Q,S}\sum_{l,m,\mu,\Lambda}A_{Q,S}^{K}I_{l,m,\mu}^{p_{i}\mu_{i},p_{f}\mu_{f}}(E)(-1)^{m-\Lambda}(-1)^{\mu-\mu_{0}}(-1)^{Q-S}\left(\begin{array}{ccc} l & 1 & K\\ -m & -\mu & -Q \end{array}\right)\left(\begin{array}{ccc} l & 1 & K\\ -\Lambda & -\mu_{0} & -S \end{array}\right)Y_{l\Lambda}^{*}(\hat{k}_{M}) \end{equation}\end{split}\]Where each component is defined by fns. in :py:module:`epsproc.geomFunc.geomCalc` module.
01/02/21 version 1, this is pretty rough and ready, and possibly not correct.
See http://localhost:8888/lab/tree/SLAC/angular_streaking/AF_wavefns_method_dev_050121.ipynb for dev notes.
- epsproc.geomFunc.afblmGeom.afblmXprod(matEin, QNs=None, AKQS=None, EPRX=None, EPRXresort=None, p=None, ep=None, BLMtable=None, BLMtableResort=None, lambdaTerm=None, polProd=None, AFterm=None, EfieldPol=None, EfieldBasis='rot', EfieldRotSel='z', thres=0.01, thresDims='Eke', selDims={'Type': 'L'}, sqThres=True, dropThres=True, sumDims=['mu', 'mup', 'l', 'lp', 'm', 'mp', 'S-Rp'], sumDimsPol=['P', 'R', 'Rp', 'p', 'R-p'], symSum=True, outputDims={'LM': ['L', 'M']}, degenDrop=True, SFflag=False, SFflagRenorm=False, BLMRenorm=1, squeeze=False, phaseConvention='E', basisReturn='BLM', verbose=0, **kwargs)[source]
Implement \(\beta_{LM}^{AF}\) calculation as product of tensors.
\[\begin{eqnarray} \beta_{L,-M}^{\mu_{i},\mu_{f}} & =(-1)^{M} & \sum_{P,R',R}{[P]^{\frac{1}{2}}}{E_{P-R}(\hat{e};\mu_{0})}\sum_{l,m,\mu}\sum_{l',m',\mu'}(-1)^{(\mu'-\mu_{0})}{\Lambda_{R'}(\mu,P,R')B_{L,-M}(l,l',m,m')}I_{l,m,\mu}^{p_{i}\mu_{i},p_{f}\mu_{f}}(E)I_{l',m',\mu'}^{p_{i}\mu_{i},p_{f}\mu_{f}*}(E)\sum_{K,Q,S}\Delta_{L,M}(K,Q,S)A_{Q,S}^{K}(t) \end{eqnarray}\]Where each component is defined by fns. in :py:module:`epsproc.geomFunc.geomCalc` module.
- 23/03/24 Updating for arb pol case (p!=0), changes as per working mfblmGeom.py 05/03/24
Allow passing of ep.
Allow direct passing for EPRXresort (skips default).
Updated defaults for p, ep.
Default case still p=0, now set via ep=[0,1,0] selection.
Other defaults based on inputs, see p, ep help below.
Added ‘R-p’ to sumDimsPol defaults.
Added ‘polProd’ tp full basis return dict.
- 30/06/23 Debugging for 3D aligment case. Currently issues with handling of M and S-Rp dims here?
- Tested:
Removed sum over S-Rp (MF/AF)
Set sum over M (LF)
Various phase conventions.
- 3D alignment case (for OCS HOMO-1 test values) OK after fixing phaseCons[‘afblmCons’][‘negM’] = True (now corrected in source function).
Gives correct basis functions, but only L,M=even terms in test case (with Q!=0 and S!=0 terms in ADMs).
May still be phase issues for odd cases - TBC with further testing but probably not.
Added outDims to allow for changes in output dim mapping (TODO: should use sph dim checks here too?)
Added matEmult to output dataset for ‘Full’ basis return case.
Fixed issue with inplace multiplication for Xarray coords (’*=’), not valid for XR 2022.3 (coordinates immutable).
24/11/22 Added sqThres = True, dropThres = True for use with INITIAL matEleSelector() call only - in some cases may get issues with dim drops here otherwise.
04/05/22 Added **kwargs, unused but allows for arb basis dict unpack and passing from other functions. May want to pipe back to Full basis return however.
- 06/08/21 Added basic handling for degenerate states, including degenDrop option.
Updated docs, but still rather messy!
- 27/07/21 Removed eulerAngs & RX input options, since these are redundant (and lead to confusion here!).
For cases where E-field and alignment distribution are rotated, set AKQS in rotated frame, see https://epsproc.readthedocs.io/en/latest/tests/ePSproc_frame_rotation_tests_Dec2019.html Also removed selDims={‘it’:1}, which can result in issues! In current code, adding ‘it’ to sumDims doesn’t work (dim issues somewhere), so may be best to treat independently…?
03/05/21 Tidying up a bit & improving/wrapping for fitting use (inc. basis function reuse).
10/09/20 Verified (but messy) version, with updated defaults.
01/09/20 Verified (but messy) version, including correct renormalisation routines.
15/06/20 In progress! Using mfblmXprod() as template, with just modified lambda term, and new alignment term, to change.
For basic use see the docs: https://epsproc.readthedocs.io/en/dev/demos/ePSproc_class_demo_161020.html#Compute-LF/AF-beta_{LM}-and-PADs
Dev code:
afblmGeom_v1-ref_2020.py - Messy working v1 for reference, archived 04/05/21. Now working on tidier version.
geometric_method_dev_pt3_AFBLM_090620.ipynb
http://localhost:8888/lab/tree/dev/ePSproc/geometric_method_dev_Betas_090320.ipynb
D:codeePSprocpython_devePSproc_MFBLM_Numba_dev_tests_120220.PY
- Parameters:
matE (Xarray) – Xarray containing matrix elements, with QNs (l,m), as created by
readMatEle()settings (*** Optional calculation) –
selDims (dict, default = {'Type':'L'}) – Selection parameters for calculations, may be be checked and appened herein.
sumDims (list, default = ['mu', 'mup', 'l','lp','m','mp','S-Rp']) – Main summation dims, will be checked herein.
sumDimsPol (list, default = ['P','R','Rp','p']) – Additional polarization summation dims.
symSum (bool, default = True) – Sum over symmetries sets (=={Cont, Targ, Total}) if true.
degenDrop (bool) – Flag to set dropping of degenerate components.
thres (float, default = 1e-2) – Set threshold value, used to set input matrix elements and again for outputs.
thresDims (str, default = 'Eke') – Set threshold dimension (set to be contiguous).
verbose (bool or int) – Print output?
*** Optional renormalisation settings (mainly for testing only)
- SFflagbool, default = False
Multiply input matrix elements by complex scale-factor if true.
- SFflagRenormbool, default = False
Renorm output BLMs by complex scale-factor if true.
- BLMRenormint, default = 1
Set different BLM renorm conventions. If 1 renorm by B00. See code for further details.
- sqThresbool, default = True
Used for initial matrix element threholding call only. Default = True as previous code, but can cause issues in custom cases (usually accidentally dropping singleton mu coord). Added 24/11/22
- dropThresbool, default = True
Used for initial matrix element threholding call only. Default = True as previous code, but can cause issues in custom cases (usually accidentally dropping singleton mu coord). Added 24/11/22
- squeezebool, default = False
Squeeze output array after thresholding? Note: this may cause dim issues if True.
*** Optional input data/basis functions (mainly for fitting routine use)
- QNsnp.array, optional, default = None
List of QNs as generated by
genllpMatE(). Will be generated if not passed.- AKQSXarray, optional, default = None
Alignment parameters, as set by
setADMs(). Defaults to isotropic case if not passed.- EPRX, EPRXresortXarray, optional, default = None
E-field parameters, as generated by
EPR(). Defaults to normalised/unity field, pol = p (below).- plist or array, optional, default = None
Specify polarization terms p. Possibly currently only valid for p=0, TBC See https://epsproc.readthedocs.io/en/latest/methods/geometric_method_dev_260220_090420_tidy.html#E_{P,R}-tensor UPDATE 23/03/24: now supports all p terms via ep values, default p=[-1,0,1]
- eplist or array, optional, default = None
Set E-field components. If p and ep are None, will default to ep=[0,1,0] for p=0 term only. If p is set, but ep=None, will default to ep=np.ones(len(p)).
- BLMtable, BLMtableResortXarrays, optional, default = None
Beta calculation parameters, as defined by
geomCalc.betaTerm(). BLMtableResort includes phase settings & param renaming as herein.- lambdaTermXarray, optional, default = None
Lambda term parameters, as defined by
geomCalc.MFproj()- AFtermXarray, optional, default = None
Alignment term as defined by
geomCalc.deltaLMKQS()- polProdXarray, optional, default = None
Polarization tensor as defined by EPRXresort * lambdaTermResort * AFterm
- EfieldPolobject, default = None
Pass field settings as
epsproc.efield.epol.EfieldPolobject. Note this defaults to the ‘rot’ basis case, and z-pol geometry. Multiple polarization states are supported, but only a single pol geometry currently. Set EfieldBasis and EfieldRotSel arguments to override. See docs at https://epsproc.readthedocs.io/en/3d-afpad-dev/demos/Epol_class_demo_docs_030324-tidy.html- EfieldBasisstr, optional, default = ‘rot’
Only used for EfieldPol objects. Sets basis for E-field, see
epsproc.classes.epol.setep().- EfieldRotSelstr, optional, default = ‘z’
Only used for EfieldPol objects. Sets pol geom selection for E-field, see
epsproc.classes.epol.setep(). Note this is also used as a pol geom label in the output.- phaseConventionoptional, str, default = ‘E’
Set phase conventions with
epsproc.geomCalc.setPhaseConventions(). To use preset phase conventions, pass existing dictionary.- basisReturnoptional, str, default = “BLM”
‘BLM’ return Xarray of results only.
‘Full’ return Xarray of results + basis set dictionary as set during the run.
‘Product’, as full, but minimal basis set with products only.
‘Results’ or ‘Legacy’ direct return of various calc. results Xarrays.
**kwargs, unused but allows for arb basis dict unpack and passing from other functions.
- Returns:
Xarray – Set of AFBLM calculation results
dict – Dictionary of basis functions, only if basisReturn != ‘BLM’ (see basisReturn paramter notes).
Notes
Cross-section outputs now set as:
XSraw = direct AF calculation output.
XSrescaled = XSraw * sqrt(4pi)
XSiso = direct sum over matrix elements
Where XSrescaled == XSiso == ePS GetCro output for isotropic distribution. Optionally set SFflag = True to multiply by (complex) scale-factor.