<xarray.DataArray (subject: 5, batch: 3, chain: 4, draw: 10, team: 6)>\n",
- "-0.08418 0.007968 1.72 -0.4511 0.879 ... 0.03438 -0.3451 -0.3947 0.709 2.499\n",
+ "<xarray.DataArray (subject: 5, batch: 3, chain: 4, draw: 10, team: 6)> Size: 29kB\n",
+ "0.7083 0.4973 1.085 -0.3347 0.7276 3.925 ... 0.2989 -0.09777 0.3302 0.8232 1.546\n",
"Coordinates:\n",
- " * team (team) <U1 'a' 'b' 'c' 'd' 'e' 'f'\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- "Dimensions without coordinates: subject, batch
-0.08418 0.007968 1.72 -0.4511 0.879 ... -0.3451 -0.3947 0.709 2.499
array([[[[[-8.41810076e-02, 7.96826453e-03, 1.71975884e+00,\n",
- " -4.51078317e-01, 8.79015631e-01, 4.32702304e+00],\n",
- " [ 7.86824563e-02, 1.73782143e-01, 2.92603764e-01,\n",
- " 7.01513454e-01, 3.58734801e-01, 8.27531701e-01],\n",
- " [ 8.47694186e-01, 3.13808369e-01, 1.25985384e+00,\n",
- " 1.54106634e+00, 2.53933622e+00, 2.67594255e+00],\n",
+ " * team (team) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'\n",
+ " * chain (chain) int64 32B 0 1 2 3\n",
+ " * draw (draw) int64 80B 0 1 2 3 4 5 6 7 8 9\n",
+ "Dimensions without coordinates: subject, batch
0.7083 0.4973 1.085 -0.3347 0.7276 ... -0.09777 0.3302 0.8232 1.546
array([[[[[ 7.08283805e-01, 4.97324878e-01, 1.08460870e+00,\n",
+ " -3.34662170e-01, 7.27561482e-01, 3.92450380e+00],\n",
+ " [ 6.87942435e-02, 1.80692841e-01, 3.02125122e-01,\n",
+ " 6.96196485e-01, 3.36277828e-01, 8.29579402e-01],\n",
+ " [ 1.26293187e+00, 1.29239914e-01, 1.66720871e+00,\n",
+ " 1.38012985e+00, 2.67178556e+00, 3.00478565e+00],\n",
" ...,\n",
- " [ 6.59989907e-01, 1.86128469e+00, 2.99841310e+00,\n",
- " -3.56142003e-01, 1.91766843e+00, 8.58922838e-01],\n",
- " [-4.85161936e-01, -4.40940523e+00, -7.22018379e+00,\n",
- " 4.43481245e+00, 5.96810059e+00, 2.49590561e+00],\n",
- " [ 8.29676149e-01, -8.15642858e-02, 6.23028486e-01,\n",
- " 3.47926370e-01, 6.25121254e-01, 5.70526014e-01]],\n",
- "\n",
- " [[ 5.95944127e-01, 1.28052329e+00, 3.58236280e-02,\n",
- " 3.46540455e-01, 9.67083526e-01, 2.01567414e+00],\n",
- " [-4.94119891e-01, 2.79289058e+00, 2.49524539e-01,\n",
- " -3.82972118e-01, -8.76077483e-01, 1.23133191e-01],\n",
- " [ 1.55220665e+00, 1.36953357e+00, 4.47288642e+00,\n",
- " 4.50600101e-01, 1.22806154e-01, 1.55612721e+00],\n",
+ " [ 6.87953157e-01, 5.63557226e-01, 3.59296328e+00,\n",
+ " 1.14687083e+00, 1.15167647e+00, 7.25340463e-01],\n",
+ " [ 5.86342543e-01, 6.65248176e+00, -2.39430953e+00,\n",
+ " -2.80763422e+00, 5.53717978e+00, 2.77913866e-01],\n",
+ " [ 1.19077120e+00, 1.84722630e-01, 5.86547080e-01,\n",
+ " 6.26206059e-01, 7.44133701e-01, 8.36442598e-01]],\n",
+ "\n",
+ " [[ 6.77433596e-01, 1.05809247e+00, 1.24410710e-01,\n",
+ " 5.91982013e-02, 1.14828315e+00, 1.72857279e+00],\n",
+ " [-2.30771138e-01, 3.39815960e+00, 2.01566999e+00,\n",
+ " 2.46236892e-01, 4.43239778e-01, -7.33230735e-01],\n",
+ " [ 1.63789610e+00, 1.11640685e+00, 3.93716887e+00,\n",
+ " 5.44597715e-01, 1.90096305e-01, 7.09989756e-01],\n",
"...\n",
- " [-2.43896853e+00, 3.30179306e+00, -4.48522142e-02,\n",
- " 1.72586758e-01, 3.86605220e+00, -2.42254088e+00],\n",
- " [ 8.14041524e-01, -9.04583335e-03, 5.53646435e-01,\n",
- " 7.76220415e-01, 8.76367109e-01, 2.89835621e+00],\n",
- " [ 8.28765472e-01, 1.85173100e+00, 3.56969276e-01,\n",
- " 4.40940836e+00, 1.37500809e+00, -1.82882219e-01]],\n",
- "\n",
- " [[ 3.50618090e+00, 2.30327886e+00, 3.04477219e+00,\n",
- " 2.89691896e-01, 3.10931238e+00, 1.06338071e+00],\n",
- " [ 1.10262806e+00, -3.62319445e-01, -2.44074894e-01,\n",
- " 1.17811800e+00, 1.91225837e+00, 2.46727576e+00],\n",
- " [ 1.22469854e+00, 6.24819804e-01, 4.29447948e-01,\n",
- " 8.76492756e-01, 8.99019090e-01, 2.73260972e-01],\n",
+ " [-5.15591411e-01, 5.26820777e+00, 3.71288896e-01,\n",
+ " -4.77627654e-01, 2.56200543e+00, 1.52602416e-01],\n",
+ " [ 7.41517453e-01, 5.60496189e-01, 3.75891833e-01,\n",
+ " 1.00419969e+00, 2.61381553e-01, 2.36245195e+00],\n",
+ " [ 4.40802930e-01, 7.58192520e-01, 2.35285967e-01,\n",
+ " 4.16012582e+00, 8.60701676e-01, 1.29669295e-01]],\n",
+ "\n",
+ " [[ 2.72961231e+00, 3.00477379e+00, 2.43355348e+00,\n",
+ " -5.01598792e-01, 4.58695029e+00, 3.91658145e+00],\n",
+ " [ 5.34148586e-01, 1.05078831e-01, 1.58933016e+00,\n",
+ " 1.14090649e+00, 7.12406138e-01, 2.22670124e+00],\n",
+ " [ 1.03676544e+00, 1.11953404e+00, -1.91673794e-01,\n",
+ " 5.14255973e-02, 1.20455810e+00, 8.14963895e-01],\n",
" ...,\n",
- " [ 4.21196757e+00, 5.82660247e-01, 3.41972988e-01,\n",
- " 4.99149444e+00, 2.15239694e+00, -3.22959034e-01],\n",
- " [ 2.85490602e+00, 5.23338957e-01, 5.07511077e+00,\n",
- " -1.23547198e-01, -4.76269311e-02, 5.51003367e-01],\n",
- " [ 1.30593310e+00, 3.43770110e-02, -3.45121220e-01,\n",
- " -3.94720321e-01, 7.08970899e-01, 2.49922971e+00]]]]])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
"
+ " [ 1.61362545e+00, 1.20583253e+00, 1.17936891e+00,\n",
+ " 7.88930461e-01, 9.70336325e-01, 1.54936787e+00],\n",
+ " [ 2.94101975e+00, 1.35250296e+00, 5.07702124e+00,\n",
+ " 2.37031464e-01, -2.82949344e-01, 4.78105922e-01],\n",
+ " [ 1.15976681e+00, 2.98930168e-01, -9.77658706e-02,\n",
+ " 3.30192088e-01, 8.23177333e-01, 1.54634655e+00]]]]])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
"
],
"text/plain": [
- "\n",
- "-0.08418 0.007968 1.72 -0.4511 0.879 ... 0.03438 -0.3451 -0.3947 0.709 2.499\n",
+ " Size: 29kB\n",
+ "0.7083 0.4973 1.085 -0.3347 0.7276 3.925 ... 0.2989 -0.09777 0.3302 0.8232 1.546\n",
"Coordinates:\n",
- " * team (team) <xarray.DataArray (plot_dim: 20, chain: 4, draw: 10, team: 6)>\n",
+ "<xarray.DataArray (plot_dim: 20, chain: 4, draw: 10, team: 6)> Size: 38kB\n",
"-1.318 -2.617 -6.71 -0.7968 ... -1.248e-263 -7.905e-247 -1.896e-242 -1.636e-170\n",
"Coordinates:\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- " * team (team) <U1 'a' 'b' 'c' 'd' 'e' 'f'\n",
- "Dimensions without coordinates: plot_dim
-1.318 -2.617 -6.71 -0.7968 ... -7.905e-247 -1.896e-242 -1.636e-170
array([[[[-1.31814802e+000, -2.61700460e+000, -6.70984312e+000,\n",
+ " * chain (chain) int64 32B 0 1 2 3\n",
+ " * draw (draw) int64 80B 0 1 2 3 4 5 6 7 8 9\n",
+ " * team (team) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'\n",
+ "Dimensions without coordinates: plot_dim
-1.318 -2.617 -6.71 -0.7968 ... -7.905e-247 -1.896e-242 -1.636e-170
array([[[[-1.31814802e+000, -2.61700460e+000, -6.70984312e+000,\n",
" -7.96758432e-001, -9.76978667e-001, -5.56513656e+001],\n",
" [-3.45516048e+001, -2.24242213e+002, -5.31630197e+002,\n",
" -3.06955601e+003, -7.45460050e+002, -4.11436176e+003],\n",
@@ -1378,15 +1404,15 @@
" [-8.64029651e-225, -0.00000000e+000, -9.14158745e-109,\n",
" -0.00000000e+000, -0.00000000e+000, -0.00000000e+000],\n",
" [-5.59473393e-212, -6.68701767e-261, -1.24826806e-263,\n",
- " -7.90478090e-247, -1.89573242e-242, -1.63578038e-170]]]])
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
"
+ " -7.90478090e-247, -1.89573242e-242, -1.63578038e-170]]]])
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
"
],
"text/plain": [
- "\n",
+ " Size: 38kB\n",
"-1.318 -2.617 -6.71 -0.7968 ... -1.248e-263 -7.905e-247 -1.896e-242 -1.636e-170\n",
"Coordinates:\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- " * team (team) <xarray.DataArray (quantile: 3, chain: 4, draw: 10, team: 6)>\n",
+ "<xarray.DataArray (quantile: 3, chain: 4, draw: 10, team: 6)> Size: 6kB\n",
"-0.02018 0.2885 0.8726 -0.204 -0.1332 ... 0.2786 0.2264 0.5523 0.6391 2.198\n",
"Coordinates:\n",
- " * quantile (quantile) float64 0.25 0.5 0.75\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- " * team (team) <U1 'a' 'b' 'c' 'd' 'e' 'f'
-0.02018 0.2885 0.8726 -0.204 -0.1332 ... 0.2264 0.5523 0.6391 2.198
array([[[[-2.01800741e-02, 2.88534502e-01, 8.72635176e-01,\n",
+ " * quantile (quantile) float64 24B 0.25 0.5 0.75\n",
+ " * chain (chain) int64 32B 0 1 2 3\n",
+ " * draw (draw) int64 80B 0 1 2 3 4 5 6 7 8 9\n",
+ " * team (team) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'
-0.02018 0.2885 0.8726 -0.204 -0.1332 ... 0.2264 0.5523 0.6391 2.198
array([[[[-2.01800741e-02, 2.88534502e-01, 8.72635176e-01,\n",
" -2.03975466e-01, -1.33188131e-01, 3.54108894e+00],\n",
" [ 6.53432089e-02, 1.82630503e-01, 2.85863098e-01,\n",
" 6.97717849e-01, 3.39995801e-01, 8.08900563e-01],\n",
@@ -1825,16 +1857,16 @@
" [ 2.96618623e+00, 1.24958516e+00, 5.18136826e+00,\n",
" 2.12500618e-01, 2.44317005e-01, 5.77282225e-01],\n",
" [ 1.26613746e+00, 2.78617268e-01, 2.26408430e-01,\n",
- " 5.52329628e-01, 6.39115142e-01, 2.19785614e+00]]]])
quantile
(quantile)
float64
0.25 0.5 0.75
array([0.25, 0.5 , 0.75])
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
PandasIndex
PandasIndex(Index([0.25, 0.5, 0.75], dtype='float64', name='quantile'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
"
+ " 5.52329628e-01, 6.39115142e-01, 2.19785614e+00]]]])
quantile
(quantile)
float64
0.25 0.5 0.75
array([0.25, 0.5 , 0.75])
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
PandasIndex
PandasIndex(Index([0.25, 0.5, 0.75], dtype='float64', name='quantile'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
"
],
"text/plain": [
- "\n",
+ " Size: 6kB\n",
"-0.02018 0.2885 0.8726 -0.204 -0.1332 ... 0.2786 0.2264 0.5523 0.6391 2.198\n",
"Coordinates:\n",
- " * quantile (quantile) float64 0.25 0.5 0.75\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- " * team (team) <xarray.DataArray (point: 50, chain: 4, draw: 10, team: 6)>\n",
+ "<xarray.DataArray (point: 50, chain: 4, draw: 10, team: 6)> Size: 96kB\n",
"5.321e-44 2.898e-49 4.753e-60 5.206e-41 ... 3.563e-57 4.449e-55 3.664e-24\n",
"Coordinates:\n",
- " * point (point) float64 -5.0 -4.796 -4.592 -4.388 ... 4.388 4.592 4.796 5.0\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- " * team (team) <U1 'a' 'b' 'c' 'd' 'e' 'f'
5.321e-44 2.898e-49 4.753e-60 ... 3.563e-57 4.449e-55 3.664e-24
array([[[[5.32112942e-044, 2.89833875e-049, 4.75267686e-060,\n",
+ " * point (point) float64 400B -5.0 -4.796 -4.592 -4.388 ... 4.592 4.796 5.0\n",
+ " * chain (chain) int64 32B 0 1 2 3\n",
+ " * draw (draw) int64 80B 0 1 2 3 4 5 6 7 8 9\n",
+ " * team (team) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'
5.321e-44 2.898e-49 4.753e-60 ... 3.563e-57 4.449e-55 3.664e-24
array([[[[5.32112942e-044, 2.89833875e-049, 4.75267686e-060,\n",
" 5.20639765e-041, 3.77941277e-042, 4.58464322e-123],\n",
" [0.00000000e+000, 0.00000000e+000, 0.00000000e+000,\n",
" 0.00000000e+000, 0.00000000e+000, 0.00000000e+000],\n",
@@ -2264,7 +2302,7 @@
" [5.00870071e-021, 5.44558967e-066, 1.76028966e+000,\n",
" 1.91753659e-105, 4.27312596e-104, 1.64147102e-090],\n",
" [4.15911393e-041, 4.79615957e-064, 2.11642726e-065,\n",
- " 3.56349345e-057, 4.44906238e-055, 3.66397440e-024]]]])
PandasIndex
PandasIndex(Index([ -5.0, -4.795918367346939, -4.591836734693878,\n",
+ " 4.795918, 5. ])
chain
(chain)
int64
0 1 2 3
draw
(draw)
int64
0 1 2 3 4 5 6 7 8 9
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
team
(team)
<U1
'a' 'b' 'c' 'd' 'e' 'f'
array(['a', 'b', 'c', 'd', 'e', 'f'], dtype='<U1')
PandasIndex
PandasIndex(Index([ -5.0, -4.795918367346939, -4.591836734693878,\n",
" -4.387755102040816, -4.183673469387755, -3.979591836734694,\n",
" -3.7755102040816326, -3.571428571428571, -3.36734693877551,\n",
" -3.163265306122449, -2.9591836734693877, -2.7551020408163263,\n",
@@ -2289,16 +2327,16 @@
" 3.571428571428571, 3.775510204081632, 3.979591836734695,\n",
" 4.183673469387756, 4.387755102040817, 4.591836734693878,\n",
" 4.795918367346939, 5.0],\n",
- " dtype='float64', name='point'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
"
+ " dtype='float64', name='point'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
PandasIndex
PandasIndex(Index(['a', 'b', 'c', 'd', 'e', 'f'], dtype='object', name='team'))
"
],
"text/plain": [
- "\n",
+ " Size: 96kB\n",
"5.321e-44 2.898e-49 4.753e-60 5.206e-41 ... 3.563e-57 4.449e-55 3.664e-24\n",
"Coordinates:\n",
- " * point (point) float64 -5.0 -4.796 -4.592 -4.388 ... 4.388 4.592 4.796 5.0\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9\n",
- " * team (team) "
]
@@ -2401,6 +2439,7 @@
"}\n",
"\n",
"html[theme=dark],\n",
+ "html[data-theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
@@ -2451,7 +2490,7 @@
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
- " grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
+ " grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
@@ -2459,7 +2498,8 @@
"}\n",
"\n",
".xr-section-item input {\n",
- " display: none;\n",
+ " display: inline-block;\n",
+ " opacity: 0;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
@@ -2471,6 +2511,10 @@
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
+ ".xr-section-item input:focus + label {\n",
+ " border: 2px solid var(--xr-font-color0);\n",
+ "}\n",
+ "\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
@@ -2733,25 +2777,25 @@
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
- "<xarray.DataArray 'mu' (chain: 4, draw: 10)>\n",
+ "<xarray.DataArray 'mu' (chain: 4, draw: 10)> Size: 320B\n",
"0.1588 0.2123 0.5543 0.7826 0.1913 0.6035 ... 0.1269 0.712 0.3044 0.1936 0.1223\n",
"Coordinates:\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9
0.1588 0.2123 0.5543 0.7826 0.1913 ... 0.712 0.3044 0.1936 0.1223
array([[0.15881038, 0.21226184, 0.55427158, 0.7826267 , 0.19133639,\n",
+ " * chain (chain) int64 32B 0 1 2 3\n",
+ " * draw (draw) int64 80B 0 1 2 3 4 5 6 7 8 9
0.1588 0.2123 0.5543 0.7826 0.1913 ... 0.712 0.3044 0.1936 0.1223
array([[0.15881038, 0.21226184, 0.55427158, 0.7826267 , 0.19133639,\n",
" 0.60348734, 0.17150419, 0.01878916, 0.05505902, 0.18910122],\n",
" [0.31844717, 0.05345659, 0.57211927, 0.45515712, 0.20021752,\n",
" 0.75086087, 0.90056515, 0.31490928, 0.33074251, 0.27157278],\n",
" [0.21919034, 0.25996597, 0.3229822 , 0.32907978, 0.37967654,\n",
" 0.45405931, 0.35710855, 0.24102518, 0.52642867, 0.25553658],\n",
" [1.34563532, 0.34372887, 0.20387597, 0.71141045, 0.58392139,\n",
- " 0.1269031 , 0.71202737, 0.30438494, 0.19362311, 0.12227929]])
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
"
+ " 0.1269031 , 0.71202737, 0.30438494, 0.19362311, 0.12227929]])
PandasIndex
PandasIndex(Index([0, 1, 2, 3], dtype='int64', name='chain'))
PandasIndex
PandasIndex(Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype='int64', name='draw'))
"
],
"text/plain": [
- "\n",
+ " Size: 320B\n",
"0.1588 0.2123 0.5543 0.7826 0.1913 0.6035 ... 0.1269 0.712 0.3044 0.1936 0.1223\n",
"Coordinates:\n",
- " * chain (chain) int64 0 1 2 3\n",
- " * draw (draw) int64 0 1 2 3 4 5 6 7 8 9"
+ " * chain (chain) int64 32B 0 1 2 3\n",
+ " * draw (draw) int64 80B 0 1 2 3 4 5 6 7 8 9"
]
},
"execution_count": 10,
@@ -2803,6 +2847,7 @@
"}\n",
"\n",
"html[theme=dark],\n",
+ "html[data-theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
@@ -2853,7 +2898,7 @@
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
- " grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
+ " grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
@@ -2861,7 +2906,8 @@
"}\n",
"\n",
".xr-section-item input {\n",
- " display: none;\n",
+ " display: inline-block;\n",
+ " opacity: 0;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
@@ -2873,6 +2919,10 @@
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
+ ".xr-section-item input:focus + label {\n",
+ " border: 2px solid var(--xr-font-color0);\n",
+ "}\n",
+ "\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
@@ -3135,9 +3185,9 @@
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
- "<xarray.DataArray 'score' (match: 12, chain: 4, draw: 10)>\n",
+ "<xarray.DataArray 'score' (match: 12, chain: 4, draw: 10)> Size: 4kB\n",
"14 14 14 14 14 31 14 1 31 14 31 1 14 1 ... 15 15 15 15 15 1 34 15 15 1 34 34 34\n",
- "Dimensions without coordinates: match, chain, draw
14 14 14 14 14 31 14 1 31 14 31 1 ... 15 15 15 1 34 15 15 1 34 34 34
array([[[14, 14, 14, 14, 14, 31, 14, 1, 31, 14],\n",
+ "Dimensions without coordinates: match, chain, draw
14 14 14 14 14 31 14 1 31 14 31 1 ... 15 15 15 1 34 15 15 1 34 34 34
array([[[14, 14, 14, 14, 14, 31, 14, 1, 31, 14],\n",
" [31, 1, 14, 1, 1, 14, 38, 31, 14, 31],\n",
" [ 1, 14, 14, 1, 1, 1, 38, 1, 1, 14],\n",
" [31, 31, 14, 1, 14, 1, 14, 1, 40, 14]],\n",
@@ -3177,10 +3227,10 @@
" [[15, 1, 15, 1, 1, 39, 15, 15, 40, 15],\n",
" [15, 1, 1, 1, 15, 1, 1, 15, 34, 1],\n",
" [ 1, 15, 15, 15, 15, 1, 1, 15, 15, 15],\n",
- " [15, 15, 1, 34, 15, 15, 1, 34, 34, 34]]])
"
+ " [15, 15, 1, 34, 15, 15, 1, 34, 34, 34]]])
"
],
"text/plain": [
- "\n",
+ " Size: 4kB\n",
"14 14 14 14 14 31 14 1 31 14 31 1 14 1 ... 15 15 15 15 15 1 34 15 15 1 34 34 34\n",
"Dimensions without coordinates: match, chain, draw"
]
@@ -3248,6 +3298,7 @@
"}\n",
"\n",
"html[theme=dark],\n",
+ "html[data-theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
@@ -3298,7 +3349,7 @@
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
- " grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
+ " grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
@@ -3306,7 +3357,8 @@
"}\n",
"\n",
".xr-section-item input {\n",
- " display: none;\n",
+ " display: inline-block;\n",
+ " opacity: 0;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
@@ -3318,6 +3370,10 @@
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
+ ".xr-section-item input:focus + label {\n",
+ " border: 2px solid var(--xr-font-color0);\n",
+ "}\n",
+ "\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
@@ -3580,29 +3636,29 @@
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
- "<xarray.Dataset>\n",
+ "<xarray.Dataset> Size: 176B\n",
"Dimensions: (match: 12, team: 6)\n",
"Coordinates:\n",
- " * team (team) <U1 'a' 'b' 'c' 'd' 'e' 'f'\n",
+ " * team (team) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'\n",
"Dimensions without coordinates: match\n",
"Data variables:\n",
- " score (match) float64 1.466 0.2149 0.6788 1.361 ... 1.099 1.156 1.265\n",
- " mu (team) float64 0.8152 1.84 2.102 1.806 1.091 0.9678\n",
- " sigma float64 1.314
"
],
"text/plain": [
- "\n",
+ " Size: 176B\n",
"Dimensions: (match: 12, team: 6)\n",
"Coordinates:\n",
- " * team (team) <xarray.Dataset>\n",
+ "<xarray.Dataset> Size: 32B\n",
"Dimensions: ()\n",
"Data variables:\n",
- " x_plot float64 2.632\n",
- " mu float64 0.4878\n",
- " sigma float64 0.39\n",
- " score float64 1.0
"
+ " x_plot float64 8B 2.632\n",
+ " mu float64 8B 0.4878\n",
+ " sigma float64 8B 0.39\n",
+ " score float64 8B 1.0
"
],
"text/plain": [
- "\n",
+ " Size: 32B\n",
"Dimensions: ()\n",
"Data variables:\n",
- " x_plot float64 2.632\n",
- " mu float64 0.4878\n",
- " sigma float64 0.39\n",
- " score float64 1.0"
+ " x_plot float64 8B 2.632\n",
+ " mu float64 8B 0.4878\n",
+ " sigma float64 8B 0.39\n",
+ " score float64 8B 1.0"
]
},
"execution_count": 13,
@@ -4023,19 +4085,19 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Last updated: Wed Jan 17 2024\n",
+ "Last updated: Thu Sep 19 2024\n",
"\n",
"Python implementation: CPython\n",
- "Python version : 3.11.7\n",
+ "Python version : 3.11.8\n",
"IPython version : 8.18.1\n",
"\n",
- "xarray_einstats: 0.7.0\n",
- "xarray : 2023.12.0\n",
+ "xarray_einstats: 0.8.0\n",
+ "xarray : 2024.9.0\n",
"\n",
- "numpy : 1.26.2\n",
- "sys : 3.11.7 | packaged by conda-forge | (main, Dec 15 2023, 08:38:37) [GCC 12.3.0]\n",
- "scipy : 1.11.4\n",
- "matplotlib: 3.8.2\n",
+ "numpy : 1.26.4\n",
+ "matplotlib: 3.9.1\n",
+ "sys : 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:53:32) [GCC 12.3.0]\n",
+ "scipy : 1.14.1\n",
"\n",
"Watermark: 2.4.3\n",
"\n"
@@ -4058,9 +4120,9 @@
],
"metadata": {
"kernelspec": {
- "display_name": "ArviZ (minimal env)",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
- "name": "arviz"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
@@ -4072,7 +4134,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.7"
+ "version": "3.11.8"
}
},
"nbformat": 4,
diff --git a/pyproject.toml b/pyproject.toml
index da840d2..d3e163e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
name = "xarray-einstats"
description = "Stats, linear algebra and einops for xarray"
readme = "README.md"
-requires-python = ">=3.9"
+requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "ArviZ team", email = "arviz.devs@gmail.com"}
@@ -27,8 +27,8 @@ classifiers = [
]
dynamic = ["version"]
dependencies = [
- "numpy>=1.22",
- "scipy>=1.8",
+ "numpy>=1.23",
+ "scipy>=1.9",
"xarray>=2022.09.0",
]
diff --git a/src/xarray_einstats/__init__.py b/src/xarray_einstats/__init__.py
index 72fd9f9..65247aa 100644
--- a/src/xarray_einstats/__init__.py
+++ b/src/xarray_einstats/__init__.py
@@ -19,7 +19,7 @@
"EinopsAccessor",
]
-__version__ = "0.8.0.dev0"
+__version__ = "0.8.0"
def sort(da, dim, **kwargs):
diff --git a/src/xarray_einstats/accessors.py b/src/xarray_einstats/accessors.py
index 591ba6b..559b17c 100644
--- a/src/xarray_einstats/accessors.py
+++ b/src/xarray_einstats/accessors.py
@@ -1,4 +1,5 @@
"""Accessors for xarray_einstats features."""
+
import xarray as xr
from .linalg import (
diff --git a/src/xarray_einstats/einops.py b/src/xarray_einstats/einops.py
index 97f35da..c059ddb 100644
--- a/src/xarray_einstats/einops.py
+++ b/src/xarray_einstats/einops.py
@@ -13,6 +13,7 @@
example usage.
"""
+
import warnings
from collections.abc import Hashable
diff --git a/src/xarray_einstats/linalg.py b/src/xarray_einstats/linalg.py
index a860885..657996f 100644
--- a/src/xarray_einstats/linalg.py
+++ b/src/xarray_einstats/linalg.py
@@ -10,6 +10,7 @@
``matmul`` and ``get_default_dims``.
"""
+
import warnings
import numpy as np
@@ -34,6 +35,7 @@
"diagonal",
"solve",
"inv",
+ "pinv",
]
@@ -709,19 +711,75 @@ def solve(da, db, dims=None, **kwargs):
"""Wrap :func:`numpy.linalg.solve`.
Usage examples of all arguments is available at the :ref:`linalg_tutorial` page.
+
+ Parameters
+ ----------
+ da : DataArray
+ db : DataArray
+ dims : sequence of hashable, optional
+ It can have either length 2 or 3. If length 2, both dimensions should have the
+ same length and be present in `da`, and only one of them should also be present in `db`.
+ If length 3, the first two elements behave the same; the third element is a dimension
+ of arbitrary length which can only present in `db`.
+
+ From NumPy's docstring, a has ``(..., M, M)`` shape and b has ``(M,) or (..., M, K)``.
+ Here, b can be ``(..., M)`` this case is not limited to 1d, so dims with length two
+ indicates the two dimensions of length M, with length 3 it is something like (M, M, K),
+ which can be done thanks to named dimensions.
+ **kwargs : mapping
+ Passed to :func:`xarray.apply_ufunc`
+
+ Examples
+ --------
+ Dimension naming conventions are designed to ease inverse operation with :func:`xarray.dot`.
+
+ The following example illustrates what this means and how to check that solve
+ worked correctly
+
+ .. jupyter-execute::
+
+ import xarray as xr
+ import numpy as np
+ from xarray_einstats.linalg import solve
+ from xarray_einstats.tutorial import generate_matrices_dataarray
+
+ matrices = generate_matrices_dataarray()
+ matrices
+
+ .. jupyter-execute::
+
+ b = matrices.std("dim2") # dims (batch, experiment, dim)
+ y2 = solve(matrices, b, dims=("dim", "dim2")) # dims (batch, experiment, dim2)
+ np.allclose(b, xr.dot(matrices, y2, dims="dim2"))
+
"""
if dims is None:
dims = _attempt_default_dims("solve", da.dims, db.dims)
if len(dims) == 3:
- b_dim = dims[0] if dims[0] in db.dims else dims[1]
- in_dims = [dims[:2], [b_dim, dims[-1]]]
- out_dims = [[b_dim, dims[-1]]]
+ # solve(a, b) in numpy has signature a: (..., M, M) and b: (..., M, K)
+ # we look which dim is in b -> represents the M
+ k_dim = dims[-1] # the last element in dims represents the K
+ remove_k = False
+ if k_dim in da:
+ raise ValueError(
+ f"Found {k_dim} in `da`. If provided, the 3rd element of 'dims' "
+ "can only be in `db`."
+ )
else:
- in_dims = [dims, dims[:1]]
- out_dims = [dims[:1]]
- return xr.apply_ufunc(
+ # a: (..., M, M) and b: (..., M) is not supported, so we add a dummy K
+ k_dim = "__k_aux_dim__"
+ remove_k = True
+ db = db.expand_dims(k_dim)
+ b_dim = dims[0] if dims[0] in db.dims else dims[1]
+ y_dim = dims[1] if dims[0] in db.dims else dims[0]
+ in_dims = [dims[:2], [b_dim, k_dim]]
+ out_dims = [[y_dim, k_dim]]
+ da_out = xr.apply_ufunc(
np.linalg.solve, da, db, input_core_dims=in_dims, output_core_dims=out_dims, **kwargs
)
+ if remove_k:
+ return da_out.squeeze(k_dim, drop=True)
+ return da_out
def inv(da, dims=None, **kwargs):
@@ -734,3 +792,23 @@ def inv(da, dims=None, **kwargs):
return xr.apply_ufunc(
np.linalg.inv, da, input_core_dims=[dims], output_core_dims=[dims], **kwargs
)
+
+
+def pinv(da, dims=None, **kwargs):
+ """Wrap :func:`numpy.linalg.pinv`.
+
+ Usage examples of all arguments is available at the :ref:`linalg_tutorial` page.
+ If both "rtol" and "rcond" are provided, "rtol" will be ignored.
+ """
+ if dims is None:
+ dims = _attempt_default_dims("pinv", da.dims)
+ rcond = kwargs.pop("rtol", None)
+ rcond = kwargs.pop("rcond", rcond)
+ return xr.apply_ufunc(
+ np.linalg.pinv,
+ da,
+ rcond,
+ input_core_dims=[dims, []],
+ output_core_dims=[dims[::-1]],
+ **kwargs,
+ )
diff --git a/src/xarray_einstats/numba.py b/src/xarray_einstats/numba.py
index b807f10..50207cb 100644
--- a/src/xarray_einstats/numba.py
+++ b/src/xarray_einstats/numba.py
@@ -1,4 +1,5 @@
"""Module with numba enhanced functions."""
+
import numba
import numpy as np
import xarray as xr
diff --git a/src/xarray_einstats/tutorial.py b/src/xarray_einstats/tutorial.py
index c6e6bba..e351bf9 100644
--- a/src/xarray_einstats/tutorial.py
+++ b/src/xarray_einstats/tutorial.py
@@ -1,4 +1,5 @@
"""Tutorial module with data for docs and quick testing."""
+
import numpy as np
import xarray as xr
diff --git a/tests/test_linalg.py b/tests/test_linalg.py
index 29e2a1f..55ad387 100644
--- a/tests/test_linalg.py
+++ b/tests/test_linalg.py
@@ -21,6 +21,7 @@
matrix_rank,
matrix_transpose,
norm,
+ pinv,
qr,
slogdet,
solve,
@@ -140,6 +141,12 @@ def test_inv(self, matrices):
assert out.shape == matrices.shape
assert out.dims == matrices.dims
+ def test_pinv(self, matrices):
+ out = pinv(matrices, dims=("experiment", "dim"))
+ out_dims_exp = ("batch", "dim2", "dim", "experiment")
+ assert out.dims == out_dims_exp
+ assert out.shape == tuple(out.sizes[dim] for dim in out_dims_exp)
+
def test_transpose(self, hermitian):
assert_equal(hermitian, matrix_transpose(hermitian, dims=("dim", "dim2")))
@@ -272,10 +279,16 @@ def test_slogdet_det(self, matrices):
det_da = det(matrices, dims=("dim", "dim2"))
assert_allclose(sign * np.exp(logdet), det_da)
- def test_solve(self, matrices):
+ def test_solve_two_dims(self, matrices):
b = matrices.std("dim2")
y = solve(matrices, b, dims=("dim", "dim2"))
- assert_allclose(b, xr.dot(matrices, y.rename(dim="dim2"), dims="dim2"), atol=1e-14)
+ assert_allclose(b, xr.dot(matrices, y, dim="dim2"), atol=1e-14)
+
+ def test_solve_three_dims(self, matrices):
+ b = matrices.std("dim2")
+ a = matrices.isel(batch=0)
+ y = solve(a, b, dims=("dim", "dim2", "batch"))
+ assert_allclose(b, xr.dot(a, y, dim="dim2").transpose(*b.dims), atol=1e-14)
def test_diagonal(self, matrices):
idx = xr.DataArray(np.arange(len(matrices["dim"])), dims="pointwise_sel")