09/06/21 PH
Quick look at initial ePS results for orb 11 (HOMO), 2.5eV step size.
TODO:
For methods: https://epsproc.readthedocs.io/en/dev/demos/ePSproc_class_demo_161020.html
!hostname
!conda env list
import sys
import os
from pathlib import Path
import numpy as np
# import epsproc as ep
import xarray as xr
import matplotlib.pyplot as plt
from datetime import datetime as dt
timeString = dt.now()
import epsproc as ep
# Plotters
from epsproc.plot import hvPlotters
# Multijob class dev code
from epsproc.classes.multiJob import ePSmultiJob
hvPlotters.setPlotters(width = 700, snsStyle='whitegrid')
# For class, above settings don't take, not sure why, something to do with namespaces/calling sequence?
# Overriding snsStyle does work however... although NOT CONSISTENTLY????
# AH, looks like ordering matters - set_style LAST (.set seems to override)
import seaborn as sns
sns.set(rc={'figure.figsize':(10,6)}) # Set figure size in inches
sns.set_context("paper")
sns.set_style("whitegrid") # Set plot style
sns.set_palette("Paired") # Set colour mapping
# Try direct fig type setting for PDF output figs
from IPython.display import set_matplotlib_formats
# set_matplotlib_formats('png', 'pdf')
set_matplotlib_formats('svg', 'pdf')
# xr.set_options(display_style='html')
# # Scan for subdirs, based on existing routine in getFiles()
fileBase = Path('/home/paul/ePS/OCS/OCS_survey') # Data dir on Stimpy
# TODO: fix orb label here, currently relies on (different) fixed format
data = ePSmultiJob(fileBase, verbose = 0)
data.scanFiles()
data.jobsSummary()
data.molSummary()
These are from ePolyScat's getCro
function, and are LF (unaligned ensemble) results. This provides a good, if general, overview.
# Comparitive plot over datasets (all symmetries only)
Etype = 'Eke' # Set for Eke or Ehv energy scale
pGauge = 'L'
# Erange=[0, 100] # Plot range (full range if not passed to function below)
# data.plotGetCroComp(pType='SIGMA', Etype = Etype, Erange = Erange, backend = 'hv')
data.plotGetCroComp(pType='SIGMA', pGauge = pGauge, Etype = Etype)
# Comparative plot over datasets (all symmetries only)
data.plotGetCroComp(pType='BETA', Etype=Etype)
# Betas vs. Gauge
data.plotGetCro(pType='BETA', Etype=Etype)
ep.lmPlot
data.lmPlotOpts = {'selDims':{'Type':'L', 'it':1}, 'cmap':'vlag', 'logFlag':False}
# data.lmPlot(cmap='vlag')
data.lmPlot()
# As above, but log10 cmapping
data.lmPlot(logFlag = True)
# Phase plot
data.lmPlotOpts = {'selDims':{'Type':'L', 'it':1}, 'cmap':'vlag', 'logFlag':False}
data.lmPlot(pType='phase')
data.MFBLM(selDims = {'Type':'L'})
# Note currently have issues with degenerate state: need to sum not select over these...
data.data['orb11']['MFBLMsum'] = data.data['orb11']['MFBLM'].sum('it') # Manual fix! Currently can't easily pass this through initial calc.
# Currently have ONE unphysical value for (l=0, E=0.1, z-pol) case, which blows up cmap...
# ACTUALLY, it's the renorm - defaults to showing unnormalised l=0!
data.lmPlotOpts = {'selDims':{}, 'cmap':'vlag', 'logFlag':False, 'SFflag':False} # , 'Erange':[1.1,30.1]
data.lmPlot(dataType = 'MFBLMsum')
# Use functional version instead to subselect...
# ep.lmPlot(data.data['orb11']['MFBLM'].sel(Eke=slice(1.1,30.1)), cmap='vlag');
# data.BLMplot(dataType='MFBLM', selDims={'it':1}, col=None, row='Labels', thres = 1e-2)
data.BLMplot(dataType='MFBLMsum', col=None, row='Labels', thres = 1e-2)
# A couple of example MFPADs...
# For z-polarization (cylindrically symmetric)
data.padPlot(keys = 'orb11', Erange = [5, 20, 4], dataType='MFBLM', selDims = {'Labels':'z'})
# For z-polarization (cylindrically symmetric), full map with sum over phi coord.
data.padPlot(keys = 'orb11', dataType='MFBLM', selDims = {'Labels':'z'}, pStyle='grid', reducePhi='sum') #, squeeze=True)
# A couple of example MFPADs...
# For x-polarization (identical to y-pol, except frame rotation)
data.padPlot(keys = 'orb11', Erange = [5, 20, 4], dataType='MFBLM', selDims = {'Labels':'x'})
Current status: almost working, but issue with abs magnitudes and y component inversion (phase) - most likely due to issue with combining degenerate symmetry components.
Relative values and trends should be correct however.
TODO: debug this!
# Defaults - should match LFBLMs above
# Looks like renorm issue here however, B2 values /2...?
data.AFBLM()
# data.lmPlotOpts['selDims'] = {} # Reset plot options
# data.lmPlotOpts['sumDims'] = {}
data.lmPlotOpts = {'selDims':{}, 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLM', SFflag = False) # With sumDims B2 looks better... but B0 x2!
# Defaults - should match LFBLMs above
# Looks like renorm issue here however, B2 values /2...?
data.AFBLM(selDims={'Type':'L'})
# Note currently have issues with degenerate state: need to sum not select over these...
data.data['orb11']['AFBLMsum'] = data.data['orb11']['AFBLM'].sum('it') # Manual fix! Currently can't easily pass this through initial calc.
# data.lmPlotOpts['selDims'] = {} # Reset plot options
# data.lmPlotOpts['sumDims'] = {}
data.lmPlotOpts = {'selDims':{}, 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLMsum', SFflag = False) # With sumDims B2 looks better... but B0 x2!
# Here (z,x) cases are (almost) OK, y is inverted as it=2 component missing.
data.BLMplot(dataType='AFBLMsum', thres = 1e-2)
# Defaults - should match LFBLMs above
# Looks like renorm issue here however, B2 values /2...?
# AH, might be default selector, selDims = {'Type':'L', 'it':1} - try overriding...
# data.AFBLM(selDims = {'Type':'L'}, sumDims = ['mu', 'mup', 'l','lp','m','mp','S-Rp', 'it']) # This fails at XR stack, not sure why
# Issue is at mTermSumThres['XSraw'] = mTermSumThres.sel({'L':0,'M':0}).drop('LM').copy()
# Throws "KeyError: 3" from Xarray, maybe summing over LM accidentally?
# Try summing just for plotting...
data.AFBLM(selDims = {'Type':'L'})
data.lmPlotOpts = {'selDims':{}, 'sumDims':'it', 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLM', SFflag = False, sumDims = ['it']) # With sumDims B2 looks better... but B0 x2!
# Checking 'it' components - same issue after renorm, so phase/summation/renorm issue somewhere...!
data.BLMplot(dataType='AFBLM', selDims = {'it':1}, thres = 1e-2)
data.BLMplot(dataType='AFBLM', selDims = {'it':2}, thres = 1e-2)
# Set ADMs for increasing alignment...
tPoints = 10
# inputADMs = np.asarray([[0,0,0, *np.ones(10)], [2,0,0, *np.linspace(0,1,tPoints)], [4,0,0, *np.linspace(0,0.5,tPoints)]])
inputADMs = [[0,0,0, *np.ones(10)], [2,0,0, *np.linspace(0,1,tPoints)], [4,0,0, *np.linspace(0,0.5,tPoints)]]
ADMs = ep.setADMs(ADMs = inputADMs)
ep.lmPlot(ADMs, xDim='t');
# Compute AFBLMs for aligned case
data.AFBLM(AKQS = ADMs, selDims = {'Type':'L'})
data.lmPlotOpts = {'selDims':{'Labels':'z'}, 'sumDims':'it', 'cmap':'vlag', 'logFlag':False}
data.lmPlot(dataType = 'AFBLM', SFflag = False, sumDims = ['it']) # With sumDims B2 looks better... but B0 x2!
# Slicing on l almost works, but messes up side labels (skips l)
# Plot looks OK, and labels should be same as above
data.lmPlotOpts = {'selDims':{'Labels':'z','l':slice(2,6)}, 'sumDims':'it', 'cmap':'vlag', 'logFlag':False, 'SFflag': False}
data.lmPlot(dataType = 'AFBLM') # With sumDims B2 looks better... but B0 x2!
Main conclusions (aside from needing to fix plotting routine...)
Cylindrically symmetric z-pol case only, vs. (Eke, Theta) per t (alignment).
# Reduced phi maps vs. alignment (t) - CURRENTLY NOT WORKING, looks like selection ordering logic is problematic here...?
# ACTUALLY does work if Eke included in facetDims, not sure why however!
# For z-polarization (cylindrically symmetric), full map with sum over phi coord.
# data.padPlot(keys = 'orb11', dataType='AFBLM', selDims = {'Labels':'z'}, pStyle='grid', reducePhi='sum', facetDims=['t'], squeeze=True)
data.padPlot(keys = 'orb11', dataType='AFBLM', selDims = {'Labels':'z'}, pStyle='grid', reducePhi='sum', facetDims=['t', 'Eke'])
For the trial alignment parameters, these show mainly a feature growing in at $\theta=\pi/2$, and centered at E~15eV, as the degree of alignment increases, and some subtler changes around the poles (i.e. features close to $\theta=0,\pi$).
# print(data.jobInfo['ePolyScat'][0])
# print('Run: ' + jobInfo['Starting'][0].split('at')[1])
import scooby
scooby.Report(additional=['epsproc', 'xarray', 'jupyter'])
# Check current Git commit for local ePSproc version
!git -C {Path(ep.__file__).parent} branch
!git -C {Path(ep.__file__).parent} log --format="%H" -n 1
# Check current remote commits
!git ls-remote --heads git://github.com/phockett/ePSproc