hvPlotters function tests

27/01/22

Updated with curvePlot() and BLMplot() routine demos.

15/07/20

Testing basic plotting with Holoviews, now implemented in hvPlotters.py module.

NOTE: currently implemented for ePS cross-section data only.

Setup

[1]:
# Standard libs
import sys
import os
from pathlib import Path
import numpy as np
import xarray as xr

from datetime import datetime as dt
timeString = dt.now()

# For reporting
import scooby
# scooby.Report(additional=['holoviews', 'hvplot', 'xarray', 'matplotlib', 'bokeh'])
# TODO: set up function for this, see https://github.com/banesullivan/scooby
[2]:
# Installed package version
# import epsproc as ep

# ePSproc test codebase (local)
# if sys.platform == "win32":
#     modPath = r'D:\code\github\ePSproc'  # Win test machine
# else:
#     modPath = r'/home/femtolab/github/ePSproc/'  # Linux test machine

# sys.path.append(modPath)
import epsproc as ep
* sparse not found, sparse matrix forms not available.
* natsort not found, some sorting functions not available.
* Setting plotter defaults with epsproc.basicPlotters.setPlotters(). Run directly to modify, or change options in local env.
* Set Holoviews with bokeh.
* pyevtk not found, VTK export not available.

Load test data

[5]:
# To control display of warnings... may have issues depending on XR version.
# WORKING IN SOME CASES... but not all, maybe ipython/env version issues?
# https://stackoverflow.com/a/9031848
import warnings
warnings.filterwarnings('ignore')  # set 'once' or 'ignore'
warnings.simplefilter('ignore')
[6]:
# Load data from modPath\data
modPath = Path(ep.__path__[0]).parent
dataPath = os.path.join(modPath, 'data', 'photoionization')
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)
dataXS = ep.readMatEle(fileIn = dataFile, recordType = 'CrossSection')  # XS info currently not set in NO2 sample file.
*** ePSproc readMatEle(): scanning files for DumpIdy segments.

*** Scanning file(s)
['/mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization/n2_3sg_0.1-50.1eV_A2.inp.out']

*** FileListSort
  Prefix: /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization/n2_3sg_0.1-50.1eV_A2.inp.out
  1 groups.

*** Reading ePS output file:  /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization/n2_3sg_0.1-50.1eV_A2.inp.out
Found 2 segments.
Expecting 51 energy points.
Found 3 segments.
Expecting 2 symmetries.
Found 103 segments.
Found 102 dumpIdy segments (sets of matrix elements).

Processing segments to Xarrays...
Processed 102 sets of DumpIdy file segments, (0 blank)
*** ePSproc readMatEle(): scanning files for CrossSection segments.

*** Scanning file(s)
['/mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization/n2_3sg_0.1-50.1eV_A2.inp.out']

*** FileListSort
  Prefix: /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization/n2_3sg_0.1-50.1eV_A2.inp.out
  1 groups.

*** Reading ePS output file:  /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization/n2_3sg_0.1-50.1eV_A2.inp.out
Found 2 segments.
Expecting 51 energy points.
Found 3 segments.
Expecting 2 symmetries.
Found 4 segments.
Found 3 CrossSection segments (sets of results).
Processed 3 sets of CrossSection file segments, (0 blank)

hv XCplot demo

This is now working for XC data only, to give interactive plots with Holoviews + Bokeh, and all calculation gauges.

Basic use

Load functions, set defaults and plot.

[7]:
# Import plotting code
from epsproc.plot import hvPlotters

# Set options
hvPlotters.setPlotters()

# Basic use to produce two plot layout
layout, *_ = hvPlotters.XCplot(dataXS[0])

layout
* Set Holoviews with bokeh.
[7]:

This is a bit messy, but otherwise pretty functional, just need to improve a bit by, e.g., line styles by Type or Cont, to simplify plotting & legend.

Note mouse-over values, and linked axes when zooming. The legend is also interactive, and can be used to highlight different data series.

Additional options

Set plot width, grab other return items (different data formats).

[8]:
# Set options, with different plot size (default width=500)
hvPlotters.setPlotters(width=700)
layout, *_ = hvPlotters.XCplot(dataXS[0])
layout
* Set Holoviews with bokeh.
[8]:
[9]:
# Optional return items - tabulated dataset, hv dataset and Xarray dataset object types
layout, table, hv_ds, ds = hvPlotters.XCplot(dataXS[0])

table
[9]:
[10]:
hv_ds
[10]:
:Dataset   [Type,Eke,Cont]   (sigma,beta)
[11]:
ds
[11]:
Show/Hide data repr Show/Hide attributes
xarray.Dataset
    • Eke: 51
    • Sym: 3
    • Type: 3
    • Ehv
      (Eke)
      float64
      15.68 16.68 17.68 ... 64.68 65.68
      units :
      eV
      array([15.68, 16.68, 17.68, 18.68, 19.68, 20.68, 21.68, 22.68, 23.68,
             24.68, 25.68, 26.68, 27.68, 28.68, 29.68, 30.68, 31.68, 32.68,
             33.68, 34.68, 35.68, 36.68, 37.68, 38.68, 39.68, 40.68, 41.68,
             42.68, 43.68, 44.68, 45.68, 46.68, 47.68, 48.68, 49.68, 50.68,
             51.68, 52.68, 53.68, 54.68, 55.68, 56.68, 57.68, 58.68, 59.68,
             60.68, 61.68, 62.68, 63.68, 64.68, 65.68])
    • Type
      (Type)
      object
      'L' 'M' 'V'
      array(['L', 'M', 'V'], dtype=object)
    • Sym
      (Sym)
      MultiIndex
      (Total, Cont)
      array([('SU', 'SU'), ('PU', 'PU'), ('All', 'All')], dtype=object)
    • Total
      (Sym)
      object
      'SU' 'PU' 'All'
      array(['SU', 'PU', 'All'], dtype=object)
    • Cont
      (Sym)
      object
      'SU' 'PU' 'All'
      array(['SU', 'PU', 'All'], dtype=object)
    • Eke
      (Eke)
      float64
      0.1 1.1 2.1 3.1 ... 48.1 49.1 50.1
      array([ 0.1,  1.1,  2.1,  3.1,  4.1,  5.1,  6.1,  7.1,  8.1,  9.1, 10.1, 11.1,
             12.1, 13.1, 14.1, 15.1, 16.1, 17.1, 18.1, 19.1, 20.1, 21.1, 22.1, 23.1,
             24.1, 25.1, 26.1, 27.1, 28.1, 29.1, 30.1, 31.1, 32.1, 33.1, 34.1, 35.1,
             36.1, 37.1, 38.1, 39.1, 40.1, 41.1, 42.1, 43.1, 44.1, 45.1, 46.1, 47.1,
             48.1, 49.1, 50.1])
    • sigma
      (Sym, Eke, Type)
      float64
      2.719 2.954 3.209 ... 0.9229 0.8423
      dataType :
      XSect
      units :
      Mb
      file :
      n2_3sg_0.1-50.1eV_A2.inp.out
      fileBase :
      /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization
      fileList :
      n2_3sg_0.1-50.1eV_A2.inp.out
      array([[[2.7193, 2.9539, 3.209 ],
              [2.8151, 3.0229, 3.2464],
              [2.9628, 3.1452, 3.3388],
              [3.1519, 3.3087, 3.4734],
              [3.3779, 3.5088, 3.6449],
              [3.6388, 3.7439, 3.8521],
              [3.9332, 4.0131, 4.0947],
              [4.2582, 4.3144, 4.3716],
              [4.6072, 4.6426, 4.6786],
              [4.9678, 4.9865, 5.0058],
              [5.3175, 5.3251, 5.3332],
              [5.6207, 5.6238, 5.6274],
              [5.8265, 5.8324, 5.8388],
              [5.8749, 5.8905, 5.9067],
              [5.7136, 5.7439, 5.775 ],
              [5.3238, 5.3706, 5.4185],
              [4.7392, 4.8006, 4.8633],
              [4.0392, 4.1103, 4.1831],
              [3.3171, 3.392 , 3.4689],
              [2.6476, 2.721 , 2.7966],
              [2.0719, 2.1401, 2.2106],
              [1.6018, 1.6626, 1.7258],
              [1.2307, 1.2833, 1.3383],
              [0.9437, 0.9883, 1.0351],
              [0.7246, 0.7617, 0.8008],
              [0.5585, 0.589 , 0.6212],
              [0.4331, 0.4578, 0.484 ],
              [0.3386, 0.3584, 0.3795],
              [0.2675, 0.2832, 0.3   ],
              [0.2142, 0.2265, 0.2396],
              [0.1745, 0.1838, 0.1939],
              [0.145 , 0.1519, 0.1595],
              [0.1234, 0.1282, 0.1337],
              [0.1078, 0.1109, 0.1146],
              [0.0968, 0.0985, 0.1006],
              [0.0894, 0.0898, 0.0906],
              [0.0848, 0.084 , 0.0836],
              [0.0823, 0.0804, 0.079 ],
              [0.0815, 0.0786, 0.0762],
              [0.0819, 0.078 , 0.0747],
              [0.0832, 0.0785, 0.0743],
              [0.0852, 0.0796, 0.0747],
              [0.0878, 0.0813, 0.0756],
              [0.0907, 0.0834, 0.077 ],
              [0.0938, 0.0857, 0.0786],
              [0.097 , 0.0882, 0.0803],
              [0.1003, 0.0907, 0.0822],
              [0.1036, 0.0933, 0.0841],
              [0.1068, 0.0957, 0.086 ],
              [0.1099, 0.0982, 0.0878],
              [0.1128, 0.1005, 0.0896]],
      
             [[2.6162, 2.8237, 3.0523],
              [2.553 , 2.7137, 2.8896],
              [2.5309, 2.6527, 2.7856],
              [2.5369, 2.6244, 2.72  ],
              [2.5639, 2.6194, 2.6812],
              [2.6067, 2.6315, 2.6618],
              [2.6609, 2.6561, 2.6566],
              [2.722 , 2.6888, 2.6616],
              [2.7858, 2.7261, 2.6732],
              [2.8484, 2.7644, 2.6884],
              [2.9063, 2.8009, 2.7046],
              [2.9569, 2.833 , 2.7195],
              [2.9981, 2.8591, 2.7313],
              [3.0286, 2.8776, 2.7384],
              [3.0477, 2.8876, 2.7399],
              [3.0551, 2.8887, 2.7349],
              [3.0511, 2.8806, 2.7229],
              [3.036 , 2.8634, 2.7035],
              [3.0106, 2.8374, 2.6767],
              [2.9758, 2.8031, 2.6426],
              [2.9323, 2.7609, 2.6016],
              [2.8812, 2.7117, 2.554 ],
              [2.8234, 2.6561, 2.5004],
              [2.7599, 2.5949, 2.4413],
              [2.6915, 2.529 , 2.3776],
              [2.6192, 2.459 , 2.3098],
              [2.5437, 2.3857, 2.2388],
              [2.4657, 2.31  , 2.1653],
              [2.386 , 2.2325, 2.09  ],
              [2.3051, 2.1538, 2.0135],
              [2.2237, 2.0745, 1.9364],
              [2.1421, 1.9952, 1.8595],
              [2.0609, 1.9163, 1.783 ],
              [1.9804, 1.8383, 1.7075],
              [1.901 , 1.7615, 1.6334],
              [1.8228, 1.6862, 1.561 ],
              [1.7463, 1.6127, 1.4905],
              [1.6715, 1.5411, 1.4221],
              [1.5987, 1.4717, 1.356 ],
              [1.5279, 1.4045, 1.2923],
              [1.4593, 1.3397, 1.231 ],
              [1.3929, 1.2772, 1.1723],
              [1.3288, 1.2172, 1.1161],
              [1.267 , 1.1596, 1.0624],
              [1.2076, 1.1044, 1.0112],
              [1.1506, 1.0517, 0.9624],
              [1.0959, 1.0013, 0.916 ],
              [1.0435, 0.9533, 0.8719],
              [0.9933, 0.9075, 0.8301],
              [0.9454, 0.8639, 0.7904],
              [0.8997, 0.8224, 0.7527]],
      
             [[5.3355, 5.7775, 6.2613],
              [5.3681, 5.7366, 6.136 ],
              [5.4937, 5.7979, 6.1244],
              [5.6888, 5.9332, 6.1934],
              [5.9418, 6.1282, 6.3261],
              [6.2455, 6.3754, 6.5138],
              [6.5941, 6.6691, 6.7512],
              [6.9802, 7.0032, 7.0332],
              [7.393 , 7.3687, 7.3519],
              [7.8161, 7.751 , 7.6942],
              [8.2238, 8.126 , 8.0378],
              [8.5776, 8.4568, 8.3469],
              [8.8246, 8.6915, 8.5701],
              [8.9035, 8.7681, 8.6452],
              [8.7613, 8.6315, 8.515 ],
              [8.3789, 8.2593, 8.1534],
              [7.7903, 7.6812, 7.5862],
              [7.0752, 6.9737, 6.8865],
              [6.3278, 6.2294, 6.1456],
              [5.6234, 5.524 , 5.4392],
              [5.0042, 4.901 , 4.8122],
              [4.4831, 4.3743, 4.2798],
              [4.0541, 3.9394, 3.8387],
              [3.7036, 3.5832, 3.4764],
              [3.4161, 3.2907, 3.1784],
              [3.1777, 3.048 , 2.931 ],
              [2.9767, 2.8435, 2.7228],
              [2.8043, 2.6684, 2.5448],
              [2.6535, 2.5157, 2.3899],
              [2.5194, 2.3803, 2.2531],
              [2.3981, 2.2583, 2.1304],
              [2.2871, 2.1471, 2.019 ],
              [2.1843, 2.0446, 1.9167],
              [2.0882, 1.9492, 1.8221],
              [1.9978, 1.86  , 1.734 ],
              [1.9123, 1.776 , 1.6516],
              [1.8311, 1.6967, 1.5741],
              [1.7539, 1.6216, 1.5011],
              [1.6801, 1.5503, 1.4321],
              [1.6098, 1.4825, 1.367 ],
              [1.5425, 1.4181, 1.3054],
              [1.4781, 1.3568, 1.247 ],
              [1.4166, 1.2985, 1.1917],
              [1.3577, 1.243 , 1.1394],
              [1.3014, 1.1902, 1.0898],
              [1.2476, 1.1399, 1.0428],
              [1.1962, 1.092 , 0.9982],
              [1.1471, 1.0465, 0.9561],
              [1.1001, 1.0032, 0.9161],
              [1.0553, 0.962 , 0.8782],
              [1.0126, 0.9229, 0.8423]]])
    • beta
      (Sym, Eke, Type)
      float64
      0.7019 0.7036 ... 1.028 1.042
      dataType :
      XSect
      units :
      Mb
      file :
      n2_3sg_0.1-50.1eV_A2.inp.out
      fileBase :
      /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization
      fileList :
      n2_3sg_0.1-50.1eV_A2.inp.out
      array([[[0.7019, 0.7036, 0.7053],
              [0.2617, 0.2661, 0.2704],
              [0.0986, 0.1011, 0.1037],
              [0.0426, 0.0438, 0.0449],
              [0.0477, 0.0482, 0.0488],
              [0.0899, 0.0902, 0.0905],
              [0.1546, 0.1549, 0.1552],
              [0.2327, 0.233 , 0.2334],
              [0.3179, 0.3185, 0.3191],
              [0.406 , 0.407 , 0.4081],
              [0.4942, 0.4958, 0.4975],
              [0.5804, 0.583 , 0.5856],
              [0.6637, 0.6673, 0.6709],
              [0.7432, 0.7478, 0.7525],
              [0.8186, 0.8242, 0.8298],
              [0.8896, 0.8961, 0.9024],
              [0.9562, 0.9631, 0.97  ],
              [1.018 , 1.0252, 1.0322],
              [1.075 , 1.0819, 1.0888],
              [1.1268, 1.1331, 1.1392],
              [1.1729, 1.1781, 1.1832],
              [1.2126, 1.2163, 1.2198],
              [1.2448, 1.2467, 1.2485],
              [1.2682, 1.2681, 1.268 ],
              [1.281 , 1.279 , 1.2769],
              [1.2812, 1.2775, 1.2738],
              [1.2661, 1.2614, 1.2566],
              [1.2332, 1.2284, 1.2233],
              [1.1799, 1.1763, 1.1722],
              [1.1044, 1.1036, 1.1018],
              [1.0069, 1.0101, 1.012 ],
              [0.8899, 0.898 , 0.9046],
              [0.7597, 0.7725, 0.7838],
              [0.6254, 0.6417, 0.6567],
              [0.4984, 0.5158, 0.5325],
              [0.3893, 0.405 , 0.4209],
              [0.306 , 0.3176, 0.3301],
              [0.2519, 0.2579, 0.2654],
              [0.2261, 0.2263, 0.228 ],
              [0.2248, 0.2198, 0.2161],
              [0.2428, 0.2337, 0.2255],
              [0.2747, 0.2627, 0.2512],
              [0.3157, 0.302 , 0.2884],
              [0.3621, 0.3477, 0.3329],
              [0.4109, 0.3964, 0.3814],
              [0.4601, 0.4461, 0.4313],
              [0.5085, 0.4952, 0.481 ],
              [0.555 , 0.5427, 0.5294],
              [0.5992, 0.588 , 0.5756],
              [0.6409, 0.6307, 0.6194],
              [0.6798, 0.6707, 0.6604]],
      
             [[1.2439, 1.2565, 1.2683],
              [1.5711, 1.5715, 1.5698],
              [1.6932, 1.6952, 1.6947],
              [1.7285, 1.7352, 1.7392],
              [1.7105, 1.7226, 1.7319],
              [1.6589, 1.6761, 1.6907],
              [1.5866, 1.6084, 1.6276],
              [1.503 , 1.5284, 1.5515],
              [1.4144, 1.4424, 1.4685],
              [1.3255, 1.355 , 1.3829],
              [1.2391, 1.269 , 1.2978],
              [1.1569, 1.1865, 1.2154],
              [1.08  , 1.1086, 1.1367],
              [1.0087, 1.0358, 1.0627],
              [0.9431, 0.9684, 0.9938],
              [0.883 , 0.9063, 0.93  ],
              [0.8281, 0.8495, 0.8713],
              [0.7781, 0.7976, 0.8175],
              [0.7327, 0.7504, 0.7685],
              [0.6916, 0.7075, 0.724 ],
              [0.6543, 0.6687, 0.6836],
              [0.6206, 0.6336, 0.6472],
              [0.5903, 0.6021, 0.6145],
              [0.563 , 0.5738, 0.5852],
              [0.5387, 0.5485, 0.559 ],
              [0.5169, 0.5261, 0.5358],
              [0.4977, 0.5062, 0.5153],
              [0.4807, 0.4887, 0.4973],
              [0.4658, 0.4734, 0.4817],
              [0.453 , 0.4603, 0.4682],
              [0.442 , 0.449 , 0.4568],
              [0.4327, 0.4396, 0.4472],
              [0.4251, 0.4318, 0.4394],
              [0.4189, 0.4257, 0.4332],
              [0.4142, 0.4209, 0.4286],
              [0.4108, 0.4176, 0.4253],
              [0.4086, 0.4156, 0.4235],
              [0.4076, 0.4147, 0.4228],
              [0.4077, 0.415 , 0.4234],
              [0.4089, 0.4164, 0.425 ],
              [0.411 , 0.4187, 0.4277],
              [0.414 , 0.4221, 0.4314],
              [0.418 , 0.4263, 0.4359],
              [0.4227, 0.4314, 0.4414],
              [0.4283, 0.4373, 0.4477],
              [0.4347, 0.444 , 0.4547],
              [0.4417, 0.4514, 0.4625],
              [0.4495, 0.4595, 0.471 ],
              [0.458 , 0.4683, 0.4801],
              [0.4671, 0.4777, 0.4898],
              [0.4768, 0.4877, 0.5002]],
      
             [[1.6814, 1.6939, 1.7058],
              [1.4403, 1.4581, 1.4754],
              [1.3098, 1.3285, 1.3466],
              [1.2206, 1.2397, 1.2582],
              [1.1568, 1.1761, 1.1949],
              [1.1102, 1.1296, 1.1484],
              [1.0759, 1.0949, 1.1135],
              [1.0499, 1.0683, 1.0862],
              [1.0294, 1.0468, 1.0639],
              [1.0116, 1.0282, 1.0443],
              [0.9945, 1.0102, 1.0256],
              [0.9761, 0.9914, 1.0063],
              [0.9551, 0.9703, 0.9852],
              [0.9306, 0.9462, 0.9615],
              [0.9024, 0.9189, 0.935 ],
              [0.8709, 0.8887, 0.9061],
              [0.8377, 0.8569, 0.8759],
              [0.8047, 0.8254, 0.8459],
              [0.7745, 0.7964, 0.8182],
              [0.7493, 0.7719, 0.7947],
              [0.7307, 0.7536, 0.7767],
              [0.7194, 0.7421, 0.7652],
              [0.7151, 0.7374, 0.76  ],
              [0.717 , 0.7386, 0.7605],
              [0.7237, 0.7446, 0.7658],
              [0.7341, 0.7543, 0.7747],
              [0.7468, 0.7665, 0.7863],
              [0.761 , 0.7803, 0.7996],
              [0.776 , 0.7949, 0.8138],
              [0.7912, 0.8099, 0.8285],
              [0.8063, 0.8248, 0.8431],
              [0.8212, 0.8395, 0.8576],
              [0.8355, 0.8537, 0.8716],
              [0.8493, 0.8673, 0.8851],
              [0.8626, 0.8804, 0.8981],
              [0.8753, 0.8929, 0.9104],
              [0.8874, 0.9048, 0.9222],
              [0.899 , 0.9162, 0.9334],
              [0.9101, 0.927 , 0.944 ],
              [0.9206, 0.9374, 0.9542],
              [0.9308, 0.9473, 0.9639],
              [0.9405, 0.9568, 0.9731],
              [0.9499, 0.9658, 0.982 ],
              [0.9588, 0.9746, 0.9905],
              [0.9675, 0.983 , 0.9987],
              [0.9759, 0.9911, 1.0065],
              [0.984 , 0.9989, 1.0142],
              [0.9918, 1.0065, 1.0215],
              [0.9994, 1.0139, 1.0286],
              [1.0068, 1.0211, 1.0356],
              [1.014 , 1.028 , 1.0423]]])
[12]:
# Cf. original data, as Xarray dataarray
dataXS[0]
[12]:
Show/Hide data repr Show/Hide attributes
xarray.DataArray
'n2_3sg_0.1-50.1eV_A2.inp.out'
  • Sym: 3
  • Eke: 51
  • XC: 2
  • Type: 3
  • 0.7019 0.7036 0.7053 2.719 2.954 ... 1.028 1.042 1.013 0.9229 0.8423
    array([[[[0.7019, 0.7036, 0.7053],
             [2.7193, 2.9539, 3.209 ]],
    
            [[0.2617, 0.2661, 0.2704],
             [2.8151, 3.0229, 3.2464]],
    
            [[0.0986, 0.1011, 0.1037],
             [2.9628, 3.1452, 3.3388]],
    
            [[0.0426, 0.0438, 0.0449],
             [3.1519, 3.3087, 3.4734]],
    
            [[0.0477, 0.0482, 0.0488],
             [3.3779, 3.5088, 3.6449]],
    
            [[0.0899, 0.0902, 0.0905],
             [3.6388, 3.7439, 3.8521]],
    
            [[0.1546, 0.1549, 0.1552],
             [3.9332, 4.0131, 4.0947]],
    
            [[0.2327, 0.233 , 0.2334],
             [4.2582, 4.3144, 4.3716]],
    
            [[0.3179, 0.3185, 0.3191],
             [4.6072, 4.6426, 4.6786]],
    
            [[0.406 , 0.407 , 0.4081],
             [4.9678, 4.9865, 5.0058]],
    
            [[0.4942, 0.4958, 0.4975],
             [5.3175, 5.3251, 5.3332]],
    
            [[0.5804, 0.583 , 0.5856],
             [5.6207, 5.6238, 5.6274]],
    
            [[0.6637, 0.6673, 0.6709],
             [5.8265, 5.8324, 5.8388]],
    
            [[0.7432, 0.7478, 0.7525],
             [5.8749, 5.8905, 5.9067]],
    
            [[0.8186, 0.8242, 0.8298],
             [5.7136, 5.7439, 5.775 ]],
    
            [[0.8896, 0.8961, 0.9024],
             [5.3238, 5.3706, 5.4185]],
    
            [[0.9562, 0.9631, 0.97  ],
             [4.7392, 4.8006, 4.8633]],
    
            [[1.018 , 1.0252, 1.0322],
             [4.0392, 4.1103, 4.1831]],
    
            [[1.075 , 1.0819, 1.0888],
             [3.3171, 3.392 , 3.4689]],
    
            [[1.1268, 1.1331, 1.1392],
             [2.6476, 2.721 , 2.7966]],
    
            [[1.1729, 1.1781, 1.1832],
             [2.0719, 2.1401, 2.2106]],
    
            [[1.2126, 1.2163, 1.2198],
             [1.6018, 1.6626, 1.7258]],
    
            [[1.2448, 1.2467, 1.2485],
             [1.2307, 1.2833, 1.3383]],
    
            [[1.2682, 1.2681, 1.268 ],
             [0.9437, 0.9883, 1.0351]],
    
            [[1.281 , 1.279 , 1.2769],
             [0.7246, 0.7617, 0.8008]],
    
            [[1.2812, 1.2775, 1.2738],
             [0.5585, 0.589 , 0.6212]],
    
            [[1.2661, 1.2614, 1.2566],
             [0.4331, 0.4578, 0.484 ]],
    
            [[1.2332, 1.2284, 1.2233],
             [0.3386, 0.3584, 0.3795]],
    
            [[1.1799, 1.1763, 1.1722],
             [0.2675, 0.2832, 0.3   ]],
    
            [[1.1044, 1.1036, 1.1018],
             [0.2142, 0.2265, 0.2396]],
    
            [[1.0069, 1.0101, 1.012 ],
             [0.1745, 0.1838, 0.1939]],
    
            [[0.8899, 0.898 , 0.9046],
             [0.145 , 0.1519, 0.1595]],
    
            [[0.7597, 0.7725, 0.7838],
             [0.1234, 0.1282, 0.1337]],
    
            [[0.6254, 0.6417, 0.6567],
             [0.1078, 0.1109, 0.1146]],
    
            [[0.4984, 0.5158, 0.5325],
             [0.0968, 0.0985, 0.1006]],
    
            [[0.3893, 0.405 , 0.4209],
             [0.0894, 0.0898, 0.0906]],
    
            [[0.306 , 0.3176, 0.3301],
             [0.0848, 0.084 , 0.0836]],
    
            [[0.2519, 0.2579, 0.2654],
             [0.0823, 0.0804, 0.079 ]],
    
            [[0.2261, 0.2263, 0.228 ],
             [0.0815, 0.0786, 0.0762]],
    
            [[0.2248, 0.2198, 0.2161],
             [0.0819, 0.078 , 0.0747]],
    
            [[0.2428, 0.2337, 0.2255],
             [0.0832, 0.0785, 0.0743]],
    
            [[0.2747, 0.2627, 0.2512],
             [0.0852, 0.0796, 0.0747]],
    
            [[0.3157, 0.302 , 0.2884],
             [0.0878, 0.0813, 0.0756]],
    
            [[0.3621, 0.3477, 0.3329],
             [0.0907, 0.0834, 0.077 ]],
    
            [[0.4109, 0.3964, 0.3814],
             [0.0938, 0.0857, 0.0786]],
    
            [[0.4601, 0.4461, 0.4313],
             [0.097 , 0.0882, 0.0803]],
    
            [[0.5085, 0.4952, 0.481 ],
             [0.1003, 0.0907, 0.0822]],
    
            [[0.555 , 0.5427, 0.5294],
             [0.1036, 0.0933, 0.0841]],
    
            [[0.5992, 0.588 , 0.5756],
             [0.1068, 0.0957, 0.086 ]],
    
            [[0.6409, 0.6307, 0.6194],
             [0.1099, 0.0982, 0.0878]],
    
            [[0.6798, 0.6707, 0.6604],
             [0.1128, 0.1005, 0.0896]]],
    
    
           [[[1.2439, 1.2565, 1.2683],
             [2.6162, 2.8237, 3.0523]],
    
            [[1.5711, 1.5715, 1.5698],
             [2.553 , 2.7137, 2.8896]],
    
            [[1.6932, 1.6952, 1.6947],
             [2.5309, 2.6527, 2.7856]],
    
            [[1.7285, 1.7352, 1.7392],
             [2.5369, 2.6244, 2.72  ]],
    
            [[1.7105, 1.7226, 1.7319],
             [2.5639, 2.6194, 2.6812]],
    
            [[1.6589, 1.6761, 1.6907],
             [2.6067, 2.6315, 2.6618]],
    
            [[1.5866, 1.6084, 1.6276],
             [2.6609, 2.6561, 2.6566]],
    
            [[1.503 , 1.5284, 1.5515],
             [2.722 , 2.6888, 2.6616]],
    
            [[1.4144, 1.4424, 1.4685],
             [2.7858, 2.7261, 2.6732]],
    
            [[1.3255, 1.355 , 1.3829],
             [2.8484, 2.7644, 2.6884]],
    
            [[1.2391, 1.269 , 1.2978],
             [2.9063, 2.8009, 2.7046]],
    
            [[1.1569, 1.1865, 1.2154],
             [2.9569, 2.833 , 2.7195]],
    
            [[1.08  , 1.1086, 1.1367],
             [2.9981, 2.8591, 2.7313]],
    
            [[1.0087, 1.0358, 1.0627],
             [3.0286, 2.8776, 2.7384]],
    
            [[0.9431, 0.9684, 0.9938],
             [3.0477, 2.8876, 2.7399]],
    
            [[0.883 , 0.9063, 0.93  ],
             [3.0551, 2.8887, 2.7349]],
    
            [[0.8281, 0.8495, 0.8713],
             [3.0511, 2.8806, 2.7229]],
    
            [[0.7781, 0.7976, 0.8175],
             [3.036 , 2.8634, 2.7035]],
    
            [[0.7327, 0.7504, 0.7685],
             [3.0106, 2.8374, 2.6767]],
    
            [[0.6916, 0.7075, 0.724 ],
             [2.9758, 2.8031, 2.6426]],
    
            [[0.6543, 0.6687, 0.6836],
             [2.9323, 2.7609, 2.6016]],
    
            [[0.6206, 0.6336, 0.6472],
             [2.8812, 2.7117, 2.554 ]],
    
            [[0.5903, 0.6021, 0.6145],
             [2.8234, 2.6561, 2.5004]],
    
            [[0.563 , 0.5738, 0.5852],
             [2.7599, 2.5949, 2.4413]],
    
            [[0.5387, 0.5485, 0.559 ],
             [2.6915, 2.529 , 2.3776]],
    
            [[0.5169, 0.5261, 0.5358],
             [2.6192, 2.459 , 2.3098]],
    
            [[0.4977, 0.5062, 0.5153],
             [2.5437, 2.3857, 2.2388]],
    
            [[0.4807, 0.4887, 0.4973],
             [2.4657, 2.31  , 2.1653]],
    
            [[0.4658, 0.4734, 0.4817],
             [2.386 , 2.2325, 2.09  ]],
    
            [[0.453 , 0.4603, 0.4682],
             [2.3051, 2.1538, 2.0135]],
    
            [[0.442 , 0.449 , 0.4568],
             [2.2237, 2.0745, 1.9364]],
    
            [[0.4327, 0.4396, 0.4472],
             [2.1421, 1.9952, 1.8595]],
    
            [[0.4251, 0.4318, 0.4394],
             [2.0609, 1.9163, 1.783 ]],
    
            [[0.4189, 0.4257, 0.4332],
             [1.9804, 1.8383, 1.7075]],
    
            [[0.4142, 0.4209, 0.4286],
             [1.901 , 1.7615, 1.6334]],
    
            [[0.4108, 0.4176, 0.4253],
             [1.8228, 1.6862, 1.561 ]],
    
            [[0.4086, 0.4156, 0.4235],
             [1.7463, 1.6127, 1.4905]],
    
            [[0.4076, 0.4147, 0.4228],
             [1.6715, 1.5411, 1.4221]],
    
            [[0.4077, 0.415 , 0.4234],
             [1.5987, 1.4717, 1.356 ]],
    
            [[0.4089, 0.4164, 0.425 ],
             [1.5279, 1.4045, 1.2923]],
    
            [[0.411 , 0.4187, 0.4277],
             [1.4593, 1.3397, 1.231 ]],
    
            [[0.414 , 0.4221, 0.4314],
             [1.3929, 1.2772, 1.1723]],
    
            [[0.418 , 0.4263, 0.4359],
             [1.3288, 1.2172, 1.1161]],
    
            [[0.4227, 0.4314, 0.4414],
             [1.267 , 1.1596, 1.0624]],
    
            [[0.4283, 0.4373, 0.4477],
             [1.2076, 1.1044, 1.0112]],
    
            [[0.4347, 0.444 , 0.4547],
             [1.1506, 1.0517, 0.9624]],
    
            [[0.4417, 0.4514, 0.4625],
             [1.0959, 1.0013, 0.916 ]],
    
            [[0.4495, 0.4595, 0.471 ],
             [1.0435, 0.9533, 0.8719]],
    
            [[0.458 , 0.4683, 0.4801],
             [0.9933, 0.9075, 0.8301]],
    
            [[0.4671, 0.4777, 0.4898],
             [0.9454, 0.8639, 0.7904]],
    
            [[0.4768, 0.4877, 0.5002],
             [0.8997, 0.8224, 0.7527]]],
    
    
           [[[1.6814, 1.6939, 1.7058],
             [5.3355, 5.7775, 6.2613]],
    
            [[1.4403, 1.4581, 1.4754],
             [5.3681, 5.7366, 6.136 ]],
    
            [[1.3098, 1.3285, 1.3466],
             [5.4937, 5.7979, 6.1244]],
    
            [[1.2206, 1.2397, 1.2582],
             [5.6888, 5.9332, 6.1934]],
    
            [[1.1568, 1.1761, 1.1949],
             [5.9418, 6.1282, 6.3261]],
    
            [[1.1102, 1.1296, 1.1484],
             [6.2455, 6.3754, 6.5138]],
    
            [[1.0759, 1.0949, 1.1135],
             [6.5941, 6.6691, 6.7512]],
    
            [[1.0499, 1.0683, 1.0862],
             [6.9802, 7.0032, 7.0332]],
    
            [[1.0294, 1.0468, 1.0639],
             [7.393 , 7.3687, 7.3519]],
    
            [[1.0116, 1.0282, 1.0443],
             [7.8161, 7.751 , 7.6942]],
    
            [[0.9945, 1.0102, 1.0256],
             [8.2238, 8.126 , 8.0378]],
    
            [[0.9761, 0.9914, 1.0063],
             [8.5776, 8.4568, 8.3469]],
    
            [[0.9551, 0.9703, 0.9852],
             [8.8246, 8.6915, 8.5701]],
    
            [[0.9306, 0.9462, 0.9615],
             [8.9035, 8.7681, 8.6452]],
    
            [[0.9024, 0.9189, 0.935 ],
             [8.7613, 8.6315, 8.515 ]],
    
            [[0.8709, 0.8887, 0.9061],
             [8.3789, 8.2593, 8.1534]],
    
            [[0.8377, 0.8569, 0.8759],
             [7.7903, 7.6812, 7.5862]],
    
            [[0.8047, 0.8254, 0.8459],
             [7.0752, 6.9737, 6.8865]],
    
            [[0.7745, 0.7964, 0.8182],
             [6.3278, 6.2294, 6.1456]],
    
            [[0.7493, 0.7719, 0.7947],
             [5.6234, 5.524 , 5.4392]],
    
            [[0.7307, 0.7536, 0.7767],
             [5.0042, 4.901 , 4.8122]],
    
            [[0.7194, 0.7421, 0.7652],
             [4.4831, 4.3743, 4.2798]],
    
            [[0.7151, 0.7374, 0.76  ],
             [4.0541, 3.9394, 3.8387]],
    
            [[0.717 , 0.7386, 0.7605],
             [3.7036, 3.5832, 3.4764]],
    
            [[0.7237, 0.7446, 0.7658],
             [3.4161, 3.2907, 3.1784]],
    
            [[0.7341, 0.7543, 0.7747],
             [3.1777, 3.048 , 2.931 ]],
    
            [[0.7468, 0.7665, 0.7863],
             [2.9767, 2.8435, 2.7228]],
    
            [[0.761 , 0.7803, 0.7996],
             [2.8043, 2.6684, 2.5448]],
    
            [[0.776 , 0.7949, 0.8138],
             [2.6535, 2.5157, 2.3899]],
    
            [[0.7912, 0.8099, 0.8285],
             [2.5194, 2.3803, 2.2531]],
    
            [[0.8063, 0.8248, 0.8431],
             [2.3981, 2.2583, 2.1304]],
    
            [[0.8212, 0.8395, 0.8576],
             [2.2871, 2.1471, 2.019 ]],
    
            [[0.8355, 0.8537, 0.8716],
             [2.1843, 2.0446, 1.9167]],
    
            [[0.8493, 0.8673, 0.8851],
             [2.0882, 1.9492, 1.8221]],
    
            [[0.8626, 0.8804, 0.8981],
             [1.9978, 1.86  , 1.734 ]],
    
            [[0.8753, 0.8929, 0.9104],
             [1.9123, 1.776 , 1.6516]],
    
            [[0.8874, 0.9048, 0.9222],
             [1.8311, 1.6967, 1.5741]],
    
            [[0.899 , 0.9162, 0.9334],
             [1.7539, 1.6216, 1.5011]],
    
            [[0.9101, 0.927 , 0.944 ],
             [1.6801, 1.5503, 1.4321]],
    
            [[0.9206, 0.9374, 0.9542],
             [1.6098, 1.4825, 1.367 ]],
    
            [[0.9308, 0.9473, 0.9639],
             [1.5425, 1.4181, 1.3054]],
    
            [[0.9405, 0.9568, 0.9731],
             [1.4781, 1.3568, 1.247 ]],
    
            [[0.9499, 0.9658, 0.982 ],
             [1.4166, 1.2985, 1.1917]],
    
            [[0.9588, 0.9746, 0.9905],
             [1.3577, 1.243 , 1.1394]],
    
            [[0.9675, 0.983 , 0.9987],
             [1.3014, 1.1902, 1.0898]],
    
            [[0.9759, 0.9911, 1.0065],
             [1.2476, 1.1399, 1.0428]],
    
            [[0.984 , 0.9989, 1.0142],
             [1.1962, 1.092 , 0.9982]],
    
            [[0.9918, 1.0065, 1.0215],
             [1.1471, 1.0465, 0.9561]],
    
            [[0.9994, 1.0139, 1.0286],
             [1.1001, 1.0032, 0.9161]],
    
            [[1.0068, 1.0211, 1.0356],
             [1.0553, 0.962 , 0.8782]],
    
            [[1.014 , 1.028 , 1.0423],
             [1.0126, 0.9229, 0.8423]]]])
    • Ehv
      (Eke)
      float64
      15.68 16.68 17.68 ... 64.68 65.68
      units :
      eV
      array([15.68, 16.68, 17.68, 18.68, 19.68, 20.68, 21.68, 22.68, 23.68, 24.68,
             25.68, 26.68, 27.68, 28.68, 29.68, 30.68, 31.68, 32.68, 33.68, 34.68,
             35.68, 36.68, 37.68, 38.68, 39.68, 40.68, 41.68, 42.68, 43.68, 44.68,
             45.68, 46.68, 47.68, 48.68, 49.68, 50.68, 51.68, 52.68, 53.68, 54.68,
             55.68, 56.68, 57.68, 58.68, 59.68, 60.68, 61.68, 62.68, 63.68, 64.68,
             65.68])
    • Type
      (Type)
      object
      'L' 'M' 'V'
      array(['L', 'M', 'V'], dtype=object)
    • XC
      (XC)
      object
      'BETA' 'SIGMA'
      array(['BETA', 'SIGMA'], dtype=object)
    • Sym
      (Sym)
      MultiIndex
      (Total, Cont)
      array([('SU', 'SU'), ('PU', 'PU'), ('All', 'All')], dtype=object)
    • Total
      (Sym)
      object
      'SU' 'PU' 'All'
      array(['SU', 'PU', 'All'], dtype=object)
    • Cont
      (Sym)
      object
      'SU' 'PU' 'All'
      array(['SU', 'PU', 'All'], dtype=object)
    • Eke
      (Eke)
      float64
      0.1 1.1 2.1 3.1 ... 48.1 49.1 50.1
      array([ 0.1,  1.1,  2.1,  3.1,  4.1,  5.1,  6.1,  7.1,  8.1,  9.1, 10.1, 11.1,
             12.1, 13.1, 14.1, 15.1, 16.1, 17.1, 18.1, 19.1, 20.1, 21.1, 22.1, 23.1,
             24.1, 25.1, 26.1, 27.1, 28.1, 29.1, 30.1, 31.1, 32.1, 33.1, 34.1, 35.1,
             36.1, 37.1, 38.1, 39.1, 40.1, 41.1, 42.1, 43.1, 44.1, 45.1, 46.1, 47.1,
             48.1, 49.1, 50.1])
  • dataType :
    XSect
    units :
    Mb
    file :
    n2_3sg_0.1-50.1eV_A2.inp.out
    fileBase :
    /mnt/femtobackSSHFS/DriveSyncShare/code-share/github-share/ePSproc/data/photoionization
    fileList :
    n2_3sg_0.1-50.1eV_A2.inp.out

BLMplot() with HV backend

27/01/22 - initial versions now working. See issue #27 for ongoing development notes.

This wraps some data handling & HV plotting for \(\beta_{LM}\) parameters, with some sensible defaults set.

[13]:
# Compute BLMs with tensor code...
daIn = dataSet[0].copy()
BLMX = ep.mfblmXprod(daIn, selDims = {'Type':'L'}, thres = 1e-4)   # Run for all Eke
Return type BLM.
[14]:
# Default hv plot
ep.BLMplot(BLMX, backend = 'hv')

The default plot will stack \((l,m)\) values, and push any other dimensions to a Holoviews widget (selection menus and/or sliders). Note that in the current routine the Xarray unstack > restack leads to indices shared over all \(l\), hence some extra terms like (l=0,m!=0) values appear in legend.

For additional control, the routine can be set to return the Holomap object, and further HV functionality used directly. For example…

[16]:
# Set Holomap & return, don't render
hvPlot = ep.BLMplot(BLMX, backend = 'hv', returnPlot=True, renderPlot=False)

# Plot with (l,m) overlay & layout by pol state, single column
hvPlot.overlay(['l','m']).layout('Labels').cols(1)
[16]:
[17]:
# Plot with overlay by pol state, widget for other dims
hvPlot.overlay('Labels')
[17]:
[26]:
# Set Holomap & return, don't render
# Set XS = True to get the absolute (unnormlised) cross-section values for B_00
hvPlot = ep.BLMplot(BLMX, backend = 'hv', XS= True, returnPlot=True, renderPlot=False)

# Plot (l,m)=(0,0) only, with overlay by pol state.
hvPlot.select(l=0,m=0).overlay('Labels')
[26]:

Some other flags and options are also available…

[18]:
help(ep.BLMplot)
Help on function BLMplot in module epsproc.basicPlotters:

BLMplot(BLM, thres=0.01, thresType='abs', selDims=None, XS=False, xDim='Eke', pType='r', col='Labels', row=None, pStyle='line', backend='xr', returnPlot=False, renderPlot=True, **kwargs)
    Plotting routines for BLM values from Xarray.
    Plot line or surface plot, with various backends available.

    Parameters
    ----------
    BLM : Xarray
        Input data for plotting, dims assumed to be as per :py:func:`ePSproc.util.BLMdimList()`

    thres : float, optional, default 1e-2
        Value used for thresholding results, only values > thres will be included in the plot.
        Either abs or relative (%) value, according to thresType setting.
        Set thres = None to skip.

    thresType : str, optional, default = 'abs'
        Set to 'abs' or 'pc' for absolute threshold, or relative value (%age of max value in dataset)

    selDims : dict, optional, default = None
        Dimensions to select from input Xarray.

    XS : bool, optional, default = False
        Use absolute XS value for l=0 if true (from BLM.XS); otherwise show current values (usually normalised to =1).

    xDim : str, optional, default = 'Eke'
        Dimension to use for x-axis, also used for thresholding. Default plots (Eke, BLM) surfaces with subplots for (Euler).
        Change to 'Euler' to plot (Euler, BLM) with (Eke) subplots.

    col, row : strings, optional, default = 'Labels', None
        Set for dim handling in plot.
        For xr backend these define plot layout.

    pType : char, optional, default 'a' (abs values)
        Set (data) type to plot. See :py:func:`plotTypeSelector`.

    pStyle : string, optional, default = 'line'
        NOT YET PROPERLY IMPLEMENTED
        For XR backend can also set 'surf'.

    backend : str, optional, default = 'xr'
        Plotter to use. Currently supports 'xr' = Xarray, 'hv' = Holoviews
        Default is 'xr' for Xarray internal plotting. May be switched according to plot type in future...
        **kwargs are currently passed to the plotter backend.

    returnXR : bool, optional, default = False
        Return plot data to caller if true.

    returnPlot : bool, optional, default = False
        For hv backend, return object to caller?

    renderPlot : bool, optional, default = True
        For hv backend, render plot (if running in a notebook)?

    Notes
    -----

    - Proper dim handling to be implemented. See code elsewhere(?).
        XR plotter currently uses 'cDims' in some places too.

    27/01/22: Updated with better selection & basic XR dim handling, but still needs work.
              Added basic HV plotter routines.

curvePlot() for general Holoviews plotting

This transforms an input Xarray to a Holoviews object, and maps to curves.

Note:

  • this is a pretty low-level routine, with no additional data handling or tidy up.
  • this may be quite slow if there are a lot of data dimensions to handle.

For example, to plot some of the matrix elements directly…

[34]:
# Set plot data from raw matrix elements
daPlot = ep.matEleSelector(dataSet[0], thres=1e-2, dims = 'Eke', sq = True).sum('mu').squeeze()
daPlot = ep.plotTypeSelector(daPlot, pType = 'r')

# Plot with widgets to handle dims - note this may require .unstack() for multindex objects
hvPlotters.curvePlot(daPlot.unstack(), kdims='Eke');
[36]:
# As for BLMplot(), for more control the Holomap object can be returned and manipulated...
hvPlotters.curvePlot(daPlot.unstack(), kdims='Eke', renderPlot = False).overlay(['l','m','Total']).layout('Cont').cols(1)
[36]:

General Holoviews methods

For Xarray data there are basically two quick routes to using Holoviews:

  • Convert to a Holoviews dataset, then plot as desired, see the Holoviews docs, especially the notes for gridded datasets.
  • Use hvPlot for quick in-line usage, this wraps Holoviews functionality for Xarray. (In testing Jan 2022 (with holoviews v1.14.2, hvplot v0.7.3 and xarray v0.15.0) this was also much faster than stacking to a Holomap for large dimensional cases.)

If installed, both modules are imported to the hvPlotters namespace at import; alternatively import directly with, e.g. import holoviews as hv and import hvplot.xarray.

A couple of examples are given here for reference.

Holoviews dataset & holomaps

[43]:
# Basic HV dataset creation & plot
hvds = hvPlotters.hv.Dataset(daPlot.unstack())
hvds.to(hvPlotters.hv.Curve, kdims='Eke')
[43]:
[46]:
# Basic data subselection & image plots
hvds = hvPlotters.hv.Dataset(daPlot.sel({'Type':'L'}).unstack(['LM','Sym']).sum(['Targ','Total']).real) # OK - reduce Sym dims.
hvds.to(hvPlotters.hv.Image, kdims=['Eke','l'])
WARNING:param.RasterPlot945949: Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
[46]:

hvPlot pipeline

[56]:
# Pipeline from Xarray to hvplot...
# Note unstack() may be required here, e.g. daPlot.hvplot.line(x='Eke')  with hvplot v0.7 give NotImplementedError: isna is not defined for MultiIndex
daPlot.unstack().hvplot.line(x='Eke')  # OK
[56]:
[59]:
# As previously, various overlays, stacks etc. can be defined here
daPlot.unstack().squeeze().hvplot.line(x='Eke').overlay(['l','m']).layout('Type').cols(1)
[59]:

Speed tests

In testing Jan 2022 (with holoviews v1.14.2, hvplot v0.7.3 and xarray v0.15.0) the hvplot() method was also much faster than stacking to a Holomap for large dimensional cases.

[61]:
%%timeit
# Speed tests...
daPlot.unstack().squeeze().hvplot.line(x='Eke').overlay(['l','m']).layout('Type').cols(1)

# 19.8 ms ± 70 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
19.8 ms ± 70 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
[63]:
%%timeit

# Basic HV dataset creation & plot
hvds = hvPlotters.hv.Dataset(daPlot.unstack().squeeze())
hvds.to(hvPlotters.hv.Curve, kdims='Eke').overlay(['l','m']).layout('Type').cols(1)

# 183 ms ± 965 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
201 ms ± 2.83 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

Versions

[28]:
import scooby
scooby.Report(additional=['epsproc', 'holoviews', 'hvplot', 'xarray', 'matplotlib', 'bokeh'])
[28]:
Thu Jan 27 12:03:42 2022 EST
OS Linux CPU(s) 64 Machine x86_64
Architecture 64bit Environment Jupyter
Python 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 16:07:37) [GCC 9.3.0]
epsproc 1.3.1-dev holoviews 1.14.2 hvplot 0.7.3
xarray 0.15.0 matplotlib 3.3.4 bokeh 2.3.0
numpy 1.20.1 scipy 1.6.1 IPython 7.21.0
scooby 0.5.6
[29]:
# Check current Git commit for local ePSproc version
from pathlib import Path
!git -C {Path(ep.__file__).parent} branch
!git -C {Path(ep.__file__).parent} log --format="%H" -n 1
* dev
  master
6bcc112d694ee17b05559678a9bb92e9f33df873
[30]:
# Check current remote commits
!git ls-remote --heads git://github.com/phockett/ePSproc
4f6dc05cc8e58b80336cdcc61cbed9646686cb62        refs/heads/dependabot/pip/notes/envs/envs-versioned/ipython-7.31.1
7e691b6296da0488fbfb1a47d6ad074044e5d956        refs/heads/dependabot/pip/notes/envs/envs-versioned/pillow-9.0.0
8fb518c63bfb4edc49ef994808f1c18fb68ff0c3        refs/heads/dependabot/pip/notes/envs/envs-versioned/pip-21.1
6bcc112d694ee17b05559678a9bb92e9f33df873        refs/heads/dev
5278f0389878f6e7e5eb9b0c013ff3594c70938f        refs/heads/master
69cd89ce5bc0ad6d465a4bd8df6fba15d3fd1aee        refs/heads/numba-tests
ea30878c842f09d525fbf39fa269fa2302a13b57        refs/heads/revert-9-master
[ ]: