%config InlineBackend.figure_formats = ['svg']
import xarray as xr
import xyzpy as xyz
import numpy as np
def singuass(x, a, l, phi):
return np.sin(x / l - phi) * np.exp(-x**2 / a)
r = xyz.Runner(singuass, 'sg(x)')
combos = {
'x': np.linspace(-4, 4, 52),
'a': [1, 2, 3],
'l': [0.2, 0.3, 0.4, 0.5, 0.6, 0.7],
'phi': [0, 1],
}
r.run_combos(combos)
100%|##########| 1872/1872 [00:00<00:00, 224309.71it/s]
<xarray.Dataset> Dimensions: (a: 3, l: 6, phi: 2, x: 52) Coordinates: * x (x) float64 -4.0 -3.843 -3.686 -3.529 ... 3.529 3.686 3.843 4.0 * a (a) int64 1 2 3 * l (l) float64 0.2 0.3 0.4 0.5 0.6 0.7 * phi (phi) int64 0 1 Data variables: sg(x) (x, a, l, phi) float64 -1.027e-07 -9.415e-08 ... -0.004828
xarray.Dataset
- a: 3
- l: 6
- phi: 2
- x: 52
- x(x)float64-4.0 -3.843 -3.686 ... 3.843 4.0
array([-4. , -3.843137, -3.686275, -3.529412, -3.372549, -3.215686, -3.058824, -2.901961, -2.745098, -2.588235, -2.431373, -2.27451 , -2.117647, -1.960784, -1.803922, -1.647059, -1.490196, -1.333333, -1.176471, -1.019608, -0.862745, -0.705882, -0.54902 , -0.392157, -0.235294, -0.078431, 0.078431, 0.235294, 0.392157, 0.54902 , 0.705882, 0.862745, 1.019608, 1.176471, 1.333333, 1.490196, 1.647059, 1.803922, 1.960784, 2.117647, 2.27451 , 2.431373, 2.588235, 2.745098, 2.901961, 3.058824, 3.215686, 3.372549, 3.529412, 3.686275, 3.843137, 4. ])
- a(a)int641 2 3
array([1, 2, 3])
- l(l)float640.2 0.3 0.4 0.5 0.6 0.7
array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7])
- phi(phi)int640 1
array([0, 1])
- sg(x)(x, a, l, phi)float64-1.027e-07 -9.415e-08 ... -0.004828
array([[[[-1.02738453e-07, -9.41531885e-08], [-7.80939572e-08, -1.10376862e-07], [ 6.12215108e-08, 1.12534073e-07], [-1.11337603e-07, -4.63778257e-08], [-4.21051741e-08, -1.10566685e-07], [ 6.06232938e-08, -4.70251615e-08]], [[-3.06259013e-04, -2.80666699e-04], [-2.32794805e-04, -3.29028788e-04], [ 1.82498751e-04, 3.35459343e-04], [-3.31892717e-04, -1.38250350e-04], [-1.25513755e-04, -3.29594644e-04], [ 1.80715492e-04, -1.40180031e-04]], [[-4.40765402e-03, -4.03933158e-03], [-3.35036331e-03, -4.73535471e-03], [ 2.62650672e-03, 4.82790271e-03], [-4.77657214e-03, -1.98968744e-03], [-1.80638343e-03, -4.74349846e-03], [ 2.60084219e-03, -2.01745924e-03]]], ... [[[ 1.02738453e-07, 1.68664580e-08], [ 7.80939572e-08, -2.59881717e-08], [-6.12215108e-08, 4.63778257e-08], [ 1.11337603e-07, 7.39341017e-08], [ 4.21051741e-08, -6.50676402e-08], [-6.06232938e-08, -1.12534972e-07]], [[ 3.06259013e-04, 5.02782026e-05], [ 2.32794805e-04, -7.74696480e-05], [-1.82498751e-04, 1.38250350e-04], [ 3.31892717e-04, 2.20394451e-04], [ 1.25513755e-04, -1.93963902e-04], [-1.80715492e-04, -3.35462024e-04]], [[ 4.40765402e-03, 7.23599673e-04], [ 3.35036331e-03, -1.11493667e-03], [-2.62650672e-03, 1.98968744e-03], [ 4.77657214e-03, 3.17189845e-03], [ 1.80638343e-03, -2.79151220e-03], [-2.60084219e-03, -4.82794131e-03]]]])
r.last_ds.xyz.lineplot(x='x', y='sg(x)', z='l', col='a', row='phi',
colors=True, figsize=(6, 4))
r.last_ds.xyz.ilineplot(x='x', y='sg(x)', z='l', col='a', row='phi',
colors=True, figsize=(6, 4))
r.last_ds.xyz.heatmap(x='x', y='l', z='sg(x)', col='a', row='phi',
colors=True, colormap='balance', figsize=(6, 4))
r.last_ds.xyz.iheatmap(x='x', y='l', z='sg(x)', col='a', row='phi',
colors=True, colormap='balance', figsize=(6, 4))
# note we have dropped the 'row' specification but can still plot all the data
r.last_ds.xyz.scatter(x='sg(x)', y='x', z='l', col='a',
colors=True, colormap='viridis', figsize=(6, 4))
r.last_ds.xyz.iscatter(x='sg(x)', y='x', z='l', col='a',
colors=True, colormap='viridis', figsize=(6, 4))
# note we have dropped the col specification
r.last_ds.xyz.histogram(x='sg(x)', z='l', row='phi',
bins=100, ylog=True, stacked=True,
colors=True, colormap='magma_r', figsize=(6, 4))