In [1]:
import sys
import os
import numpy as np
# For module testing, include path to module here
modPath = r'/home/femtolab/github/ePSproc/'
sys.path.append(modPath)
import epsproc as ep
In [2]:
# Confirm available dataTypes... (varies with ePSproc version)
ep.util.dataTypesList()
Out[2]:
In [3]:
# Load data from modPath\data
dataPath = os.path.join(modPath, 'data', 'photoionization')
# Scan data dir
dataSet = ep.readMatEle(fileBase = dataPath, recordType = 'CrossSection')
Data is read and sorted into Xarrays, currently one Xarray per input file and data/segment type. The full dimensionality is maintained here.
Calling the array will provide some output...
In [4]:
dataSet[1]
Out[4]:
... and sub-selection can provide sets of matrix elements as a function of energy, symmetry and type.
In [5]:
inds = {'Type':'L','Cont':'A2'}
dataSet[1].sel(inds).squeeze()
Out[5]:
The matEleSelector function does the same thing, and also includes thresholding on abs values:
In [6]:
# Set sq = True to squeeze on singleton dimensions
ep.matEleSelector(dataSet[1], thres=1e-2, inds = inds, sq = True)
Out[6]:
In [7]:
# Plot cross sections using Xarray functionality
daPlot = dataSet[0].sel({'Type':'L', 'XC':'SIGMA'}).squeeze()
daPlot.plot.line(x='Ehv');
In [8]:
daPlot = dataSet[0].sel({'Type':'L', 'XC':'BETA'}).squeeze()
daPlot.plot.line(x='Ehv');
In [9]:
# Plot with faceting on type
daPlot = dataSet[0].sel(XC='SIGMA')
daPlot.plot.line(x='Ehv', col='Type')
# Plot with faceting on type and data
daPlot = dataSet[0]
daPlot.pipe(np.abs).plot.line(x='Ehv', col='Type', row='XC')
Out[9]:
In [10]:
%load_ext version_information
In [11]:
%version_information epsproc, xarray
Out[11]: