# Multi-dimensional datasets¶

This is the continuation of 1-D datasets and tables.

## Creation, slicing, and visualization¶

[1]:

import numpy as np
import scipp as sc


To create variables with more than one dimension we specify a list of dimension labels and provide data with a corresponding shape. When inserted into a dataset it is important to note that while the dimensions extents have to match, individual variables may have transposed memory layout.

[2]:

d = sc.Dataset(
data={
'alice': sc.Variable(dims=['z', 'y', 'x'], values=np.random.rand(10, 10, 10),
variances=0.1*np.random.rand(10, 10, 10)),
'bob': sc.Variable(dims=['x', 'z'], values=np.arange(0.0, 10.0, 0.1).reshape(10, 10),
variances=0.1*np.random.rand(10, 10))
},
coords={
'x': sc.arange('x', 11.0, unit=sc.units.m),
'y': sc.arange('y', 11.0, unit=sc.units.m),
'z': sc.arange('z', 11.0, unit=sc.units.m)})


Note that in this example the coordinates are exceeding the shape of the data by 1. This means that the coordinates represent bin edges:

[3]:

sc.show(d)
d

[3]:

scipp.Dataset (17.45 KB)
• z: 10
• y: 10
• x: 10
• x
(x [bin-edge])
float64
m
0.0, 1.0, ..., 9.0, 10.0
Values:array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
• y
(y [bin-edge])
float64
m
0.0, 1.0, ..., 9.0, 10.0
Values:array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
• z
(z [bin-edge])
float64
m
0.0, 1.0, ..., 9.0, 10.0
Values:array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
• alice
(z, y, x)
float64
0.72, 0.49, ..., 0.86, 1.0
σ = 0.28, 0.29, ..., 0.02, 0.3
Values:array([[[7.24146216e-01, 4.93815839e-01, 2.30143223e-01, 6.99332580e-01,
6.37899617e-01, 1.35403766e-01, 1.00274990e-01, 5.48075243e-01,
3.27524746e-01, 6.48472733e-01],
[8.63223132e-01, 2.78619539e-01, 7.31140498e-01, 9.85530091e-01,
2.93541270e-02, 6.07050666e-01, 4.21388626e-01, 5.76077210e-01,
4.21503336e-02, 8.20309504e-01],
[1.30294690e-01, 3.10127680e-01, 4.55002586e-02, 2.22151166e-01,
7.29624630e-01, 6.96704823e-01, 7.04756639e-01, 2.98651415e-01,
9.18017872e-01, 2.60145020e-01],
[8.83852585e-01, 3.79835797e-01, 6.48029722e-01, 6.80503166e-01,
8.57062266e-01, 5.49674173e-01, 8.96537087e-01, 7.34907039e-01,
9.16556641e-01, 1.92196947e-01],
[5.73553684e-01, 2.66401460e-01, 6.98661813e-01, 4.30351056e-01,
8.46830274e-01, 8.93088270e-01, 7.70369133e-01, 4.09291245e-01,
7.83982797e-01, 5.69672125e-01],
[7.89334157e-01, 8.08612906e-03, 2.99801464e-01, 8.13482699e-01,
6.60615813e-01, 7.21838711e-01, 6.89334292e-01, 6.99148513e-01,
6.87106778e-01, 7.70718813e-01],
[1.00157273e-02, 4.47628288e-01, 1.97108902e-02, 9.64558085e-03,
9.37628759e-01, 8.11992042e-01, 7.25287196e-01, 3.89607322e-01,
9.44113196e-01, 6.19870486e-01],
[2.31222110e-01, 3.58843572e-01, 1.36198904e-01, 7.34063728e-01,
1.89565060e-01, 2.95398092e-02, 3.52294947e-01, 2.51817664e-01,
6.03110802e-01, 4.91320522e-01],
[4.91221075e-01, 3.29661232e-01, 7.32223208e-01, 3.12667775e-01,
1.90367055e-01, 3.34528218e-01, 1.77502454e-01, 7.01121644e-01,
4.37407846e-01, 6.04999848e-01],
[4.04885681e-01, 5.04714235e-01, 8.48255749e-02, 4.08892672e-01,
1.95818143e-01, 7.97543010e-01, 2.24396252e-01, 7.32784927e-01,
1.65383289e-02, 3.09074365e-01]],

[[7.31165512e-01, 5.57007787e-01, 7.17842821e-01, 2.71367058e-01,
7.93224620e-01, 6.34596232e-01, 3.11057328e-01, 9.62166443e-01,
1.53791355e-01, 4.77915312e-01],
[8.97458487e-01, 9.16717222e-02, 6.25831717e-01, 2.05571402e-01,
7.83843824e-02, 3.26109183e-01, 3.00338084e-01, 8.54707063e-01,
8.95397835e-01, 2.15405566e-01],
[7.44905083e-01, 2.92782440e-01, 3.33324164e-01, 2.45015210e-01,
2.80623563e-01, 5.31067336e-01, 9.25853999e-01, 4.41580448e-01,
4.94905490e-01, 9.96151951e-01],
[5.24182824e-01, 3.62462067e-01, 9.05367177e-01, 2.49060557e-01,
3.88265866e-01, 3.46036594e-01, 3.30530051e-01, 6.37784368e-01,
7.62867442e-02, 8.58563365e-02],
[3.70748880e-01, 5.20577555e-01, 7.66696539e-01, 4.46322028e-01,
6.07217695e-02, 7.34494650e-01, 5.38828205e-01, 3.90383977e-01,
1.01683103e-01, 6.39174565e-01],
[3.25893184e-01, 2.83225516e-01, 1.03494055e-01, 4.10149408e-01,
6.55732640e-01, 2.68225040e-01, 9.98661611e-01, 4.62344571e-01,
6.26595021e-01, 9.69727044e-01],
[9.42989672e-01, 2.74292456e-01, 8.78035718e-01, 4.11597429e-01,
8.68449666e-01, 8.88700784e-01, 6.87475160e-01, 7.15372128e-02,
1.82793001e-01, 3.35630958e-01],
[6.90720828e-01, 9.24534312e-01, 1.04633353e-01, 2.82804442e-01,
9.59713175e-01, 2.06676116e-01, 1.90998758e-01, 7.06779021e-01,
3.96917632e-01, 5.23164043e-01],
[6.84908170e-01, 1.97686639e-01, 6.15142193e-01, 2.85170103e-01,
4.29995801e-01, 4.47309544e-01, 2.14472624e-01, 7.64522431e-01,
4.36219707e-01, 2.23889971e-01],
[4.81134444e-01, 8.47618483e-01, 9.05231983e-01, 8.48802865e-01,
3.08181694e-01, 7.01555069e-01, 8.46069219e-01, 6.73653933e-02,
6.83761258e-01, 7.25644826e-01]],

[[4.64667349e-01, 1.44846752e-01, 7.42027498e-02, 9.68824046e-01,
9.21478268e-01, 9.83888992e-01, 2.39934399e-01, 2.39005951e-01,
6.30962969e-01, 1.87719109e-01],
[6.12778621e-01, 9.46011298e-01, 1.24533619e-01, 8.69343386e-01,
6.11902345e-01, 3.30077596e-01, 2.22897856e-01, 2.65809039e-01,
9.93031101e-01, 6.60043660e-01],
[1.80902100e-01, 5.39717073e-01, 6.65780641e-01, 4.41731456e-01,
7.39394738e-02, 8.58495622e-02, 6.39532487e-01, 6.36627669e-01,
1.80681730e-01, 6.13838715e-01],
[1.88016179e-01, 6.51776844e-01, 9.11777831e-01, 4.73214397e-01,
3.01006600e-01, 6.95983348e-01, 7.32978189e-01, 8.92983324e-01,
9.16284529e-01, 3.73287894e-01],
[6.92479290e-01, 7.64636631e-01, 9.00757866e-01, 7.35940006e-01,
1.07439244e-01, 6.57029145e-01, 7.67921652e-01, 5.02518169e-01,
9.53574248e-01, 8.49351616e-01],
[4.20518927e-01, 2.88455148e-01, 6.16671215e-01, 8.68950489e-01,
8.14526208e-01, 4.71809156e-01, 6.67439213e-01, 4.01813752e-01,
9.38478851e-01, 3.36371666e-01],
[5.27875696e-01, 3.08750411e-02, 7.73506066e-01, 2.91990075e-01,
9.29462576e-01, 6.57088233e-01, 1.28412107e-01, 6.91753866e-01,
1.60948378e-02, 1.19916598e-01],
[9.51705147e-01, 9.13995136e-01, 5.77305683e-02, 1.24617650e-01,
8.38788113e-01, 4.32138050e-01, 7.89130005e-02, 1.15769226e-01,
4.96917754e-01, 5.04260182e-01],
[4.67220108e-01, 7.84198735e-01, 8.94285581e-01, 1.54648712e-01,
3.58538840e-01, 3.60135383e-01, 5.98323051e-01, 6.78811365e-01,
1.80369833e-02, 7.62863192e-01],
[8.65319497e-01, 6.25656374e-01, 3.24679787e-01, 4.82933723e-01,
4.30429262e-01, 7.88847013e-01, 5.76914455e-01, 7.49364715e-01,
8.19179376e-01, 8.30985384e-01]],

[[5.49492638e-01, 4.66831219e-01, 4.00322889e-01, 5.07059447e-01,
5.78844328e-01, 4.55240612e-01, 2.78346109e-01, 3.71289046e-01,
8.72503574e-01, 8.83838227e-01],
[5.05611645e-01, 7.24468732e-01, 6.52117204e-01, 3.61754574e-01,
6.63907723e-01, 5.98156262e-01, 6.25313774e-01, 5.79451690e-01,
9.12883234e-01, 4.80440181e-01],
[6.24910268e-02, 9.88357411e-01, 2.86888817e-01, 5.36856068e-01,
2.11969922e-01, 4.33287608e-01, 2.40949430e-01, 6.98845975e-02,
3.16191117e-01, 3.65353720e-01],
[2.95908847e-01, 9.34237228e-01, 7.69714635e-01, 6.19410982e-01,
3.89787552e-01, 7.45039118e-01, 3.13038057e-01, 9.50755115e-01,
4.25796274e-01, 1.75720256e-01],
[9.39016945e-01, 1.48723080e-01, 7.97416832e-01, 8.52926288e-01,
9.52187723e-01, 6.30270166e-01, 7.53779955e-01, 5.65664503e-01,
6.08115183e-01, 5.93290764e-01],
[7.95148117e-01, 2.69467210e-01, 9.56667188e-01, 2.86621609e-01,
6.48797080e-01, 2.50298220e-01, 7.00372564e-01, 7.88634407e-02,
9.77675733e-01, 6.66634601e-01],
[9.17720226e-01, 5.23704599e-01, 7.25115009e-01, 9.75081358e-01,
1.53561750e-01, 7.71575618e-01, 1.96318630e-01, 7.57860704e-01,
5.17830985e-01, 6.64698444e-01],
[9.03313182e-01, 2.20721239e-01, 1.12129276e-01, 5.78866814e-01,
2.28044411e-01, 1.35792584e-01, 6.48394933e-01, 1.89077747e-02,
7.56300299e-01, 2.60221346e-01],
[4.67010919e-01, 9.00610769e-01, 5.66530584e-01, 9.13786920e-01,
4.59654451e-01, 4.15336935e-01, 8.32967352e-01, 6.89941582e-01,
7.49370702e-01, 1.12511075e-01],
[2.41046773e-01, 8.62847941e-01, 3.67531580e-01, 6.64543291e-01,
7.26830083e-01, 5.81168551e-01, 2.92554116e-01, 9.40925231e-01,
2.70652627e-01, 3.81245834e-01]],

[[3.65558718e-01, 4.54833641e-01, 8.74644027e-01, 5.48846147e-01,
7.60505211e-01, 9.01107865e-03, 9.44422327e-01, 8.96005340e-02,
3.43104705e-01, 6.21249812e-01],
[9.50505951e-02, 1.45485240e-01, 1.33800646e-01, 3.98175210e-01,
9.34036964e-01, 7.39044833e-01, 2.25793537e-01, 9.81075049e-02,
6.09715030e-01, 4.11589032e-01],
[1.44225054e-01, 5.33341775e-01, 6.43242232e-02, 6.61486081e-01,
6.85699539e-01, 9.99674198e-01, 8.91669325e-02, 4.24960853e-01,
1.02727433e-01, 3.64784252e-01],
[6.80618157e-01, 2.12886785e-01, 8.56662299e-01, 7.72732551e-01,
9.42153572e-01, 9.02264506e-01, 6.85257476e-01, 9.15035360e-01,
8.23654311e-01, 4.06372217e-01],
[6.18357595e-01, 2.61655497e-01, 8.69846632e-01, 3.73757370e-02,
5.39659104e-01, 2.93796004e-01, 1.90833651e-01, 3.31580543e-01,
9.77430912e-01, 9.85869640e-01],
[5.00820764e-01, 9.64309651e-01, 4.74796358e-01, 9.61802135e-01,
4.48310845e-02, 6.70619316e-01, 6.17780159e-01, 5.77604120e-01,
9.97644398e-01, 2.58345544e-01],
[5.03733475e-02, 2.39437407e-01, 7.56335984e-01, 7.09798530e-01,
2.57535054e-02, 5.04665541e-02, 5.39146392e-01, 3.28954565e-01,
2.81302800e-01, 4.84838171e-02],
[6.08525721e-01, 4.65820093e-01, 5.54493450e-01, 8.97172453e-01,
2.41930536e-01, 7.07926657e-01, 7.79819402e-01, 7.43528187e-02,
9.96396806e-01, 6.08536084e-01],
[7.04073075e-01, 2.93441019e-01, 9.11012414e-02, 1.76278373e-01,
5.00530100e-01, 9.74563172e-01, 6.35700794e-01, 4.05208938e-02,
7.53831212e-01, 6.67429916e-01],
[4.55109161e-01, 4.02268897e-01, 3.38594011e-01, 4.65299390e-01,
3.40329512e-01, 6.18528686e-01, 6.69039883e-01, 8.45157854e-01,
5.84956024e-01, 4.42055048e-01]],

[[8.05392358e-01, 2.68434201e-01, 8.13355475e-01, 8.81717827e-01,
2.41935252e-01, 8.84638003e-01, 9.09743987e-01, 9.03367367e-01,
8.70201621e-01, 3.48478621e-01],
[7.33602516e-01, 5.60872915e-01, 7.50070442e-01, 7.08106695e-01,
2.02715364e-01, 8.89616322e-01, 8.79002871e-01, 4.27415347e-01,
9.93462612e-01, 5.30554598e-01],
[7.82157105e-01, 3.03520001e-01, 1.14743601e-01, 6.04418461e-01,
4.05476482e-01, 3.56882108e-01, 6.79046648e-01, 2.80709268e-01,
4.95400433e-01, 6.42769398e-01],
[7.06961251e-02, 2.87451741e-01, 3.66722417e-01, 5.57862255e-01,
4.87487639e-01, 7.02751959e-01, 3.88756241e-01, 6.38456087e-01,
3.55233016e-01, 4.10483412e-01],
[4.17620880e-01, 1.20389052e-01, 7.96076163e-01, 3.11283009e-01,
9.25175794e-01, 6.33682373e-01, 4.84205656e-01, 6.31144552e-01,
7.77062558e-01, 3.56486863e-01],
[7.77574559e-01, 9.04820812e-01, 1.16353971e-01, 8.58575478e-01,
7.32702787e-01, 1.93669805e-01, 2.65199635e-01, 6.07915909e-01,
4.92213525e-01, 7.56037985e-01],
[3.73452083e-01, 4.07355410e-02, 3.94799635e-01, 8.54011704e-01,
9.46386033e-01, 7.08223254e-01, 6.92522431e-01, 7.92240463e-01,
2.95093293e-01, 8.84047525e-01],
[2.11975379e-01, 7.23087437e-02, 7.09792389e-01, 5.69477901e-01,
3.48998678e-02, 2.79074264e-01, 3.50148247e-01, 6.64816886e-02,
8.96202669e-01, 9.71780365e-01],
[1.69349727e-01, 2.71053055e-01, 3.88492310e-01, 4.19907823e-02,
1.30065956e-01, 6.72013394e-01, 8.38980040e-01, 4.59776583e-01,
1.69703819e-01, 1.44345166e-01],
[7.58685249e-01, 4.95929125e-01, 5.15812547e-01, 6.24111709e-02,
2.69110667e-01, 4.24442280e-01, 3.22027434e-01, 8.78023346e-01,
1.00234784e-01, 3.63024032e-01]],

[[4.03809575e-01, 9.82705701e-01, 5.52213606e-01, 5.98616636e-01,
6.17943021e-01, 7.00969914e-01, 8.64327302e-01, 5.73492741e-01,
8.95543408e-01, 2.07216668e-01],
[4.16590397e-01, 5.48054405e-01, 1.01346224e-01, 9.73749912e-02,
4.65976323e-01, 8.03097703e-01, 8.02620050e-01, 6.05442393e-01,
6.24588005e-01, 5.79394222e-01],
[1.99603062e-01, 6.95978340e-01, 4.16252695e-01, 9.13535033e-02,
6.55579053e-01, 5.09254433e-01, 5.25912437e-01, 9.21986465e-02,
1.94771185e-01, 9.64196304e-01],
[1.84084263e-01, 6.25272156e-01, 8.65245277e-01, 2.33856945e-01,
3.52110485e-01, 2.94829677e-01, 9.86608115e-01, 3.23414873e-01,
1.59365829e-01, 9.34287963e-01],
[3.06925078e-01, 7.67926335e-02, 2.51142360e-01, 5.90617601e-02,
3.91685361e-01, 8.02821060e-02, 2.14788243e-01, 5.56734404e-01,
7.11563392e-01, 7.10583457e-01],
[5.85116678e-01, 8.47031045e-01, 5.69592819e-01, 7.12018096e-01,
3.43015066e-01, 7.85959426e-01, 5.42472847e-03, 9.43472383e-01,
2.86138556e-01, 2.76437089e-01],
[9.41603843e-01, 7.34275399e-01, 2.27913043e-01, 1.30103524e-02,
3.11498212e-01, 8.65538212e-01, 9.65390211e-02, 6.04196151e-01,
6.75651255e-01, 4.74739250e-01],
[4.09335520e-01, 3.49852180e-01, 3.32716123e-01, 1.05703004e-01,
6.36775144e-01, 6.38187972e-01, 5.91635452e-01, 9.50227052e-01,
3.65968653e-01, 3.73307115e-01],
[3.09883204e-01, 3.27561440e-01, 3.32793984e-01, 8.53203997e-01,
4.80382912e-01, 6.10498552e-01, 9.60531319e-02, 8.09904684e-01,
1.03271019e-01, 2.34756783e-01],
[2.12622414e-01, 9.73528029e-01, 3.47196493e-01, 1.08239449e-01,
8.33361256e-01, 7.40192392e-01, 3.74326019e-01, 6.08253541e-01,
8.00947600e-01, 9.31146307e-01]],

[[5.83161081e-01, 3.77414664e-01, 5.60515836e-01, 9.77066623e-01,
7.03262761e-02, 8.10598701e-01, 2.87601885e-01, 4.14446827e-01,
6.70280336e-01, 6.09633331e-01],
[4.90221651e-01, 5.62202220e-02, 4.96536298e-01, 3.16606230e-01,
8.76497127e-01, 9.56884310e-01, 9.48492482e-01, 7.49610846e-01,
7.57619216e-01, 3.36387727e-01],
[5.09305677e-01, 1.24267558e-01, 2.73568317e-01, 1.09336074e-01,
6.63437686e-01, 5.54196906e-01, 2.73579035e-01, 4.17117893e-01,
9.92985228e-01, 4.64697114e-01],
[2.50588087e-01, 5.10188215e-03, 1.83008527e-01, 4.55599314e-01,
1.40717923e-01, 6.52056256e-01, 1.58289900e-01, 7.29453475e-03,
5.72420831e-01, 4.84624712e-01],
[7.22967405e-01, 4.83089818e-01, 2.29930676e-01, 3.16820996e-01,
9.74740827e-01, 6.11106397e-01, 5.33019352e-01, 9.44035558e-01,
5.02461134e-01, 2.92116462e-01],
[1.79727235e-01, 5.86192907e-01, 1.74432751e-01, 4.73011286e-01,
2.61475393e-01, 5.43589823e-01, 1.39517331e-01, 4.19271637e-02,
6.70725451e-01, 3.82769065e-01],
[1.79245925e-01, 1.32218373e-01, 9.34844607e-02, 4.31607022e-01,
5.84402903e-01, 2.78061474e-01, 3.75311210e-01, 7.30709959e-01,
2.72235505e-01, 9.64741755e-01],
[7.70317923e-01, 8.86805268e-01, 8.95563795e-01, 3.95700396e-01,
3.55645137e-01, 4.11988012e-01, 6.45712792e-01, 5.22616200e-02,
6.52360445e-01, 3.69120437e-02],
[7.63290436e-01, 9.38382906e-01, 4.84738454e-01, 3.24607681e-01,
3.00877303e-01, 4.76326975e-01, 1.00705654e-01, 5.77318098e-01,
6.80988049e-01, 2.61262316e-01],
[4.63797845e-01, 8.34925254e-01, 7.85571847e-01, 8.29481571e-01,
4.47730771e-01, 9.38299119e-02, 1.56238373e-01, 8.18780401e-01,
8.91072120e-01, 1.87009277e-01]],

[[2.96489242e-01, 6.09219146e-01, 1.79754720e-01, 1.25115238e-01,
2.60251549e-01, 4.87767822e-01, 1.29674872e-01, 1.80871165e-01,
2.77317756e-01, 7.42125672e-01],
[4.12846152e-01, 5.37840238e-01, 8.99656426e-01, 4.33603944e-01,
5.93032012e-01, 4.01909850e-02, 9.30400453e-01, 8.92860681e-02,
3.71246215e-01, 8.05126094e-01],
[8.69491122e-01, 6.37641653e-01, 2.11602019e-01, 9.50798368e-01,
1.08054000e-01, 7.61477742e-01, 9.67901981e-01, 7.68055676e-01,
6.67114557e-01, 5.44994971e-01],
[2.78215718e-02, 2.02416624e-01, 5.02480271e-01, 2.52826237e-01,
3.15004964e-01, 4.66936679e-01, 6.74569281e-01, 4.92787897e-01,
4.72196221e-01, 3.39190335e-01],
[1.63585446e-02, 5.11678310e-01, 9.04215157e-01, 4.77055566e-01,
6.52441808e-01, 2.22163894e-02, 1.68289730e-01, 8.67880077e-01,
5.80284110e-01, 5.66505426e-01],
[2.07827756e-01, 2.76395957e-01, 9.63158124e-01, 1.03658895e-01,
3.69536397e-01, 4.79485103e-01, 1.48621703e-01, 5.58329839e-01,
1.50945030e-01, 6.28981318e-01],
[3.34456930e-01, 7.66299009e-01, 6.36908921e-01, 7.09759679e-01,
7.44975870e-01, 5.63125648e-01, 5.48119182e-01, 7.56485808e-01,
9.06041791e-01, 5.51079736e-01],
[1.49646024e-01, 2.51429098e-01, 6.99842829e-01, 3.51376227e-01,
4.73312847e-01, 7.48334721e-01, 2.65593703e-03, 1.08344829e-01,
3.71776376e-01, 4.53234614e-01],
[6.60356119e-01, 3.62043266e-01, 9.89542070e-01, 2.29963661e-01,
6.17514809e-01, 3.69239554e-01, 5.86552317e-01, 5.01887385e-01,
1.57892453e-01, 8.52165905e-01],
[8.87938514e-01, 7.32795804e-01, 3.39537662e-01, 3.78187456e-01,
1.95926694e-01, 5.55079155e-01, 3.78360129e-01, 4.48563768e-01,
3.12443708e-01, 8.42375377e-01]],

[[4.07409922e-01, 3.59447867e-01, 2.19595549e-01, 5.29534455e-01,
3.52996047e-01, 7.61657875e-01, 6.69051968e-01, 6.87739195e-01,
9.06517350e-02, 7.51500329e-02],
[3.67939661e-01, 8.47586729e-01, 3.78726050e-04, 8.97998091e-01,
4.84596350e-01, 2.97422660e-01, 4.93380091e-01, 3.20108027e-01,
4.61051640e-01, 2.82943041e-01],
[6.62998206e-02, 8.41153322e-01, 4.97547443e-01, 7.51186414e-01,
8.05252260e-01, 7.90452619e-01, 1.66142654e-02, 3.75575043e-01,
4.96722115e-02, 6.73261371e-01],
[8.26467576e-01, 8.55369796e-01, 5.03936493e-01, 4.28946422e-01,
7.32450555e-01, 4.29879860e-01, 6.88602895e-01, 1.63633050e-01,
5.46527651e-01, 3.92359949e-01],
[9.79760931e-01, 6.72415609e-01, 9.39507563e-01, 7.24761617e-01,
8.46978159e-01, 9.16548728e-01, 3.46394659e-01, 3.96244478e-01,
4.23790439e-01, 4.15727794e-01],
[2.30806245e-01, 6.26537147e-01, 5.39454541e-01, 2.78007421e-01,
8.33630493e-01, 5.76702673e-01, 6.95566960e-01, 8.06686220e-01,
3.19751631e-01, 5.66060205e-01],
[6.01583661e-01, 3.81304909e-01, 1.70102179e-01, 3.99484951e-01,
2.14515167e-01, 5.16133835e-01, 2.29890161e-01, 5.82990423e-01,
4.36410679e-01, 3.06508461e-01],
[8.14279434e-01, 2.27762469e-01, 3.83823019e-01, 6.91018520e-01,
2.75268624e-02, 9.16242225e-01, 8.99755244e-01, 4.84328046e-01,
1.39227458e-03, 3.36574166e-01],
[9.70992103e-01, 2.31779948e-01, 2.47047234e-01, 8.47090684e-01,
5.56886869e-01, 8.93545313e-01, 6.89405560e-02, 4.47856652e-01,
9.49051043e-01, 5.55843563e-01],
[3.71042248e-01, 5.12085423e-01, 8.88489553e-04, 2.83650703e-01,
1.51534050e-01, 7.56232935e-01, 1.57917639e-01, 6.93957503e-02,
8.60880045e-01, 9.98213381e-01]]])Variances (σ²):array([[[8.01207301e-02, 8.63378264e-02, 9.38591580e-02, 3.69835074e-02,
2.14089142e-02, 9.80798157e-02, 5.31857834e-02, 3.11624377e-02,
9.29542424e-02, 8.19041531e-02],
[3.83395722e-02, 9.58576498e-02, 3.35100988e-02, 4.52191878e-02,
3.47955545e-02, 3.91611184e-02, 5.38114186e-02, 9.67475781e-02,
2.79199095e-02, 1.48608461e-02],
[9.48935698e-02, 7.78691619e-02, 6.80584183e-02, 9.43161698e-02,
7.55934256e-02, 6.31720503e-02, 4.66870184e-02, 2.13604181e-03,
9.89581946e-02, 9.38158125e-02],
[3.93624386e-02, 6.16264734e-02, 3.49923650e-02, 2.86202182e-02,
9.41585928e-02, 1.18163067e-02, 6.30849535e-02, 6.92828252e-02,
7.78842075e-02, 8.26528381e-02],
[8.25526762e-02, 1.68686270e-02, 5.68080622e-02, 4.51747837e-02,
6.21739525e-02, 6.67643326e-02, 1.09478258e-02, 4.65664673e-02,
7.94259097e-02, 2.00880614e-02],
[2.31494066e-02, 6.13908498e-02, 5.93857101e-02, 5.55261536e-02,
9.46974335e-02, 7.36959207e-02, 3.21595185e-02, 6.88523756e-02,
5.85584512e-02, 8.25982100e-02],
[9.47161099e-03, 9.07174918e-02, 3.17598895e-03, 9.74531663e-02,
3.73148775e-02, 1.70094082e-02, 9.58745387e-02, 8.56658051e-02,
4.14679715e-02, 3.70412437e-02],
[1.11539813e-02, 9.94206747e-02, 9.39391843e-02, 1.52431312e-02,
8.94142526e-02, 9.16682153e-02, 8.45863687e-02, 5.99723956e-02,
4.33643384e-02, 5.74679779e-02],
[6.74361317e-02, 8.50302161e-02, 6.04485483e-02, 3.97499781e-02,
7.64766798e-02, 8.57234854e-02, 9.97615497e-02, 5.43009174e-02,
5.42785316e-02, 6.10655613e-02],
[9.59381275e-02, 8.06891760e-02, 3.55841247e-02, 1.69832619e-02,
4.83524052e-03, 3.17209432e-02, 2.91042027e-02, 8.03769612e-02,
6.92007096e-02, 3.48614239e-02]],

[[3.11022370e-02, 8.01613874e-02, 9.70592872e-02, 7.48603509e-02,
1.23230935e-03, 3.46239474e-02, 1.06999586e-02, 8.69200542e-02,
9.39033841e-02, 3.33182641e-03],
[5.36426115e-02, 8.57200453e-02, 9.15523028e-02, 6.37120912e-02,
6.47094107e-02, 8.87945111e-02, 4.47765784e-02, 7.71615167e-02,
4.16330180e-02, 6.86535264e-02],
[6.47942737e-02, 9.46451920e-03, 1.99064413e-02, 1.58911322e-02,
3.22049584e-02, 1.47528659e-03, 2.63050525e-02, 9.05206355e-03,
5.16629851e-02, 7.30592880e-02],
[1.32160064e-02, 5.83018670e-02, 5.77909955e-02, 9.08624304e-03,
9.00939082e-02, 3.34337067e-02, 6.89622883e-02, 8.68041055e-03,
7.68861085e-02, 6.99415790e-02],
[5.06784825e-02, 5.33475241e-02, 6.44952309e-02, 1.52659763e-02,
8.21761595e-02, 7.30785238e-02, 9.80996474e-02, 5.00616816e-02,
9.28348326e-02, 6.17693881e-02],
[9.88229778e-02, 1.09674144e-02, 2.40739519e-02, 3.19890867e-02,
1.38293640e-02, 5.71934782e-02, 9.59985719e-02, 1.21353018e-02,
9.92558500e-03, 6.04726195e-02],
[6.94464707e-02, 9.93805726e-02, 1.48090618e-02, 5.28569868e-02,
8.27398223e-02, 7.51950308e-02, 5.09152409e-02, 1.69184918e-02,
8.13528836e-02, 1.20271222e-02],
[3.04140840e-02, 3.66697249e-02, 5.08206031e-02, 4.53472537e-02,
7.95740200e-02, 8.91734852e-02, 1.49380666e-02, 3.50595147e-02,
3.94482952e-02, 4.62139882e-02],
[2.04748692e-02, 5.48445070e-03, 6.82075313e-02, 2.43662985e-02,
7.05914192e-02, 5.25916209e-02, 2.40968381e-02, 3.09464760e-02,
3.62074940e-02, 8.14136254e-02],
[3.40045451e-02, 5.17117041e-02, 4.58451748e-02, 2.06384398e-02,
6.77324683e-02, 5.45087625e-02, 3.34617884e-02, 1.50851525e-02,
3.02278933e-02, 6.99902766e-02]],

[[8.48944835e-02, 4.39942451e-03, 2.15519531e-02, 4.82226205e-03,
8.76539995e-02, 2.09666116e-02, 2.72575898e-02, 5.80073463e-02,
7.78210267e-02, 1.26981887e-02],
[1.51259823e-02, 6.77488532e-03, 5.37473461e-02, 5.62574400e-02,
2.05954466e-02, 4.65583304e-03, 2.12394524e-02, 5.16679860e-02,
1.44630225e-02, 6.66566191e-02],
[5.97320443e-02, 8.41533360e-02, 3.48673849e-03, 7.31412909e-02,
4.71772902e-02, 2.58246729e-02, 6.54214084e-02, 4.76462234e-02,
1.46531341e-02, 5.49628645e-02],
[9.58318712e-02, 8.88063708e-02, 4.15648951e-02, 9.14855586e-02,
7.66044459e-02, 9.37729782e-02, 3.17886231e-02, 2.47793659e-02,
2.85477582e-02, 3.31784762e-02],
[2.72102429e-02, 9.19973331e-03, 1.48048363e-02, 1.62569791e-02,
8.29915699e-02, 3.72916807e-02, 8.42406074e-02, 1.96220817e-02,
1.10011547e-02, 1.94899835e-02],
[6.78848713e-02, 6.36605267e-02, 5.48252263e-02, 3.32841228e-02,
1.19554168e-02, 3.37550004e-02, 4.49662588e-02, 3.41062567e-02,
4.63353336e-02, 2.03518067e-02],
[1.49407753e-02, 6.90400085e-02, 1.89883141e-02, 3.27572111e-02,
8.34903879e-02, 7.17296965e-02, 8.43767269e-02, 8.11855078e-02,
1.79917472e-02, 6.97696567e-02],
[4.47894233e-02, 2.41148401e-02, 4.78384202e-02, 9.72755031e-02,
9.61713954e-02, 4.75430990e-02, 9.58945313e-02, 9.86045636e-02,
5.47916024e-02, 9.85887820e-02],
[1.80763242e-03, 8.38400378e-02, 2.05983856e-02, 2.90510407e-02,
5.22359179e-02, 2.15234512e-02, 8.34239529e-02, 2.87472725e-02,
8.18910915e-02, 1.96674583e-02],
[6.16978332e-02, 6.91563922e-02, 3.62193214e-02, 2.15990894e-02,
1.95227949e-02, 9.98667918e-02, 9.39947416e-02, 4.64857838e-02,
3.84005775e-02, 1.25828914e-02]],

[[8.73138975e-02, 1.47093650e-02, 3.62551621e-03, 2.25254178e-02,
4.44583279e-02, 8.29499488e-02, 2.12699437e-02, 8.61662258e-02,
6.62347191e-02, 6.44270899e-02],
[6.95404366e-02, 4.56939390e-03, 2.02568403e-02, 3.61103447e-02,
6.77023234e-02, 1.38686675e-03, 2.79512947e-02, 1.35141960e-02,
6.10514363e-02, 5.58235009e-04],
[9.08083490e-02, 8.43068124e-02, 2.33234861e-02, 1.50328673e-02,
9.50798444e-02, 1.06810121e-02, 7.99876174e-02, 3.83876862e-02,
5.29816874e-02, 3.41436584e-02],
[4.50235215e-02, 1.67520479e-02, 6.16740973e-02, 3.39951907e-02,
3.51629256e-02, 5.98382544e-02, 1.78825558e-02, 6.46415397e-02,
8.92882525e-02, 7.01067682e-03],
[5.13783020e-02, 1.29884276e-02, 9.78629119e-02, 4.52154340e-02,
1.86447860e-02, 8.55782041e-02, 2.15788168e-02, 5.22465435e-02,
9.31940523e-02, 7.74025891e-03],
[4.43996008e-02, 1.93966262e-02, 2.27543142e-02, 2.24615702e-02,
8.11460762e-02, 2.19126606e-03, 5.14209458e-02, 3.35136222e-02,
3.31039800e-02, 3.53320926e-02],
[1.69719891e-02, 6.15560666e-02, 8.02225625e-02, 2.37538442e-02,
6.07300341e-02, 8.56253240e-02, 6.06737196e-02, 5.54952121e-02,
9.43464088e-02, 1.79889729e-02],
[3.05610103e-02, 4.44130601e-02, 2.89872849e-02, 1.90953902e-02,
8.70996474e-02, 4.59715434e-02, 8.29189286e-02, 7.05215078e-02,
5.23030206e-02, 3.12334025e-02],
[1.74208497e-02, 6.42538071e-02, 2.44872634e-02, 1.68532584e-02,
1.76845029e-02, 1.28852721e-02, 6.36279390e-02, 6.94510701e-02,
3.86214159e-02, 6.95189698e-02],
[4.03504747e-02, 6.35704354e-02, 9.46312215e-02, 9.36549078e-02,
8.89030858e-03, 5.60555624e-02, 3.91608241e-02, 1.76691015e-02,
3.19812792e-02, 9.97326189e-02]],

[[1.84269449e-02, 2.30206498e-02, 8.47586580e-02, 7.72511688e-04,
3.93264505e-02, 1.18643754e-02, 8.98504715e-02, 2.38596971e-02,
7.82212047e-02, 4.25052392e-02],
[7.89745333e-02, 8.35450077e-02, 9.06005083e-02, 1.38027505e-02,
8.45509995e-02, 2.43116793e-02, 4.99393243e-02, 4.11161467e-02,
5.81208682e-02, 6.61581810e-02],
[8.58120602e-02, 8.00566639e-02, 9.40802094e-04, 2.63243823e-02,
4.99502104e-03, 3.66061192e-02, 7.47668370e-02, 8.86231765e-02,
4.48850135e-04, 4.13258245e-02],
[5.67312050e-02, 7.92887400e-02, 5.49456441e-02, 6.37148894e-02,
5.91543349e-03, 7.31226172e-02, 1.14949018e-02, 8.08279875e-02,
6.87845607e-02, 2.90715571e-02],
[4.17817652e-02, 7.97365522e-02, 4.62697680e-02, 1.26781712e-02,
8.93800793e-02, 5.91754841e-02, 3.57812654e-02, 1.74863614e-02,
7.62267251e-02, 9.88235227e-02],
[6.98599410e-03, 7.02762141e-02, 9.27389608e-02, 5.65720713e-02,
4.04713427e-02, 3.71580772e-02, 4.21780074e-02, 5.60600137e-02,
4.04598060e-03, 3.94149940e-02],
[8.91051367e-02, 9.37710535e-02, 3.91761026e-02, 9.59160286e-02,
1.95150589e-02, 1.27752689e-02, 1.14842357e-02, 9.77263190e-02,
3.43434739e-02, 5.56836833e-02],
[7.55963199e-02, 3.40166158e-02, 8.48107991e-02, 4.69273207e-02,
5.01350412e-02, 6.09729248e-02, 5.36565279e-02, 9.90412610e-02,
3.83938193e-02, 2.41823682e-02],
[3.45354489e-02, 1.79708175e-02, 2.30480481e-02, 4.15077095e-03,
3.35634754e-02, 5.15627720e-02, 8.57326614e-02, 8.64028987e-02,
2.59238223e-02, 3.77762969e-02],
[3.92422540e-03, 5.98607970e-02, 5.40296749e-02, 6.14607252e-02,
6.25035474e-02, 1.44614540e-02, 8.61989921e-02, 6.93283546e-02,
3.11027977e-03, 1.46143044e-02]],

[[4.21990894e-02, 4.95124590e-02, 7.56605220e-02, 4.43448178e-02,
7.70310698e-02, 9.60996044e-02, 9.58496480e-02, 2.99693801e-02,
9.36411967e-02, 7.74513425e-04],
[7.45932942e-02, 8.54539187e-03, 9.07926587e-03, 6.12111780e-02,
2.66933799e-03, 8.87247028e-02, 5.74433992e-02, 6.48850973e-02,
3.34000352e-02, 9.72630020e-04],
[6.77849849e-02, 2.76183321e-02, 5.85316686e-02, 5.27822757e-02,
1.98865660e-02, 9.49037009e-02, 5.20783384e-02, 2.16667783e-02,
3.30798361e-02, 2.35785634e-02],
[9.41899456e-02, 5.15117151e-02, 1.45351184e-02, 4.58403282e-02,
4.29031590e-02, 4.90464756e-02, 3.39351748e-02, 8.27686164e-03,
9.01867616e-02, 9.75486379e-02],
[5.05401902e-02, 2.31979588e-03, 7.43080013e-02, 8.49854360e-02,
4.91804075e-02, 1.41959176e-03, 9.94499967e-02, 6.61386599e-02,
3.84127422e-02, 1.34875120e-02],
[9.06625945e-02, 7.94171083e-04, 6.66733118e-03, 6.61814995e-02,
7.10191137e-02, 9.00415500e-02, 3.43423356e-03, 7.69880044e-02,
1.74227005e-02, 7.65658566e-02],
[7.48597003e-02, 6.99953836e-02, 9.67795077e-02, 8.64029783e-02,
8.87927571e-02, 1.63008264e-02, 3.74788463e-02, 9.05006405e-02,
4.37796522e-02, 6.54105720e-02],
[7.33967364e-02, 1.38102246e-02, 4.65594796e-02, 7.16859417e-02,
4.25481242e-04, 5.24526213e-02, 8.39325685e-02, 1.68899962e-06,
5.90070410e-02, 3.60164446e-02],
[4.79500294e-02, 9.77504062e-02, 5.14895981e-02, 2.64229723e-02,
2.81290430e-02, 8.94066444e-02, 3.37254242e-02, 4.48201323e-02,
6.47475262e-02, 2.22809545e-02],
[8.79159226e-02, 1.73546280e-03, 2.17319595e-02, 8.02021442e-02,
4.60752024e-02, 9.36207198e-02, 9.70960107e-02, 3.37043044e-02,
3.52953134e-02, 1.04077919e-02]],

[[4.63817326e-02, 6.81108061e-02, 1.55510055e-02, 7.26919990e-03,
3.36726033e-02, 1.50969417e-03, 6.33416256e-02, 6.90994830e-02,
5.74432088e-02, 7.76836610e-02],
[9.99352566e-03, 9.87148473e-02, 7.29034042e-02, 8.78609232e-02,
4.03957872e-02, 2.03001377e-03, 3.81688102e-02, 4.32234616e-02,
6.71447974e-02, 5.78217478e-03],
[9.67110285e-02, 2.11595556e-02, 5.67880804e-02, 5.25453382e-03,
7.47839180e-03, 6.75053623e-02, 8.51557378e-02, 6.88768498e-03,
3.34684705e-03, 9.47888881e-02],
[4.47248653e-02, 2.93528811e-02, 9.04467306e-02, 5.19910825e-02,
7.10931201e-02, 6.97312491e-02, 8.61002374e-02, 3.70252550e-02,
7.04534577e-02, 7.03183875e-02],
[2.98120203e-02, 5.73419975e-02, 1.93624971e-02, 4.69949835e-02,
3.76811465e-02, 2.13200717e-02, 4.69894591e-02, 1.70613845e-02,
3.59406836e-02, 1.41390054e-02],
[2.16411670e-02, 8.25316172e-02, 9.16592798e-02, 2.08644791e-02,
2.93847755e-02, 8.45644397e-02, 9.93752145e-02, 7.81001762e-02,
3.16882100e-03, 6.01485913e-02],
[1.93474914e-02, 8.98282083e-03, 7.42503109e-02, 8.03399491e-02,
5.85031623e-02, 3.63410524e-02, 7.07623269e-02, 6.92607121e-02,
5.13764728e-02, 3.34930068e-02],
[2.47050685e-02, 1.19643824e-02, 3.81450149e-02, 3.00782582e-02,
4.43756662e-02, 8.26376659e-02, 3.73985134e-02, 9.21124482e-02,
8.97890771e-02, 3.86154233e-02],
[4.64399831e-02, 3.85630832e-02, 2.41075244e-02, 2.58800080e-03,
9.79897668e-02, 7.67690878e-02, 3.68868648e-02, 9.12255348e-02,
8.00947023e-02, 8.90084307e-02],
[8.50851591e-02, 9.10121989e-02, 7.50901209e-02, 3.43192180e-02,
1.47339731e-03, 9.13106048e-02, 1.02993501e-02, 6.04194248e-02,
6.45644755e-02, 5.35017779e-02]],

[[3.76948517e-02, 7.08172724e-02, 8.68639129e-02, 8.87477496e-02,
6.94320522e-02, 8.38033402e-02, 1.04920452e-02, 8.34929334e-03,
4.20572977e-02, 2.17806868e-02],
[6.65237155e-02, 6.69276057e-02, 7.36291118e-02, 6.71974786e-02,
3.05124342e-02, 6.81676068e-02, 2.52010890e-02, 6.56272941e-02,
6.82021861e-02, 9.81206095e-03],
[3.61241789e-03, 5.22843581e-02, 7.48480867e-02, 5.66827482e-02,
3.12180025e-02, 1.42157850e-03, 6.87974808e-02, 6.09120185e-02,
5.15605980e-02, 4.46155750e-02],
[1.84882334e-02, 7.77403740e-02, 5.72271465e-02, 2.08555769e-02,
3.23859915e-02, 4.94353063e-02, 4.51733428e-02, 3.92400793e-02,
2.41231077e-02, 3.03006992e-02],
[8.60725025e-02, 3.64232549e-02, 9.68591846e-03, 1.64704705e-02,
2.28222673e-02, 6.99540027e-02, 3.70047963e-02, 8.54652369e-02,
2.76710759e-02, 9.64622949e-02],
[3.72194218e-02, 6.95800886e-02, 3.45642058e-02, 3.16106799e-02,
3.97254286e-02, 4.12088017e-02, 8.15595841e-02, 8.63164651e-03,
1.17207029e-02, 8.86376961e-02],
[5.57810282e-02, 8.78610852e-02, 7.10527146e-02, 6.80905503e-02,
2.47168658e-02, 9.12151190e-02, 2.82237056e-03, 7.45901114e-02,
6.79605199e-02, 3.54549078e-02],
[9.75544739e-02, 9.70698050e-02, 4.80924468e-02, 8.94525651e-02,
1.20551950e-02, 7.45377557e-02, 6.26868983e-03, 5.17859349e-02,
7.01238456e-02, 4.27211113e-02],
[6.12900196e-02, 7.25001688e-02, 9.13564964e-02, 6.14144901e-02,
2.29350167e-02, 8.73865709e-03, 5.19068453e-02, 8.14378213e-02,
5.46544447e-02, 8.98544487e-02],
[8.93420707e-02, 4.18771100e-02, 5.61504693e-02, 4.07977922e-03,
5.94591072e-02, 9.21125967e-02, 3.31214183e-02, 3.23693549e-02,
7.85507158e-02, 9.26195885e-02]],

[[9.77512268e-02, 6.25581321e-02, 5.34835339e-02, 9.04234526e-03,
5.18557043e-02, 9.76632424e-02, 2.53858284e-02, 5.33589324e-02,
3.19080812e-02, 1.12994772e-03],
[7.69664367e-02, 8.48312115e-02, 1.24488548e-02, 4.75662570e-02,
4.20715530e-04, 8.98843814e-02, 9.23695961e-02, 6.43359152e-04,
4.84893292e-02, 3.03626488e-04],
[6.55686447e-02, 8.00506031e-02, 6.10312158e-02, 6.62087022e-02,
7.74587083e-02, 3.02869938e-02, 7.84316426e-02, 5.04001450e-02,
7.09928676e-02, 5.29477376e-02],
[3.70338969e-02, 4.50254497e-03, 2.74136883e-02, 8.43775447e-02,
2.45999592e-02, 9.48772800e-02, 7.88164556e-02, 2.55619214e-02,
2.67821743e-02, 2.14444263e-02],
[7.45499203e-02, 7.75343796e-03, 1.20405707e-02, 6.70487116e-02,
2.82258136e-02, 7.97883850e-02, 3.80605334e-02, 3.43378946e-02,
7.41529101e-02, 8.22564889e-02],
[7.89691858e-02, 2.58645717e-02, 2.31417434e-02, 8.56483399e-02,
8.60871074e-02, 1.13381482e-02, 5.64371363e-02, 4.96761241e-02,
1.35840906e-02, 6.72807023e-02],
[9.00458995e-02, 3.33380808e-02, 6.74128121e-02, 7.88804977e-02,
1.00224248e-02, 6.45719586e-02, 4.95184343e-03, 1.90647642e-02,
5.67034356e-02, 5.79515531e-02],
[1.40850145e-02, 4.11717683e-02, 2.67581787e-02, 9.21229239e-02,
6.41175236e-02, 4.48174629e-02, 6.72562539e-02, 1.31974566e-02,
7.29135160e-03, 7.24087182e-02],
[5.01486756e-02, 5.85344600e-02, 9.97303324e-02, 8.83453237e-02,
5.46893818e-02, 5.54424838e-02, 8.15079346e-02, 6.59224043e-03,
4.03829447e-02, 4.53081714e-03],
[1.76499778e-02, 1.12477335e-02, 4.43385779e-02, 1.83661327e-02,
2.66597062e-02, 3.19628438e-02, 7.72133014e-02, 1.05627004e-02,
6.54894323e-02, 4.25261311e-03]],

[[1.11767268e-02, 2.44176632e-02, 6.33177057e-02, 9.43568269e-02,
3.39186704e-02, 9.34158351e-03, 5.05291695e-02, 6.33874380e-02,
2.57973207e-02, 1.60139623e-02],
[8.09410909e-02, 8.32188262e-02, 8.24531054e-02, 8.94986445e-02,
2.08032638e-02, 5.65424137e-02, 4.72964385e-02, 8.93984777e-02,
8.93454522e-02, 8.52783867e-02],
[1.22581822e-03, 9.00637764e-02, 9.59610776e-02, 5.69090214e-02,
8.78018465e-02, 2.59880231e-02, 2.91592578e-02, 8.74837165e-02,
2.72059309e-02, 3.57498767e-02],
[2.73707528e-04, 4.04516646e-02, 1.02096939e-03, 5.55187127e-02,
9.22867850e-02, 1.48984256e-02, 5.89898081e-02, 1.91941884e-02,
5.22095889e-02, 5.79594484e-02],
[9.28015016e-02, 4.47635150e-03, 8.36359158e-02, 3.45879290e-02,
8.77376804e-02, 7.36387638e-02, 3.52204852e-02, 3.81623229e-03,
1.67145580e-02, 5.42799064e-04],
[1.56719212e-02, 4.85459065e-02, 1.59975498e-02, 8.01253799e-02,
9.76982024e-02, 9.31288243e-02, 6.75986820e-02, 6.96468912e-02,
1.19455375e-02, 5.55283210e-02],
[4.00569364e-03, 8.06842329e-02, 4.51335250e-03, 2.59937399e-02,
5.70870234e-02, 8.74914295e-02, 4.58260309e-02, 8.63302289e-02,
2.89481927e-02, 8.23246511e-02],
[7.96926686e-02, 3.31291083e-02, 7.56623487e-03, 5.91245281e-03,
1.93948836e-02, 8.93906476e-03, 9.10140076e-03, 1.76959578e-02,
8.75058373e-02, 5.84698749e-02],
[2.43056265e-02, 9.27404199e-02, 8.67533693e-02, 1.00650386e-02,
8.39217087e-02, 4.19145935e-02, 2.58681374e-02, 6.42950675e-02,
3.80570506e-02, 2.39680820e-02],
[1.92659672e-02, 4.30961990e-02, 7.17466483e-02, 8.63362529e-02,
3.13948079e-02, 8.72052296e-02, 9.86149974e-02, 5.01077739e-02,
3.74478016e-04, 8.93097729e-02]]])
• bob
(x, z)
float64
0.0, 0.1, ..., 9.8, 9.9
σ = 0.27, 0.22, ..., 0.14, 0.31
Values:array([[0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
[1. , 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9],
[2. , 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9],
[3. , 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9],
[4. , 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9],
[5. , 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9],
[6. , 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9],
[7. , 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9],
[8. , 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9],
[9. , 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9]])Variances (σ²):array([[0.07273377, 0.04989699, 0.06445848, 0.05642493, 0.00490842,
0.09408408, 0.06094089, 0.01940279, 0.04121442, 0.07359646],
[0.0320617 , 0.05037877, 0.09247093, 0.05387947, 0.04058386,
0.06378661, 0.0086305 , 0.05223879, 0.02351903, 0.06851242],
[0.00372053, 0.04242474, 0.00050031, 0.01351683, 0.00975447,
0.03302091, 0.07919148, 0.05392051, 0.06757294, 0.05636131],
[0.00485702, 0.03105401, 0.09113896, 0.09416773, 0.09207814,
0.07902188, 0.03382482, 0.01480256, 0.04314213, 0.04878144],
[0.05749054, 0.06941926, 0.08119641, 0.02715996, 0.09890429,
0.092456  , 0.03769801, 0.06793582, 0.07270839, 0.06428407],
[0.05978408, 0.09369024, 0.04861367, 0.08889728, 0.06205336,
0.05967507, 0.00872669, 0.06267435, 0.06854531, 0.0363729 ],
[0.04311726, 0.00057827, 0.08897441, 0.07851432, 0.06037546,
0.02624816, 0.0867688 , 0.00209828, 0.07878133, 0.00961017],
[0.0815546 , 0.07548409, 0.06810872, 0.05723724, 0.05567111,
0.08875519, 0.0001808 , 0.03286223, 0.05769091, 0.04123132],
[0.07812832, 0.01428348, 0.08723245, 0.07545137, 0.09522267,
0.05876783, 0.01941469, 0.09641863, 0.04411309, 0.0348458 ],
[0.03413437, 0.07558359, 0.06137484, 0.09937847, 0.09384991,
0.03867708, 0.05866082, 0.01063345, 0.02028928, 0.09552854]])

To slice in multiple dimensions, we can simply chain the slicing notation used previously for 1D data. This gives us a number of different options for visualizing our data:

[4]:

sc.table(d['x', 5]['z', 2])


We can plot and item of a Dataset using:

[5]:

sc.plot(d['bob'])


Plotting a 3-dimensional data cube will show a 2D image with a slider to navigate through the third dimension (note that interactive sliders will only appear in a Jupyter notebook and not in the documentation pages):

[6]:

sc.plot(d['alice'])


Finally, by extracting a 1D variable, we obtain a 1D plot:

[7]:

sc.plot(d['x', 8]['y', 2])


Note that this is now plotted as a histogram since the coordinate in the dataset represents bin edges, in contrast to the 1D data plotted in 1-D datasets and tables.

Operations automatically broadcast based on dimension labels. That is, if one of the operands lacks one (or multiple) dimensions that the other operands have, the operand is considered constant along those dimensions. Its values are implicitly “duplicated” so the shape matches. In contrast to numpy or MATLAB there is no need to keep track of dimension order:

[8]:

d['alice'] -= d['bob']
d['alice'] -= d['alice']['y', 5]
sc.plot(d['alice']['x', 4])


### Exercise 1¶

Remove the X and Z surface layer of the volume, i.e., remove the first and last slice in each of the dimensions 'x' and 'z'.

### Solution 1¶

[9]:

d = d['x', 1:-1]['z', 1:-1].copy()
d

[9]:

scipp.Dataset (11.23 KB)
• z: 8
• y: 10
• x: 8
• x
(x [bin-edge])
float64
m
1.0, 2.0, ..., 8.0, 9.0
Values:array([1., 2., 3., 4., 5., 6., 7., 8., 9.])
• y
(y [bin-edge])
float64
m
0.0, 1.0, ..., 9.0, 10.0
Values:array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
• z
(z [bin-edge])
float64
m
1.0, 2.0, ..., 8.0, 9.0
Values:array([1., 2., 3., 4., 5., 6., 7., 8., 9.])
• alice
(z, y, x)
float64
0.27, 0.61, ..., -0.11, 0.16
σ = 0.44, 0.45, ..., 0.42, 0.41
Values:array([[[ 2.73782270e-01,  6.14348766e-01, -1.38782351e-01,
1.37491980e-01,  3.66371192e-01, -6.87604284e-01,
4.99821872e-01, -4.72803666e-01],
[-1.91553794e-01,  5.22337662e-01, -2.04578007e-01,
-5.77348257e-01,  5.78841428e-02, -6.98323527e-01,
3.92362492e-01,  2.68802815e-01],
[ 9.55692366e-03,  2.29830109e-01, -1.65134199e-01,
-3.75109077e-01,  2.62842296e-01, -7.28076120e-02,
-2.07641233e-02, -1.31689531e-01],
[ 7.92365510e-02,  8.01873122e-01, -1.61088851e-01,
-2.67466774e-01,  7.78115533e-02, -6.68131560e-01,
1.75439796e-01, -5.50308276e-01],
[ 2.37352039e-01,  6.63202484e-01,  3.61726196e-02,
-5.95010870e-01,  4.66269610e-01, -4.59833406e-01,
-7.19605945e-02, -5.24911918e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-8.93306061e-03,  7.74541663e-01,  1.44802070e-03,
2.12717027e-01,  6.20475743e-01, -3.11186451e-01,
-3.90807358e-01, -4.43802019e-01],
[ 6.41308796e-01,  1.13929780e-03, -1.27344967e-01,
3.03980535e-01, -6.15489242e-02, -8.07662853e-01,
2.44434450e-01, -2.29677388e-01],
[-8.55388776e-02,  5.11648138e-01, -1.24979306e-01,
-2.25736838e-01,  1.79084503e-01, -7.84188987e-01,
3.02177860e-01, -1.90375314e-01],
[ 5.64392967e-01,  8.01737928e-01,  4.38653456e-01,
-3.47550946e-01,  4.33330028e-01, -1.52592392e-01,
-3.94979178e-01,  5.71662379e-02]],

[[-1.43608396e-01, -5.42468465e-01,  9.98735573e-02,
1.06952060e-01,  5.12079836e-01, -4.27504814e-01,
-1.62807801e-01, -3.07515883e-01],
[ 6.57556150e-01, -4.92137597e-01,  3.92896803e-04,
-2.02623863e-01, -1.41731560e-01, -4.44541357e-01,
-1.36004713e-01,  5.45522499e-02],
[ 2.51261925e-01,  4.91094261e-02, -4.27219033e-01,
-7.40586734e-01, -3.85959594e-01, -2.79067259e-02,
2.34813917e-01, -7.57797122e-01],
[ 3.63321696e-01,  2.95106616e-01, -3.95736092e-01,
-5.13519607e-01,  2.24174193e-01,  6.55389758e-02,
4.91169572e-01, -2.21943225e-02],
[ 4.76181483e-01,  2.84086651e-01, -1.33010483e-01,
-7.07086964e-01,  1.85219989e-01,  1.00482439e-01,
1.00704416e-01,  1.50953971e-02],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-2.57580107e-01,  1.56834851e-01, -5.76960414e-01,
1.14936369e-01,  1.85279077e-01, -5.39027106e-01,
2.89940114e-01, -9.22384014e-01],
[ 6.25539987e-01, -5.58940647e-01, -7.44332839e-01,
2.42619050e-02, -3.96711057e-02, -5.88526212e-01,
-2.86044526e-01, -4.41561098e-01],
[ 4.95743587e-01,  2.77614366e-01, -7.14301777e-01,
-4.55987367e-01, -1.11673773e-01, -6.91161614e-02,
2.76997613e-01, -9.20441868e-01],
[ 3.37201225e-01, -2.91991428e-01, -3.86016766e-01,
-3.84096946e-01,  3.17037857e-01, -9.05247575e-02,
3.47550963e-01, -1.19299476e-01]],

[[ 1.97364009e-01, -5.56344298e-01,  2.20437838e-01,
-6.99527519e-02,  2.04942392e-01, -4.22026455e-01,
2.92425605e-01, -1.05172159e-01],
[ 4.55001522e-01, -3.04549984e-01,  7.51329655e-02,
1.51106436e-02,  3.47858041e-01, -7.50587900e-02,
5.00588249e-01, -6.47924987e-02],
[ 7.18890201e-01, -6.69778371e-01,  2.50234459e-01,
-4.36827157e-01,  1.82989388e-01, -4.59423134e-01,
-8.97884321e-03, -6.61484616e-01],
[ 6.64770018e-01, -1.86952553e-01,  3.32789373e-01,
-2.59009528e-01,  4.94740898e-01, -3.87334508e-01,
8.71891674e-01, -5.51879459e-01],
[-1.20744130e-01, -1.59250356e-01,  5.66304680e-01,
3.03390643e-01,  3.79971946e-01,  5.34073909e-02,
4.86801063e-01, -3.69560550e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[ 2.54237389e-01, -2.31552179e-01,  6.88459749e-01,
-4.95235329e-01,  5.21277398e-01, -5.04053934e-01,
6.78997263e-01, -4.59844748e-01],
[-4.87459706e-02, -8.44537912e-01,  2.92245205e-01,
-4.20752669e-01, -1.14505636e-01, -5.19776316e-02,
-5.99556660e-02, -2.21375434e-01],
[ 6.31143559e-01, -3.90136604e-01,  6.27165311e-01,
-1.89142629e-01,  1.65038714e-01,  1.32594788e-01,
6.11078141e-01, -2.28305031e-01],
[ 5.93380731e-01, -5.89135608e-01,  3.77921682e-01,
7.80330033e-02,  3.30870331e-01, -4.07818448e-01,
8.62061791e-01, -7.07023106e-01]],

[[-5.09476010e-01,  3.99847670e-01, -4.12955988e-01,
7.15674126e-01, -6.61608237e-01,  3.26642168e-01,
-4.88003586e-01, -6.54539693e-01],
[-8.18824411e-01, -3.40995712e-01, -5.63626924e-01,
8.89205880e-01,  6.84255171e-02, -3.91986622e-01,
-4.79496615e-01, -3.87929367e-01],
[-4.30967877e-01, -4.10472134e-01, -3.00316054e-01,
6.40868454e-01,  3.29054883e-01, -5.28613226e-01,
-1.52643267e-01, -8.94916965e-01],
[-7.51422866e-01,  3.81865942e-01, -1.89069584e-01,
8.97322488e-01,  2.31645191e-01,  6.74773169e-02,
3.37431240e-01, -1.73990086e-01],
[-7.02654155e-01,  3.95050274e-01, -9.24426398e-01,
4.94828020e-01, -3.76823312e-01, -4.26946508e-01,
-2.46023578e-01, -2.02134859e-02],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-7.24872245e-01,  2.81539627e-01, -2.52003605e-01,
-1.90775792e-02, -6.20152762e-01, -7.86337672e-02,
-2.48649556e-01, -7.16341597e-01],
[-4.98489558e-01,  7.96970920e-02, -6.46296817e-02,
1.97099452e-01,  3.73073413e-02,  1.62039243e-01,
-5.03251302e-01, -1.24759125e-03],
[-6.70868633e-01, -3.83695116e-01, -7.85523762e-01,
4.55699015e-01,  3.03943856e-01,  1.79206349e-02,
-5.37083226e-01, -2.43813186e-01],
[-5.62040754e-01, -1.36202347e-01, -4.96502744e-01,
2.95498428e-01, -5.20906300e-02,  5.12597238e-02,
2.67553734e-01, -4.12688373e-01]],

[[-6.36386611e-01,  6.97001503e-01,  2.31423488e-02,
-4.90767536e-01,  6.90968199e-01,  6.44544352e-01,
2.95451458e-01,  3.77988096e-01],
[-3.43947897e-01,  6.33716470e-01, -1.50468784e-01,
-5.29987423e-01,  6.95946517e-01,  6.13803236e-01,
-1.80500561e-01,  5.01249087e-01],
[-6.01300811e-01, -1.61037042e-03, -2.54157018e-01,
-3.27226306e-01,  1.63212303e-01,  4.13847013e-01,
-3.27206640e-01,  3.18690780e-03],
[-6.17369071e-01,  2.50368445e-01, -3.00713223e-01,
-2.45215148e-01,  5.09082154e-01,  1.23556607e-01,
3.05401779e-02, -1.36980509e-01],
[-7.84431760e-01,  6.79722192e-01, -5.47292470e-01,
1.92473006e-01,  4.40012568e-01,  2.19006021e-01,
2.32286434e-02,  2.84849033e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-8.64085271e-01,  2.78445664e-01, -4.56377453e-03,
2.13683246e-01,  5.14553449e-01,  4.27322796e-01,
1.84324555e-01, -1.97120232e-01],
[-8.32512068e-01,  5.93438418e-01, -2.89097577e-01,
-6.97802920e-01,  8.54044588e-02,  8.49486123e-02,
-5.41434220e-01,  4.03989144e-01],
[-6.33767757e-01,  2.72138338e-01, -8.16584696e-01,
-6.02636832e-01,  4.78343589e-01,  5.73780405e-01,
-1.48139326e-01, -3.22509706e-01],
[-4.08891687e-01,  3.99458576e-01, -7.96164307e-01,
-4.63592121e-01,  2.30772475e-01,  5.68277994e-02,
2.70107437e-01, -3.91978741e-01]],

[[ 1.35674657e-01, -1.73792135e-02, -1.13401460e-01,
2.74927955e-01, -8.49895118e-02,  8.58902573e-01,
-3.69979642e-01,  6.09404852e-01],
[-2.98976639e-01, -4.68246596e-01, -6.14643104e-01,
1.22961257e-01,  1.71382772e-02,  7.97195321e-01,
-3.38029991e-01,  3.38449449e-01],
[-1.51052704e-01, -1.53340124e-01, -6.20664592e-01,
3.12563987e-01, -2.76704992e-01,  5.20487709e-01,
-8.51273737e-01, -9.13673707e-02],
[-2.21758889e-01,  2.95652458e-01, -4.78161151e-01,
9.09541881e-03, -4.91129748e-01,  9.81183386e-01,
-6.20057511e-01, -1.26772727e-01],
[-7.70238411e-01, -3.18450460e-01, -6.52956336e-01,
4.86702948e-02, -7.05677320e-01,  2.09363514e-01,
-3.86737979e-01,  4.25424836e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-1.12755645e-01, -3.41679776e-01, -6.99007743e-01,
-3.15168539e-02,  7.95787867e-02,  9.11142927e-02,
-3.39276233e-01,  3.89512699e-01],
[-4.97178865e-01, -2.36876696e-01, -6.06315091e-01,
2.93760078e-01, -1.47771454e-01,  5.86210723e-01,
6.75466814e-03,  7.98300973e-02],
[-5.19469604e-01, -2.36798835e-01,  1.41185901e-01,
1.37367846e-01, -1.75460873e-01,  9.06284034e-02,
-1.33567699e-01, -1.82867537e-01],
[ 1.26496985e-01, -2.22396326e-01, -6.03778647e-01,
4.90346190e-01, -4.57670334e-02,  3.68901291e-01,
-3.35218842e-01,  5.14809044e-01]],

[[-2.08778243e-01,  3.86083085e-01,  5.04055336e-01,
-1.91149117e-01,  2.67008878e-01,  1.48084554e-01,
3.72519663e-01, -4.45114995e-04],
[-5.29972685e-01,  3.22103548e-01, -1.56405056e-01,
6.15021734e-01,  4.13294487e-01,  8.08975151e-01,
7.07683682e-01,  8.68937648e-02],
[-4.61925349e-01,  9.91355659e-02, -3.63675213e-01,
4.01962293e-01,  1.06070832e-02,  1.34061704e-01,
3.75190729e-01,  3.22259777e-01],
[-5.81091025e-01,  8.57577607e-03, -1.74119728e-02,
-1.20757470e-01,  1.08466432e-01,  1.87725694e-02,
-3.46326290e-02, -9.83046195e-02],
[-1.03103089e-01,  5.54979256e-02, -1.56190290e-01,
7.13265435e-01,  6.75165742e-02,  3.93502021e-01,
9.02108394e-01, -1.68264317e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-4.53974534e-01, -8.09482899e-02, -4.14042640e-02,
3.22927511e-01, -2.65528350e-01,  2.35793879e-01,
6.88782796e-01, -3.98489946e-01],
[ 3.00612361e-01,  7.21131044e-01, -7.73108903e-02,
9.41697444e-02, -1.31601812e-01,  5.06195461e-01,
1.03344563e-02, -1.83650061e-02],
[ 3.52189999e-01,  3.10305703e-01, -1.48403605e-01,
3.94019100e-02, -6.72628482e-02, -3.88116763e-02,
5.35390934e-01,  1.02625984e-02],
[ 2.48732347e-01,  6.11139096e-01,  3.56470284e-01,
1.86255379e-01, -4.49759911e-01,  1.67210423e-02,
7.76853237e-01,  2.20346669e-01]],

[[ 3.32823189e-01, -7.83403404e-01,  2.14563435e-02,
-1.09284848e-01,  8.28271879e-03, -1.89468315e-02,
-3.77458674e-01,  1.26372726e-01],
[ 2.61444281e-01, -6.35016977e-02,  3.29945049e-01,
2.23495615e-01, -4.39294118e-01,  7.81778749e-01,
-4.69043771e-01,  2.20301185e-01],
[ 3.61245695e-01, -7.51556105e-01,  8.47139473e-01,
-2.61482397e-01,  2.81992639e-01,  8.19280277e-01,
2.09725837e-01,  5.16169528e-01],
[-7.39793333e-02, -4.60677853e-01,  1.49167342e-01,
-5.45314327e-02, -1.25484243e-02,  5.25947578e-01,
-6.55419415e-02,  3.21251191e-01],
[ 2.35282352e-01, -5.89429671e-02,  3.73396671e-01,
2.82905411e-01, -4.57268714e-01,  1.96680267e-02,
3.09550238e-01,  4.29339080e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[ 4.89903052e-01, -3.26249203e-01,  6.06100784e-01,
3.75439473e-01,  8.36405453e-02,  3.99497478e-01,
1.98155969e-01,  7.55096761e-01],
[-2.49668591e-02, -2.63315295e-01,  2.47717332e-01,
1.03776450e-01,  2.68849618e-01, -1.45965766e-01,
-4.49985010e-01,  2.20831347e-01],
[ 8.56473086e-02,  2.63839454e-02,  1.26304766e-01,
2.47978412e-01, -1.10245549e-01,  4.37930613e-01,
-5.64424539e-02,  6.94742287e-03],
[ 4.56399847e-01, -6.23620462e-01,  2.74528561e-01,
-1.73609702e-01,  7.55940525e-02,  2.29738425e-01,
-1.09766071e-01,  1.61498679e-01]]])Variances (σ²):array([[[0.19188634, 0.20598272, 0.16895745, 0.1539002 , 0.2791979 ,
0.10785508, 0.25002353, 0.13239592],
[0.19744499, 0.20047573, 0.15780919, 0.2173773 , 0.33336846,
0.1419317 , 0.24026499, 0.08012556],
[0.12118947, 0.12882987, 0.10998823, 0.18487285, 0.24604924,
0.12346017, 0.17215554, 0.09015553],
[0.17002682, 0.16671443, 0.10318334, 0.2427618 , 0.27800766,
0.16611741, 0.17178389, 0.11537865],
[0.16507247, 0.17341866, 0.10936307, 0.23484405, 0.31765248,
0.19525476, 0.21316516, 0.13132737],
[0.12269236, 0.13299738, 0.12608618, 0.16649726, 0.30176743,
0.19315369, 0.17523878, 0.04841813],
[0.21110552, 0.12373249, 0.14695408, 0.23540771, 0.31976898,
0.14807036, 0.18002197, 0.11984542],
[0.14839467, 0.15974404, 0.13944435, 0.23224191, 0.33374744,
0.11209318, 0.19816299, 0.07794084],
[0.1172094 , 0.17713096, 0.1184634 , 0.22325931, 0.29716557,
0.12125195, 0.19404995, 0.07470003],
[0.16343665, 0.15476861, 0.11473554, 0.22040036, 0.29908272,
0.13061691, 0.17818863, 0.06872043]],

[[0.2530018 , 0.07737781, 0.22038431, 0.26200225, 0.15194895,
0.25017267, 0.22833105, 0.29862126],
[0.25537726, 0.1095732 , 0.27181948, 0.19494369, 0.13563817,
0.24415453, 0.22199169, 0.23526325],
[0.33275572, 0.05931259, 0.28870334, 0.22152554, 0.15680701,
0.28833649, 0.21796993, 0.23545336],
[0.33740875, 0.09739075, 0.3070476 , 0.25095269, 0.22475532,
0.2547037 , 0.19510307, 0.24934799],
[0.25780211, 0.07063069, 0.23181902, 0.25733982, 0.16827402,
0.30715568, 0.18994578, 0.23180139],
[0.31226291, 0.11065108, 0.24884617, 0.18630366, 0.16473734,
0.26788134, 0.20442996, 0.26713556],
[0.31764239, 0.07481417, 0.24831926, 0.25783863, 0.20271204,
0.3072918 , 0.25150921, 0.23879198],
[0.27271722, 0.10366427, 0.31283755, 0.27051964, 0.17852544,
0.31880961, 0.26892827, 0.27559183],
[0.33244242, 0.07642424, 0.24461309, 0.22658416, 0.15250579,
0.30633903, 0.19907098, 0.30269132],
[0.31775877, 0.09204518, 0.23716113, 0.19387104, 0.23084913,
0.31690982, 0.21680949, 0.25920081]],

[[0.14186494, 0.0534135 , 0.23332246, 0.17992431, 0.26293578,
0.22971953, 0.23415433, 0.25024144],
[0.13172497, 0.07004482, 0.24690738, 0.20316831, 0.1813727 ,
0.23640088, 0.1615023 , 0.24505816],
[0.21146239, 0.07311147, 0.22582991, 0.23054583, 0.19066684,
0.2884372 , 0.18637579, 0.23698841],
[0.14390762, 0.11146208, 0.24479223, 0.17062891, 0.23982409,
0.22633214, 0.21262964, 0.27329498],
[0.140144  , 0.14765089, 0.25601247, 0.15411077, 0.26556404,
0.2300284 , 0.20023465, 0.27720078],
[0.1465522 , 0.0725423 , 0.23325861, 0.21661206, 0.1821771 ,
0.25987053, 0.18150172, 0.21711071],
[0.18871164, 0.13001054, 0.23455088, 0.19619602, 0.26561116,
0.2691233 , 0.20348331, 0.27835313],
[0.17156864, 0.07877527, 0.22989243, 0.22256563, 0.22595738,
0.29136851, 0.21850961, 0.23630975],
[0.19140938, 0.07427525, 0.2276503 , 0.15315049, 0.1928711 ,
0.27207752, 0.21743917, 0.22262814],
[0.19072601, 0.1444192 , 0.30445195, 0.1443563 , 0.23604139,
0.24761041, 0.1656572 , 0.215988  ]],

[[0.17446459, 0.19700656, 0.24150087, 0.27760638, 0.17312918,
0.2527794 , 0.19126193, 0.27271252],
[0.23498895, 0.20284841, 0.25453111, 0.32283093, 0.18557648,
0.21286825, 0.20851838, 0.25261218],
[0.23150061, 0.1131887 , 0.26705274, 0.24327495, 0.19787092,
0.23769577, 0.25602541, 0.19494017],
[0.23073268, 0.16719355, 0.30444324, 0.24419536, 0.23438742,
0.17442383, 0.24823022, 0.26327588],
[0.23118049, 0.15851767, 0.25340653, 0.32766001, 0.22044029,
0.19871019, 0.1848886 , 0.27071804],
[0.22172016, 0.20498686, 0.29730043, 0.27875127, 0.19842288,
0.20510694, 0.22346225, 0.1985373 ],
[0.245215  , 0.151424  , 0.33664438, 0.25779499, 0.17404007,
0.17441316, 0.26512856, 0.22883479],
[0.18546056, 0.1970587 , 0.28765568, 0.28841497, 0.22223773,
0.21658546, 0.2664435 , 0.23288513],
[0.16941476, 0.13529595, 0.24487913, 0.27184341, 0.21282758,
0.24866159, 0.25380514, 0.22041514],
[0.21130474, 0.16627758, 0.30218908, 0.30078348, 0.17572626,
0.24912792, 0.23673059, 0.19760159]],

[[0.17787986, 0.14836966, 0.26857008, 0.33296219, 0.3054913 ,
0.15178021, 0.28446777, 0.22859955],
[0.13691279, 0.08178841, 0.28543644, 0.25860046, 0.2981164 ,
0.11337396, 0.31938349, 0.16835839],
[0.15598573, 0.13124081, 0.27700754, 0.27581769, 0.3042954 ,
0.1080089 , 0.27616517, 0.16803819],
[0.17987912, 0.08724426, 0.27006559, 0.29883428, 0.25843817,
0.08986573, 0.26277525, 0.22514512],
[0.1306872 , 0.14701714, 0.3092107 , 0.30511153, 0.21081129,
0.15538056, 0.32063705, 0.1733711 ],
[0.12916157, 0.07937647, 0.29040676, 0.32695024, 0.29943325,
0.05936479, 0.33148639, 0.15238106],
[0.19836278, 0.16948865, 0.31062824, 0.34472388, 0.22569252,
0.09340941, 0.34499903, 0.17873801],
[0.14217762, 0.11926862, 0.29591121, 0.2563566 , 0.26184432,
0.13986313, 0.25450008, 0.1939654 ],
[0.22611781, 0.12419874, 0.25064824, 0.28406016, 0.29879834,
0.08965598, 0.29931852, 0.19970588],
[0.13010286, 0.0944411 , 0.30442741, 0.30200632, 0.30301242,
0.15302657, 0.28820269, 0.17025367]],

[[0.16790342, 0.26559325, 0.09578332, 0.1384534 , 0.10352752,
0.33625445, 0.14756126, 0.09944141],
[0.19850746, 0.32294565, 0.17637504, 0.14517658, 0.10404784,
0.31108163, 0.12168524, 0.109143  ],
[0.12095217, 0.30683033, 0.09376865, 0.11225919, 0.16952319,
0.35806856, 0.08534946, 0.04534505],
[0.12914549, 0.34048898, 0.1405052 , 0.17587391, 0.17174908,
0.35901306, 0.11548703, 0.11245166],
[0.15713461, 0.26940474, 0.1355091 , 0.14246194, 0.1233379 ,
0.31990228, 0.09552316, 0.07793888],
[0.18232423, 0.34170153, 0.1093786 , 0.13416557, 0.18658227,
0.37228804, 0.15656195, 0.04516702],
[0.10877543, 0.32429256, 0.16885407, 0.16328396, 0.13835888,
0.34367515, 0.14772249, 0.09337467],
[0.11175699, 0.28818726, 0.11859238, 0.14915646, 0.18465549,
0.31031134, 0.17057422, 0.13178728],
[0.13835569, 0.27414977, 0.09110212, 0.20277056, 0.17878692,
0.30979969, 0.16968731, 0.1220929 ],
[0.19080481, 0.32513237, 0.12283334, 0.10625419, 0.19332843,
0.28321217, 0.1388812 , 0.10656268]],

[[0.24487494, 0.22926915, 0.14996355, 0.24502912, 0.25036084,
0.09624818, 0.08270539, 0.24661525],
[0.24098527, 0.21603434, 0.12841328, 0.2061095 , 0.23472511,
0.11095723, 0.1399834 , 0.27276014],
[0.22634203, 0.21725332, 0.11789855, 0.20681507, 0.16797908,
0.15455362, 0.13526812, 0.25611855],
[0.25179804, 0.19963238, 0.08207138, 0.20798306, 0.21599281,
0.13092948, 0.11359618, 0.22868106],
[0.21048092, 0.15209115, 0.07768627, 0.19841933, 0.23651151,
0.12276094, 0.15982134, 0.23222903],
[0.24363776, 0.17696944, 0.09282648, 0.21532249, 0.2077663 ,
0.16731572, 0.08298775, 0.21627866],
[0.26191875, 0.21345795, 0.12930635, 0.20031393, 0.25777262,
0.08857851, 0.14894621, 0.27251848],
[0.27112747, 0.19049768, 0.15066837, 0.18765226, 0.24109526,
0.09202483, 0.12614204, 0.2746818 ],
[0.24655784, 0.23376173, 0.12263029, 0.19853208, 0.17529616,
0.13766298, 0.15579392, 0.2592124 ],
[0.21593478, 0.1985557 , 0.06529558, 0.23505617, 0.2586701 ,
0.11887756, 0.10672546, 0.28310867]],

[[0.13546075, 0.21177116, 0.18097495, 0.28335959, 0.246092  ,
0.23938562, 0.21841687, 0.13371835],
[0.15773383, 0.17073648, 0.21949886, 0.2319246 , 0.23831314,
0.30636939, 0.1657013 , 0.1502996 ],
[0.15295323, 0.21931884, 0.23814131, 0.30896259, 0.17871576,
0.29243144, 0.21545808, 0.17280314],
[0.07740517, 0.18570131, 0.25631015, 0.25610385, 0.24330604,
0.29281625, 0.19061986, 0.12859244],
[0.08065606, 0.17032819, 0.23898132, 0.2597297 , 0.22821715,
0.25206033, 0.19939583, 0.17596318],
[0.09876719, 0.18142937, 0.25758094, 0.31759099, 0.15976691,
0.27043693, 0.21473406, 0.11539436],
[0.1062407 , 0.22570043, 0.2508131 , 0.24152631, 0.21300072,
0.21895164, 0.1841227 , 0.1585137 ],
[0.11407439, 0.1850458 , 0.26405553, 0.29562141, 0.19324622,
0.28125605, 0.17825539, 0.10910162],
[0.13143708, 0.25801795, 0.26027793, 0.28619327, 0.20387125,
0.29550773, 0.17165018, 0.14219321],
[0.08415036, 0.2026262 , 0.19029874, 0.25816359, 0.18039161,
0.29121309, 0.17562064, 0.1672997 ]]])
• bob
(x, z)
float64
1.1, 1.2, ..., 8.7, 8.8
σ = 0.22, 0.3, ..., 0.31, 0.21
Values:array([[1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8],
[2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8],
[3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8],
[4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8],
[5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8],
[6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8],
[7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8],
[8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8]])Variances (σ²):array([[0.05037877, 0.09247093, 0.05387947, 0.04058386, 0.06378661,
0.0086305 , 0.05223879, 0.02351903],
[0.04242474, 0.00050031, 0.01351683, 0.00975447, 0.03302091,
0.07919148, 0.05392051, 0.06757294],
[0.03105401, 0.09113896, 0.09416773, 0.09207814, 0.07902188,
0.03382482, 0.01480256, 0.04314213],
[0.06941926, 0.08119641, 0.02715996, 0.09890429, 0.092456  ,
0.03769801, 0.06793582, 0.07270839],
[0.09369024, 0.04861367, 0.08889728, 0.06205336, 0.05967507,
0.00872669, 0.06267435, 0.06854531],
[0.00057827, 0.08897441, 0.07851432, 0.06037546, 0.02624816,
0.0867688 , 0.00209828, 0.07878133],
[0.07548409, 0.06810872, 0.05723724, 0.05567111, 0.08875519,
0.0001808 , 0.03286223, 0.05769091],
[0.01428348, 0.08723245, 0.07545137, 0.09522267, 0.05876783,
0.01941469, 0.09641863, 0.04411309]])

Note the important call to copy(). If we omit it, d will just be a multi-dimensional slice of the larger volume (which is kept alive), wasting memory and preventing further modification, such as insertion of other variables.

Note also that if we had also sliced 'y' the result would not contain the data for 'bob' since this item does not depend on Y.

## More advanced operations with multi-dimensional datasets¶

Operations like concatenate and merge work just like with one-dimensional datasets.

### Exercise 2¶

• Try to concatenate the dataset with itself along the X dimensions. Why does this fail?

• Make a copy of the dataset, add an offset to the X coordinate to fix the issue, and try to concatenate again.

### Solution 2¶

[10]:

try:
d = sc.concatenate(d, d, 'x')
except RuntimeError:
print("Failed as expected!")

Failed as expected!


With a data extent of, e.g. 8 in this case, bin edges have extent 9. Naive concatenation would thus lead a new data extent of 16 and a coordinate extent of 18, which is meaningless and thus prevented. In this concatenate merges the last edge of the first input with the first edge of the second input, if compatible.

[11]:

offset = d.copy()
offset.coords['x'] += sc.scalar(8.0, unit=sc.units.m)
combined = sc.concatenate(d, offset, 'x')
sc.plot(combined['alice'])


Another available operation is rebin. This is only for count-data or count-density-data, so we have to set an appropriate unit first:

[12]:

d['alice'].unit = sc.units.counts
d['bob'].unit = sc.units.counts


Before rebin we have the following:

[13]:

sc.to_html(d)
sc.plot(d['z', 0])

scipp.Dataset (11.23 KB)
• z: 8
• y: 10
• x: 8
• x
(x [bin-edge])
float64
m
1.0, 2.0, ..., 8.0, 9.0
Values:array([1., 2., 3., 4., 5., 6., 7., 8., 9.])
• y
(y [bin-edge])
float64
m
0.0, 1.0, ..., 9.0, 10.0
Values:array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
• z
(z [bin-edge])
float64
m
1.0, 2.0, ..., 8.0, 9.0
Values:array([1., 2., 3., 4., 5., 6., 7., 8., 9.])
• alice
(z, y, x)
float64
counts
0.27, 0.61, ..., -0.11, 0.16
σ = 0.44, 0.45, ..., 0.42, 0.41
Values:array([[[ 2.73782270e-01,  6.14348766e-01, -1.38782351e-01,
1.37491980e-01,  3.66371192e-01, -6.87604284e-01,
4.99821872e-01, -4.72803666e-01],
[-1.91553794e-01,  5.22337662e-01, -2.04578007e-01,
-5.77348257e-01,  5.78841428e-02, -6.98323527e-01,
3.92362492e-01,  2.68802815e-01],
[ 9.55692366e-03,  2.29830109e-01, -1.65134199e-01,
-3.75109077e-01,  2.62842296e-01, -7.28076120e-02,
-2.07641233e-02, -1.31689531e-01],
[ 7.92365510e-02,  8.01873122e-01, -1.61088851e-01,
-2.67466774e-01,  7.78115533e-02, -6.68131560e-01,
1.75439796e-01, -5.50308276e-01],
[ 2.37352039e-01,  6.63202484e-01,  3.61726196e-02,
-5.95010870e-01,  4.66269610e-01, -4.59833406e-01,
-7.19605945e-02, -5.24911918e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-8.93306061e-03,  7.74541663e-01,  1.44802070e-03,
2.12717027e-01,  6.20475743e-01, -3.11186451e-01,
-3.90807358e-01, -4.43802019e-01],
[ 6.41308796e-01,  1.13929780e-03, -1.27344967e-01,
3.03980535e-01, -6.15489242e-02, -8.07662853e-01,
2.44434450e-01, -2.29677388e-01],
[-8.55388776e-02,  5.11648138e-01, -1.24979306e-01,
-2.25736838e-01,  1.79084503e-01, -7.84188987e-01,
3.02177860e-01, -1.90375314e-01],
[ 5.64392967e-01,  8.01737928e-01,  4.38653456e-01,
-3.47550946e-01,  4.33330028e-01, -1.52592392e-01,
-3.94979178e-01,  5.71662379e-02]],

[[-1.43608396e-01, -5.42468465e-01,  9.98735573e-02,
1.06952060e-01,  5.12079836e-01, -4.27504814e-01,
-1.62807801e-01, -3.07515883e-01],
[ 6.57556150e-01, -4.92137597e-01,  3.92896803e-04,
-2.02623863e-01, -1.41731560e-01, -4.44541357e-01,
-1.36004713e-01,  5.45522499e-02],
[ 2.51261925e-01,  4.91094261e-02, -4.27219033e-01,
-7.40586734e-01, -3.85959594e-01, -2.79067259e-02,
2.34813917e-01, -7.57797122e-01],
[ 3.63321696e-01,  2.95106616e-01, -3.95736092e-01,
-5.13519607e-01,  2.24174193e-01,  6.55389758e-02,
4.91169572e-01, -2.21943225e-02],
[ 4.76181483e-01,  2.84086651e-01, -1.33010483e-01,
-7.07086964e-01,  1.85219989e-01,  1.00482439e-01,
1.00704416e-01,  1.50953971e-02],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-2.57580107e-01,  1.56834851e-01, -5.76960414e-01,
1.14936369e-01,  1.85279077e-01, -5.39027106e-01,
2.89940114e-01, -9.22384014e-01],
[ 6.25539987e-01, -5.58940647e-01, -7.44332839e-01,
2.42619050e-02, -3.96711057e-02, -5.88526212e-01,
-2.86044526e-01, -4.41561098e-01],
[ 4.95743587e-01,  2.77614366e-01, -7.14301777e-01,
-4.55987367e-01, -1.11673773e-01, -6.91161614e-02,
2.76997613e-01, -9.20441868e-01],
[ 3.37201225e-01, -2.91991428e-01, -3.86016766e-01,
-3.84096946e-01,  3.17037857e-01, -9.05247575e-02,
3.47550963e-01, -1.19299476e-01]],

[[ 1.97364009e-01, -5.56344298e-01,  2.20437838e-01,
-6.99527519e-02,  2.04942392e-01, -4.22026455e-01,
2.92425605e-01, -1.05172159e-01],
[ 4.55001522e-01, -3.04549984e-01,  7.51329655e-02,
1.51106436e-02,  3.47858041e-01, -7.50587900e-02,
5.00588249e-01, -6.47924987e-02],
[ 7.18890201e-01, -6.69778371e-01,  2.50234459e-01,
-4.36827157e-01,  1.82989388e-01, -4.59423134e-01,
-8.97884321e-03, -6.61484616e-01],
[ 6.64770018e-01, -1.86952553e-01,  3.32789373e-01,
-2.59009528e-01,  4.94740898e-01, -3.87334508e-01,
8.71891674e-01, -5.51879459e-01],
[-1.20744130e-01, -1.59250356e-01,  5.66304680e-01,
3.03390643e-01,  3.79971946e-01,  5.34073909e-02,
4.86801063e-01, -3.69560550e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[ 2.54237389e-01, -2.31552179e-01,  6.88459749e-01,
-4.95235329e-01,  5.21277398e-01, -5.04053934e-01,
6.78997263e-01, -4.59844748e-01],
[-4.87459706e-02, -8.44537912e-01,  2.92245205e-01,
-4.20752669e-01, -1.14505636e-01, -5.19776316e-02,
-5.99556660e-02, -2.21375434e-01],
[ 6.31143559e-01, -3.90136604e-01,  6.27165311e-01,
-1.89142629e-01,  1.65038714e-01,  1.32594788e-01,
6.11078141e-01, -2.28305031e-01],
[ 5.93380731e-01, -5.89135608e-01,  3.77921682e-01,
7.80330033e-02,  3.30870331e-01, -4.07818448e-01,
8.62061791e-01, -7.07023106e-01]],

[[-5.09476010e-01,  3.99847670e-01, -4.12955988e-01,
7.15674126e-01, -6.61608237e-01,  3.26642168e-01,
-4.88003586e-01, -6.54539693e-01],
[-8.18824411e-01, -3.40995712e-01, -5.63626924e-01,
8.89205880e-01,  6.84255171e-02, -3.91986622e-01,
-4.79496615e-01, -3.87929367e-01],
[-4.30967877e-01, -4.10472134e-01, -3.00316054e-01,
6.40868454e-01,  3.29054883e-01, -5.28613226e-01,
-1.52643267e-01, -8.94916965e-01],
[-7.51422866e-01,  3.81865942e-01, -1.89069584e-01,
8.97322488e-01,  2.31645191e-01,  6.74773169e-02,
3.37431240e-01, -1.73990086e-01],
[-7.02654155e-01,  3.95050274e-01, -9.24426398e-01,
4.94828020e-01, -3.76823312e-01, -4.26946508e-01,
-2.46023578e-01, -2.02134859e-02],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-7.24872245e-01,  2.81539627e-01, -2.52003605e-01,
-1.90775792e-02, -6.20152762e-01, -7.86337672e-02,
-2.48649556e-01, -7.16341597e-01],
[-4.98489558e-01,  7.96970920e-02, -6.46296817e-02,
1.97099452e-01,  3.73073413e-02,  1.62039243e-01,
-5.03251302e-01, -1.24759125e-03],
[-6.70868633e-01, -3.83695116e-01, -7.85523762e-01,
4.55699015e-01,  3.03943856e-01,  1.79206349e-02,
-5.37083226e-01, -2.43813186e-01],
[-5.62040754e-01, -1.36202347e-01, -4.96502744e-01,
2.95498428e-01, -5.20906300e-02,  5.12597238e-02,
2.67553734e-01, -4.12688373e-01]],

[[-6.36386611e-01,  6.97001503e-01,  2.31423488e-02,
-4.90767536e-01,  6.90968199e-01,  6.44544352e-01,
2.95451458e-01,  3.77988096e-01],
[-3.43947897e-01,  6.33716470e-01, -1.50468784e-01,
-5.29987423e-01,  6.95946517e-01,  6.13803236e-01,
-1.80500561e-01,  5.01249087e-01],
[-6.01300811e-01, -1.61037042e-03, -2.54157018e-01,
-3.27226306e-01,  1.63212303e-01,  4.13847013e-01,
-3.27206640e-01,  3.18690780e-03],
[-6.17369071e-01,  2.50368445e-01, -3.00713223e-01,
-2.45215148e-01,  5.09082154e-01,  1.23556607e-01,
3.05401779e-02, -1.36980509e-01],
[-7.84431760e-01,  6.79722192e-01, -5.47292470e-01,
1.92473006e-01,  4.40012568e-01,  2.19006021e-01,
2.32286434e-02,  2.84849033e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-8.64085271e-01,  2.78445664e-01, -4.56377453e-03,
2.13683246e-01,  5.14553449e-01,  4.27322796e-01,
1.84324555e-01, -1.97120232e-01],
[-8.32512068e-01,  5.93438418e-01, -2.89097577e-01,
-6.97802920e-01,  8.54044588e-02,  8.49486123e-02,
-5.41434220e-01,  4.03989144e-01],
[-6.33767757e-01,  2.72138338e-01, -8.16584696e-01,
-6.02636832e-01,  4.78343589e-01,  5.73780405e-01,
-1.48139326e-01, -3.22509706e-01],
[-4.08891687e-01,  3.99458576e-01, -7.96164307e-01,
-4.63592121e-01,  2.30772475e-01,  5.68277994e-02,
2.70107437e-01, -3.91978741e-01]],

[[ 1.35674657e-01, -1.73792135e-02, -1.13401460e-01,
2.74927955e-01, -8.49895118e-02,  8.58902573e-01,
-3.69979642e-01,  6.09404852e-01],
[-2.98976639e-01, -4.68246596e-01, -6.14643104e-01,
1.22961257e-01,  1.71382772e-02,  7.97195321e-01,
-3.38029991e-01,  3.38449449e-01],
[-1.51052704e-01, -1.53340124e-01, -6.20664592e-01,
3.12563987e-01, -2.76704992e-01,  5.20487709e-01,
-8.51273737e-01, -9.13673707e-02],
[-2.21758889e-01,  2.95652458e-01, -4.78161151e-01,
9.09541881e-03, -4.91129748e-01,  9.81183386e-01,
-6.20057511e-01, -1.26772727e-01],
[-7.70238411e-01, -3.18450460e-01, -6.52956336e-01,
4.86702948e-02, -7.05677320e-01,  2.09363514e-01,
-3.86737979e-01,  4.25424836e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-1.12755645e-01, -3.41679776e-01, -6.99007743e-01,
-3.15168539e-02,  7.95787867e-02,  9.11142927e-02,
-3.39276233e-01,  3.89512699e-01],
[-4.97178865e-01, -2.36876696e-01, -6.06315091e-01,
2.93760078e-01, -1.47771454e-01,  5.86210723e-01,
6.75466814e-03,  7.98300973e-02],
[-5.19469604e-01, -2.36798835e-01,  1.41185901e-01,
1.37367846e-01, -1.75460873e-01,  9.06284034e-02,
-1.33567699e-01, -1.82867537e-01],
[ 1.26496985e-01, -2.22396326e-01, -6.03778647e-01,
4.90346190e-01, -4.57670334e-02,  3.68901291e-01,
-3.35218842e-01,  5.14809044e-01]],

[[-2.08778243e-01,  3.86083085e-01,  5.04055336e-01,
-1.91149117e-01,  2.67008878e-01,  1.48084554e-01,
3.72519663e-01, -4.45114995e-04],
[-5.29972685e-01,  3.22103548e-01, -1.56405056e-01,
6.15021734e-01,  4.13294487e-01,  8.08975151e-01,
7.07683682e-01,  8.68937648e-02],
[-4.61925349e-01,  9.91355659e-02, -3.63675213e-01,
4.01962293e-01,  1.06070832e-02,  1.34061704e-01,
3.75190729e-01,  3.22259777e-01],
[-5.81091025e-01,  8.57577607e-03, -1.74119728e-02,
-1.20757470e-01,  1.08466432e-01,  1.87725694e-02,
-3.46326290e-02, -9.83046195e-02],
[-1.03103089e-01,  5.54979256e-02, -1.56190290e-01,
7.13265435e-01,  6.75165742e-02,  3.93502021e-01,
9.02108394e-01, -1.68264317e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[-4.53974534e-01, -8.09482899e-02, -4.14042640e-02,
3.22927511e-01, -2.65528350e-01,  2.35793879e-01,
6.88782796e-01, -3.98489946e-01],
[ 3.00612361e-01,  7.21131044e-01, -7.73108903e-02,
9.41697444e-02, -1.31601812e-01,  5.06195461e-01,
1.03344563e-02, -1.83650061e-02],
[ 3.52189999e-01,  3.10305703e-01, -1.48403605e-01,
3.94019100e-02, -6.72628482e-02, -3.88116763e-02,
5.35390934e-01,  1.02625984e-02],
[ 2.48732347e-01,  6.11139096e-01,  3.56470284e-01,
1.86255379e-01, -4.49759911e-01,  1.67210423e-02,
7.76853237e-01,  2.20346669e-01]],

[[ 3.32823189e-01, -7.83403404e-01,  2.14563435e-02,
-1.09284848e-01,  8.28271879e-03, -1.89468315e-02,
-3.77458674e-01,  1.26372726e-01],
[ 2.61444281e-01, -6.35016977e-02,  3.29945049e-01,
2.23495615e-01, -4.39294118e-01,  7.81778749e-01,
-4.69043771e-01,  2.20301185e-01],
[ 3.61245695e-01, -7.51556105e-01,  8.47139473e-01,
-2.61482397e-01,  2.81992639e-01,  8.19280277e-01,
2.09725837e-01,  5.16169528e-01],
[-7.39793333e-02, -4.60677853e-01,  1.49167342e-01,
-5.45314327e-02, -1.25484243e-02,  5.25947578e-01,
-6.55419415e-02,  3.21251191e-01],
[ 2.35282352e-01, -5.89429671e-02,  3.73396671e-01,
2.82905411e-01, -4.57268714e-01,  1.96680267e-02,
3.09550238e-01,  4.29339080e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00,  0.00000000e+00],
[ 4.89903052e-01, -3.26249203e-01,  6.06100784e-01,
3.75439473e-01,  8.36405453e-02,  3.99497478e-01,
1.98155969e-01,  7.55096761e-01],
[-2.49668591e-02, -2.63315295e-01,  2.47717332e-01,
1.03776450e-01,  2.68849618e-01, -1.45965766e-01,
-4.49985010e-01,  2.20831347e-01],
[ 8.56473086e-02,  2.63839454e-02,  1.26304766e-01,
2.47978412e-01, -1.10245549e-01,  4.37930613e-01,
-5.64424539e-02,  6.94742287e-03],
[ 4.56399847e-01, -6.23620462e-01,  2.74528561e-01,
-1.73609702e-01,  7.55940525e-02,  2.29738425e-01,
-1.09766071e-01,  1.61498679e-01]]])Variances (σ²):array([[[0.19188634, 0.20598272, 0.16895745, 0.1539002 , 0.2791979 ,
0.10785508, 0.25002353, 0.13239592],
[0.19744499, 0.20047573, 0.15780919, 0.2173773 , 0.33336846,
0.1419317 , 0.24026499, 0.08012556],
[0.12118947, 0.12882987, 0.10998823, 0.18487285, 0.24604924,
0.12346017, 0.17215554, 0.09015553],
[0.17002682, 0.16671443, 0.10318334, 0.2427618 , 0.27800766,
0.16611741, 0.17178389, 0.11537865],
[0.16507247, 0.17341866, 0.10936307, 0.23484405, 0.31765248,
0.19525476, 0.21316516, 0.13132737],
[0.12269236, 0.13299738, 0.12608618, 0.16649726, 0.30176743,
0.19315369, 0.17523878, 0.04841813],
[0.21110552, 0.12373249, 0.14695408, 0.23540771, 0.31976898,
0.14807036, 0.18002197, 0.11984542],
[0.14839467, 0.15974404, 0.13944435, 0.23224191, 0.33374744,
0.11209318, 0.19816299, 0.07794084],
[0.1172094 , 0.17713096, 0.1184634 , 0.22325931, 0.29716557,
0.12125195, 0.19404995, 0.07470003],
[0.16343665, 0.15476861, 0.11473554, 0.22040036, 0.29908272,
0.13061691, 0.17818863, 0.06872043]],

[[0.2530018 , 0.07737781, 0.22038431, 0.26200225, 0.15194895,
0.25017267, 0.22833105, 0.29862126],
[0.25537726, 0.1095732 , 0.27181948, 0.19494369, 0.13563817,
0.24415453, 0.22199169, 0.23526325],
[0.33275572, 0.05931259, 0.28870334, 0.22152554, 0.15680701,
0.28833649, 0.21796993, 0.23545336],
[0.33740875, 0.09739075, 0.3070476 , 0.25095269, 0.22475532,
0.2547037 , 0.19510307, 0.24934799],
[0.25780211, 0.07063069, 0.23181902, 0.25733982, 0.16827402,
0.30715568, 0.18994578, 0.23180139],
[0.31226291, 0.11065108, 0.24884617, 0.18630366, 0.16473734,
0.26788134, 0.20442996, 0.26713556],
[0.31764239, 0.07481417, 0.24831926, 0.25783863, 0.20271204,
0.3072918 , 0.25150921, 0.23879198],
[0.27271722, 0.10366427, 0.31283755, 0.27051964, 0.17852544,
0.31880961, 0.26892827, 0.27559183],
[0.33244242, 0.07642424, 0.24461309, 0.22658416, 0.15250579,
0.30633903, 0.19907098, 0.30269132],
[0.31775877, 0.09204518, 0.23716113, 0.19387104, 0.23084913,
0.31690982, 0.21680949, 0.25920081]],

[[0.14186494, 0.0534135 , 0.23332246, 0.17992431, 0.26293578,
0.22971953, 0.23415433, 0.25024144],
[0.13172497, 0.07004482, 0.24690738, 0.20316831, 0.1813727 ,
0.23640088, 0.1615023 , 0.24505816],
[0.21146239, 0.07311147, 0.22582991, 0.23054583, 0.19066684,
0.2884372 , 0.18637579, 0.23698841],
[0.14390762, 0.11146208, 0.24479223, 0.17062891, 0.23982409,
0.22633214, 0.21262964, 0.27329498],
[0.140144  , 0.14765089, 0.25601247, 0.15411077, 0.26556404,
0.2300284 , 0.20023465, 0.27720078],
[0.1465522 , 0.0725423 , 0.23325861, 0.21661206, 0.1821771 ,
0.25987053, 0.18150172, 0.21711071],
[0.18871164, 0.13001054, 0.23455088, 0.19619602, 0.26561116,
0.2691233 , 0.20348331, 0.27835313],
[0.17156864, 0.07877527, 0.22989243, 0.22256563, 0.22595738,
0.29136851, 0.21850961, 0.23630975],
[0.19140938, 0.07427525, 0.2276503 , 0.15315049, 0.1928711 ,
0.27207752, 0.21743917, 0.22262814],
[0.19072601, 0.1444192 , 0.30445195, 0.1443563 , 0.23604139,
0.24761041, 0.1656572 , 0.215988  ]],

[[0.17446459, 0.19700656, 0.24150087, 0.27760638, 0.17312918,
0.2527794 , 0.19126193, 0.27271252],
[0.23498895, 0.20284841, 0.25453111, 0.32283093, 0.18557648,
0.21286825, 0.20851838, 0.25261218],
[0.23150061, 0.1131887 , 0.26705274, 0.24327495, 0.19787092,
0.23769577, 0.25602541, 0.19494017],
[0.23073268, 0.16719355, 0.30444324, 0.24419536, 0.23438742,
0.17442383, 0.24823022, 0.26327588],
[0.23118049, 0.15851767, 0.25340653, 0.32766001, 0.22044029,
0.19871019, 0.1848886 , 0.27071804],
[0.22172016, 0.20498686, 0.29730043, 0.27875127, 0.19842288,
0.20510694, 0.22346225, 0.1985373 ],
[0.245215  , 0.151424  , 0.33664438, 0.25779499, 0.17404007,
0.17441316, 0.26512856, 0.22883479],
[0.18546056, 0.1970587 , 0.28765568, 0.28841497, 0.22223773,
0.21658546, 0.2664435 , 0.23288513],
[0.16941476, 0.13529595, 0.24487913, 0.27184341, 0.21282758,
0.24866159, 0.25380514, 0.22041514],
[0.21130474, 0.16627758, 0.30218908, 0.30078348, 0.17572626,
0.24912792, 0.23673059, 0.19760159]],

[[0.17787986, 0.14836966, 0.26857008, 0.33296219, 0.3054913 ,
0.15178021, 0.28446777, 0.22859955],
[0.13691279, 0.08178841, 0.28543644, 0.25860046, 0.2981164 ,
0.11337396, 0.31938349, 0.16835839],
[0.15598573, 0.13124081, 0.27700754, 0.27581769, 0.3042954 ,
0.1080089 , 0.27616517, 0.16803819],
[0.17987912, 0.08724426, 0.27006559, 0.29883428, 0.25843817,
0.08986573, 0.26277525, 0.22514512],
[0.1306872 , 0.14701714, 0.3092107 , 0.30511153, 0.21081129,
0.15538056, 0.32063705, 0.1733711 ],
[0.12916157, 0.07937647, 0.29040676, 0.32695024, 0.29943325,
0.05936479, 0.33148639, 0.15238106],
[0.19836278, 0.16948865, 0.31062824, 0.34472388, 0.22569252,
0.09340941, 0.34499903, 0.17873801],
[0.14217762, 0.11926862, 0.29591121, 0.2563566 , 0.26184432,
0.13986313, 0.25450008, 0.1939654 ],
[0.22611781, 0.12419874, 0.25064824, 0.28406016, 0.29879834,
0.08965598, 0.29931852, 0.19970588],
[0.13010286, 0.0944411 , 0.30442741, 0.30200632, 0.30301242,
0.15302657, 0.28820269, 0.17025367]],

[[0.16790342, 0.26559325, 0.09578332, 0.1384534 , 0.10352752,
0.33625445, 0.14756126, 0.09944141],
[0.19850746, 0.32294565, 0.17637504, 0.14517658, 0.10404784,
0.31108163, 0.12168524, 0.109143  ],
[0.12095217, 0.30683033, 0.09376865, 0.11225919, 0.16952319,
0.35806856, 0.08534946, 0.04534505],
[0.12914549, 0.34048898, 0.1405052 , 0.17587391, 0.17174908,
0.35901306, 0.11548703, 0.11245166],
[0.15713461, 0.26940474, 0.1355091 , 0.14246194, 0.1233379 ,
0.31990228, 0.09552316, 0.07793888],
[0.18232423, 0.34170153, 0.1093786 , 0.13416557, 0.18658227,
0.37228804, 0.15656195, 0.04516702],
[0.10877543, 0.32429256, 0.16885407, 0.16328396, 0.13835888,
0.34367515, 0.14772249, 0.09337467],
[0.11175699, 0.28818726, 0.11859238, 0.14915646, 0.18465549,
0.31031134, 0.17057422, 0.13178728],
[0.13835569, 0.27414977, 0.09110212, 0.20277056, 0.17878692,
0.30979969, 0.16968731, 0.1220929 ],
[0.19080481, 0.32513237, 0.12283334, 0.10625419, 0.19332843,
0.28321217, 0.1388812 , 0.10656268]],

[[0.24487494, 0.22926915, 0.14996355, 0.24502912, 0.25036084,
0.09624818, 0.08270539, 0.24661525],
[0.24098527, 0.21603434, 0.12841328, 0.2061095 , 0.23472511,
0.11095723, 0.1399834 , 0.27276014],
[0.22634203, 0.21725332, 0.11789855, 0.20681507, 0.16797908,
0.15455362, 0.13526812, 0.25611855],
[0.25179804, 0.19963238, 0.08207138, 0.20798306, 0.21599281,
0.13092948, 0.11359618, 0.22868106],
[0.21048092, 0.15209115, 0.07768627, 0.19841933, 0.23651151,
0.12276094, 0.15982134, 0.23222903],
[0.24363776, 0.17696944, 0.09282648, 0.21532249, 0.2077663 ,
0.16731572, 0.08298775, 0.21627866],
[0.26191875, 0.21345795, 0.12930635, 0.20031393, 0.25777262,
0.08857851, 0.14894621, 0.27251848],
[0.27112747, 0.19049768, 0.15066837, 0.18765226, 0.24109526,
0.09202483, 0.12614204, 0.2746818 ],
[0.24655784, 0.23376173, 0.12263029, 0.19853208, 0.17529616,
0.13766298, 0.15579392, 0.2592124 ],
[0.21593478, 0.1985557 , 0.06529558, 0.23505617, 0.2586701 ,
0.11887756, 0.10672546, 0.28310867]],

[[0.13546075, 0.21177116, 0.18097495, 0.28335959, 0.246092  ,
0.23938562, 0.21841687, 0.13371835],
[0.15773383, 0.17073648, 0.21949886, 0.2319246 , 0.23831314,
0.30636939, 0.1657013 , 0.1502996 ],
[0.15295323, 0.21931884, 0.23814131, 0.30896259, 0.17871576,
0.29243144, 0.21545808, 0.17280314],
[0.07740517, 0.18570131, 0.25631015, 0.25610385, 0.24330604,
0.29281625, 0.19061986, 0.12859244],
[0.08065606, 0.17032819, 0.23898132, 0.2597297 , 0.22821715,
0.25206033, 0.19939583, 0.17596318],
[0.09876719, 0.18142937, 0.25758094, 0.31759099, 0.15976691,
0.27043693, 0.21473406, 0.11539436],
[0.1062407 , 0.22570043, 0.2508131 , 0.24152631, 0.21300072,
0.21895164, 0.1841227 , 0.1585137 ],
[0.11407439, 0.1850458 , 0.26405553, 0.29562141, 0.19324622,
0.28125605, 0.17825539, 0.10910162],
[0.13143708, 0.25801795, 0.26027793, 0.28619327, 0.20387125,
0.29550773, 0.17165018, 0.14219321],
[0.08415036, 0.2026262 , 0.19029874, 0.25816359, 0.18039161,
0.29121309, 0.17562064, 0.1672997 ]]])
• bob
(x, z)
float64
counts
1.1, 1.2, ..., 8.7, 8.8
σ = 0.22, 0.3, ..., 0.31, 0.21
Values:array([[1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8],
[2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8],
[3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8],
[4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8],
[5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8],
[6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8],
[7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8],
[8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8]])Variances (σ²):array([[0.05037877, 0.09247093, 0.05387947, 0.04058386, 0.06378661,
0.0086305 , 0.05223879, 0.02351903],
[0.04242474, 0.00050031, 0.01351683, 0.00975447, 0.03302091,
0.07919148, 0.05392051, 0.06757294],
[0.03105401, 0.09113896, 0.09416773, 0.09207814, 0.07902188,
0.03382482, 0.01480256, 0.04314213],
[0.06941926, 0.08119641, 0.02715996, 0.09890429, 0.092456  ,
0.03769801, 0.06793582, 0.07270839],
[0.09369024, 0.04861367, 0.08889728, 0.06205336, 0.05967507,
0.00872669, 0.06267435, 0.06854531],
[0.00057827, 0.08897441, 0.07851432, 0.06037546, 0.02624816,
0.0867688 , 0.00209828, 0.07878133],
[0.07548409, 0.06810872, 0.05723724, 0.05567111, 0.08875519,
0.0001808 , 0.03286223, 0.05769091],
[0.01428348, 0.08723245, 0.07545137, 0.09522267, 0.05876783,
0.01941469, 0.09641863, 0.04411309]])

We rebin onto a coarser grid, in this case combining two neightboring bins:

[14]:

new_x = sc.array(dims=['x'], unit=sc.units.m, values=d.coords['x'].values[::2])
d = sc.rebin(d, 'x', new_x)


The result looks as follows:

[15]:

sc.to_html(d)
sc.plot(d['z', 0])

scipp.Dataset (5.70 KB)
• z: 8
• y: 10
• x: 4
• x
(x [bin-edge])
float64
m
1.0, 3.0, 5.0, 7.0, 9.0
Values:array([1., 3., 5., 7., 9.])
• y
(y [bin-edge])
float64
m
0.0, 1.0, ..., 9.0, 10.0
Values:array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
• z
(z [bin-edge])
float64
m
1.0, 2.0, ..., 8.0, 9.0
Values:array([1., 2., 3., 4., 5., 6., 7., 8., 9.])
• alice
(z, y, x)
float64
counts
0.89, -0.0, ..., 0.31, 0.05
σ = 0.63, 0.57, ..., 0.69, 0.59
Values:array([[[ 8.88131036e-01, -1.29037090e-03, -3.21233092e-01,
2.70182065e-02],
[ 3.30783868e-01, -7.81926264e-01, -6.40439385e-01,
6.61165306e-01],
[ 2.39387033e-01, -5.40243275e-01,  1.90034684e-01,
-1.52453654e-01],
[ 8.81109673e-01, -4.28555625e-01, -5.90320007e-01,
-3.74868480e-01],
[ 9.00554522e-01, -5.58838250e-01,  6.43620414e-03,
-5.96872512e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[ 7.65608602e-01,  2.14165048e-01,  3.09289292e-01,
-8.34609378e-01],
[ 6.42448094e-01,  1.76635569e-01, -8.69211777e-01,
1.47570617e-02],
[ 4.26109261e-01, -3.50716144e-01, -6.05104484e-01,
1.11802546e-01],
[ 1.36613090e+00,  9.11025104e-02,  2.80737636e-01,
-3.37812940e-01]],

[[-6.86076862e-01,  2.06825618e-01,  8.45750216e-02,
-4.70323684e-01],
[ 1.65418553e-01, -2.02230966e-01, -5.86272916e-01,
-8.14524628e-02],
[ 3.00371351e-01, -1.16780577e+00, -4.13866319e-01,
-5.22983205e-01],
[ 6.58428312e-01, -9.09255699e-01,  2.89713168e-01,
4.68975250e-01],
[ 7.60268134e-01, -8.40097447e-01,  2.85702428e-01,
1.15799813e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-1.00745256e-01, -4.62024045e-01, -3.53748029e-01,
-6.32443899e-01],
[ 6.65993404e-02, -7.20070934e-01, -6.28197318e-01,
-7.27605624e-01],
[ 7.73357953e-01, -1.17028914e+00, -1.80789935e-01,
-6.43444255e-01],
[ 4.52097970e-02, -7.70113711e-01,  2.26513099e-01,
2.28251487e-01]],

[[-3.58980290e-01,  1.50485086e-01, -2.17084063e-01,
1.87253447e-01],
[ 1.50451538e-01,  9.02436091e-02,  2.72799251e-01,
4.35795750e-01],
[ 4.91118304e-02, -1.86592698e-01, -2.76433746e-01,
-6.70463459e-01],
[ 4.77817465e-01,  7.37798449e-02,  1.07406390e-01,
3.20012215e-01],
[-2.79994487e-01,  8.69695323e-01,  4.33379337e-01,
1.17240512e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[ 2.26852099e-02,  1.93224420e-01,  1.72234637e-02,
2.19152515e-01],
[-8.93283883e-01, -1.28507464e-01, -1.66483268e-01,
-2.81331100e-01],
[ 2.41006955e-01,  4.38022682e-01,  2.97633502e-01,
3.82773111e-01],
[ 4.24512292e-03,  4.55954686e-01, -7.69481171e-02,
1.55038684e-01]],

[[-1.09628340e-01,  3.02718138e-01, -3.34966069e-01,
-1.14254328e+00],
[-1.15982012e+00,  3.25578955e-01, -3.23561105e-01,
-8.67425983e-01],
[-8.41440011e-01,  3.40552400e-01, -1.99558344e-01,
-1.04756023e+00],
[-3.69556924e-01,  7.08252904e-01,  2.99122507e-01,
1.63441154e-01],
[-3.07603880e-01, -4.29598378e-01, -8.03769820e-01,
-2.66237064e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-4.43332618e-01, -2.71081184e-01, -6.98786529e-01,
-9.64991153e-01],
[-4.18792466e-01,  1.32469770e-01,  1.99346584e-01,
-5.04498893e-01],
[-1.05456375e+00, -3.29824747e-01,  3.21864491e-01,
-7.80896412e-01],
[-6.98243100e-01, -2.01004317e-01, -8.30906168e-04,
-1.45134640e-01]],

[[ 6.06148926e-02, -4.67625187e-01,  1.33551255e+00,
6.73439554e-01],
[ 2.89768573e-01, -6.80456206e-01,  1.30974975e+00,
3.20748526e-01],
[-6.02911181e-01, -5.81383323e-01,  5.77059316e-01,
-3.24019732e-01],
[-3.67000625e-01, -5.45928371e-01,  6.32638761e-01,
-1.06440331e-01],
[-1.04709568e-01, -3.54819463e-01,  6.59018590e-01,
3.08077676e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-5.85639607e-01,  2.09119471e-01,  9.41876245e-01,
-1.27956774e-02],
[-2.39073651e-01, -9.86900497e-01,  1.70353071e-01,
-1.37445076e-01],
[-3.61629419e-01, -1.41922153e+00,  1.05212399e+00,
-4.70649032e-01],
[-9.43311161e-03, -1.25975643e+00,  2.87600274e-01,
-1.21871303e-01]],

[[ 1.18295443e-01,  1.61526496e-01,  7.73913062e-01,
2.39425209e-01],
[-7.67223235e-01, -4.91681847e-01,  8.14333599e-01,
4.19458094e-04],
[-3.04392828e-01, -3.08100606e-01,  2.43782717e-01,
-9.42641108e-01],
[ 7.38935691e-02, -4.69065732e-01,  4.90053638e-01,
-7.46830238e-01],
[-1.08868887e+00, -6.04286041e-01, -4.96313805e-01,
3.86868567e-02],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-4.54435422e-01, -7.30524597e-01,  1.70693079e-01,
5.02364666e-02],
[-7.34055561e-01, -3.12555014e-01,  4.38439269e-01,
8.65847655e-02],
[-7.56268440e-01,  2.78553747e-01, -8.48324698e-02,
-3.16435236e-01],
[-9.58993412e-02, -1.13432456e-01,  3.23134257e-01,
1.79590202e-01]],

[[ 1.77304842e-01,  3.12906220e-01,  4.15093432e-01,
3.72074548e-01],
[-2.07869137e-01,  4.58616678e-01,  1.22226964e+00,
7.94577447e-01],
[-3.62789784e-01,  3.82870806e-02,  1.44668788e-01,
6.97450506e-01],
[-5.72515249e-01, -1.38169443e-01,  1.27239002e-01,
-1.32937248e-01],
[-4.76051637e-02,  5.57075144e-01,  4.61018595e-01,
7.33844077e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-5.34922824e-01,  2.81523247e-01, -2.97344703e-02,
2.90292850e-01],
[ 1.02174341e+00,  1.68588540e-02,  3.74593650e-01,
-8.03054979e-03],
[ 6.62495702e-01, -1.09001695e-01, -1.06074524e-01,
5.45653532e-01],
[ 8.59871443e-01,  5.42725663e-01, -4.33038869e-01,
9.97199906e-01]],

[[-4.50580215e-01, -8.78285041e-02, -1.06641127e-02,
-2.51085948e-01],
[ 1.97942583e-01,  5.53440665e-01,  3.42484631e-01,
-2.48742586e-01],
[-3.90310410e-01,  5.85657076e-01,  1.10127292e+00,
7.25895365e-01],
[-5.34657186e-01,  9.46359095e-02,  5.13399153e-01,
2.55709250e-01],
[ 1.76339385e-01,  6.56302082e-01, -4.37600687e-01,
7.38889318e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[ 1.63653849e-01,  9.81540257e-01,  4.83138024e-01,
9.53252729e-01],
[-2.88282154e-01,  3.51493782e-01,  1.22883852e-01,
-2.29153663e-01],
[ 1.12031254e-01,  3.74283178e-01,  3.27685065e-01,
-4.94950310e-02],
[-1.67220615e-01,  1.00918859e-01,  3.05332478e-01,
5.17326072e-02]]])Variances (σ²):array([[[0.39786906, 0.32285765, 0.38705298, 0.38241945],
[0.39792073, 0.37518649, 0.47530016, 0.32039055],
[0.25001934, 0.29486108, 0.36950941, 0.26231107],
[0.33674124, 0.34594514, 0.44412507, 0.28716254],
[0.33849114, 0.34420713, 0.51290724, 0.34449253],
[0.25568975, 0.29258344, 0.49492112, 0.2236569 ],
[0.33483802, 0.3823618 , 0.46783934, 0.29986739],
[0.30813871, 0.37168626, 0.44584062, 0.27610383],
[0.29434036, 0.34172271, 0.41841753, 0.26874999],
[0.31820526, 0.3351359 , 0.42969962, 0.24690906]],

[[0.33037961, 0.48238655, 0.40212162, 0.52695231],
[0.36495046, 0.46676318, 0.3797927 , 0.45725494],
[0.39206831, 0.51022887, 0.4451435 , 0.45342329],
[0.4347995 , 0.5580003 , 0.47945902, 0.44445106],
[0.3284328 , 0.48915884, 0.47542971, 0.42174717],
[0.42291399, 0.43514983, 0.43261868, 0.47156552],
[0.39245656, 0.50615789, 0.51000384, 0.49030119],
[0.37638149, 0.58335719, 0.49733505, 0.5445201 ],
[0.40886666, 0.47119725, 0.45884482, 0.5017623 ],
[0.40980395, 0.43103218, 0.54775895, 0.47601029]],

[[0.19527844, 0.41324677, 0.49265531, 0.48439577],
[0.20176979, 0.45007569, 0.41777358, 0.40656046],
[0.28457386, 0.45637574, 0.47910405, 0.4233642 ],
[0.2553697 , 0.41542114, 0.46615623, 0.48592462],
[0.2877949 , 0.41012325, 0.49559244, 0.47743542],
[0.2190945 , 0.44987067, 0.44204763, 0.39861243],
[0.31872219, 0.4307469 , 0.53473446, 0.48183645],
[0.2503439 , 0.45245806, 0.51732589, 0.45481936],
[0.26568463, 0.38080079, 0.46494863, 0.44006731],
[0.33514521, 0.44880824, 0.4836518 , 0.38164521]],

[[0.37147115, 0.51910725, 0.42590858, 0.46397445],
[0.43783736, 0.57736203, 0.39844474, 0.46113057],
[0.34468931, 0.51032769, 0.43556669, 0.45096558],
[0.39792623, 0.54863861, 0.40881125, 0.5115061 ],
[0.38969816, 0.58106654, 0.41915048, 0.45560664],
[0.42670702, 0.5760517 , 0.40352982, 0.42199955],
[0.396639  , 0.59443937, 0.34845324, 0.49396334],
[0.38251926, 0.57607065, 0.43882319, 0.49932863],
[0.30471071, 0.51672253, 0.46148917, 0.47422027],
[0.37758232, 0.60297256, 0.42485418, 0.43433219]],

[[0.32624952, 0.60153227, 0.45727151, 0.51306732],
[0.2187012 , 0.5440369 , 0.41149036, 0.48774188],
[0.28722654, 0.55282523, 0.41230429, 0.44420336],
[0.26712338, 0.56889987, 0.3483039 , 0.48792037],
[0.27770434, 0.61432223, 0.36619184, 0.49400815],
[0.20853804, 0.617357  , 0.35879804, 0.48386745],
[0.36785143, 0.65535212, 0.31910193, 0.52373704],
[0.26144625, 0.55226781, 0.40170744, 0.44846547],
[0.35031655, 0.5347084 , 0.38845432, 0.4990244 ],
[0.22454396, 0.60643373, 0.45603899, 0.45845636]],

[[0.43349667, 0.23423672, 0.43978197, 0.24700267],
[0.52145311, 0.32155162, 0.41512948, 0.23082823],
[0.42778249, 0.20602784, 0.52759175, 0.13069451],
[0.46963447, 0.31637912, 0.53076214, 0.22793869],
[0.42653935, 0.27797104, 0.44324018, 0.17346204],
[0.52402575, 0.24354417, 0.55887031, 0.20172897],
[0.43306799, 0.33213802, 0.48203403, 0.24109716],
[0.39994425, 0.26774884, 0.49496683, 0.3023615 ],
[0.41250546, 0.29387268, 0.48858661, 0.29178021],
[0.51593718, 0.22908753, 0.47654061, 0.24544387]],

[[0.47414409, 0.39499267, 0.34660903, 0.32932065],
[0.45701962, 0.33452278, 0.34568234, 0.41274354],
[0.44359535, 0.32471362, 0.3225327 , 0.39138667],
[0.45143042, 0.29005444, 0.34692229, 0.34227724],
[0.36257207, 0.27610561, 0.35927244, 0.39205037],
[0.4206072 , 0.30814898, 0.37508203, 0.29926641],
[0.4753767 , 0.32962029, 0.34635113, 0.42146469],
[0.46162515, 0.33832063, 0.33312009, 0.40082384],
[0.48031957, 0.32116238, 0.31295914, 0.41500632],
[0.41449048, 0.30035176, 0.37754766, 0.38983413]],

[[0.34723191, 0.46433454, 0.48547763, 0.35213522],
[0.32847031, 0.45142346, 0.54468253, 0.3160009 ],
[0.37227206, 0.5471039 , 0.47114719, 0.38826122],
[0.26310648, 0.51241399, 0.53612229, 0.3192123 ],
[0.25098425, 0.49871102, 0.48027747, 0.37535901],
[0.28019656, 0.57517194, 0.43020384, 0.33012842],
[0.33194114, 0.49233941, 0.43195236, 0.34263641],
[0.29912019, 0.55967694, 0.47450227, 0.28735702],
[0.38945504, 0.5464712 , 0.49937897, 0.31384339],
[0.28677656, 0.44846233, 0.4716047 , 0.34292034]]])
• bob
(x, z)
float64
counts
3.2, 3.4, ..., 16.4, 16.6
σ = 0.3, 0.3, ..., 0.36, 0.32
Values:array([[ 3.2,  3.4,  3.6,  3.8,  4. ,  4.2,  4.4,  4.6],
[ 7.2,  7.4,  7.6,  7.8,  8. ,  8.2,  8.4,  8.6],
[11.2, 11.4, 11.6, 11.8, 12. , 12.2, 12.4, 12.6],
[15.2, 15.4, 15.6, 15.8, 16. , 16.2, 16.4, 16.6]])Variances (σ²):array([[0.09280351, 0.09297124, 0.06739631, 0.05033833, 0.09680752,
0.08782198, 0.1061593 , 0.09109196],
[0.10047327, 0.17233538, 0.12132769, 0.19098244, 0.17147789,
0.07152283, 0.08273838, 0.11585052],
[0.09426851, 0.13758808, 0.1674116 , 0.12242882, 0.08592324,
0.0954955 , 0.06477263, 0.14732664],
[0.08976756, 0.15534117, 0.13268861, 0.15089378, 0.14752302,
0.01959549, 0.12928085, 0.101804  ]])

## Interaction with numpy¶

Variable in a dataset are exposed in a numpy-compatible buffer format, so we can directly hand them to numpy functions:

[16]:

d['alice'].values = np.sin(d['alice'].values)


In contrast to the 1-D case considered earlier, the values are now a multi-dimensional array:

[17]:

d['alice'].values

[17]:

array([[[ 7.75894043e-01, -1.29037055e-03, -3.15736816e-01,
2.70149195e-02],
[ 3.24784501e-01, -7.04647521e-01, -5.97547812e-01,
6.14037018e-01],
[ 2.37107184e-01, -5.14344636e-01,  1.88892955e-01,
-1.51863782e-01],
[ 7.71445434e-01, -4.15557481e-01, -5.56626901e-01,
-3.66150146e-01],
[ 7.83671486e-01, -5.30201541e-01,  6.43615970e-03,
-5.62058489e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[ 6.92975905e-01,  2.12531625e-01,  3.04381728e-01,
-7.41034278e-01],
[ 5.99157255e-01,  1.75718492e-01, -7.63820433e-01,
1.47565261e-02],
[ 4.13331107e-01, -3.43570446e-01, -5.68848011e-01,
1.11569773e-01],
[ 9.79129037e-01,  9.09765426e-02,  2.77064482e-01,
-3.31424435e-01]],

[[-6.33506587e-01,  2.05354211e-01,  8.44742311e-02,
-4.53174848e-01],
[ 1.64665185e-01, -2.00855330e-01, -5.53260180e-01,
-8.13624266e-02],
[ 2.95874952e-01, -9.19892298e-01, -4.02152222e-01,
-4.99466806e-01],
[ 6.11874474e-01, -7.89046710e-01,  2.85677359e-01,
4.51972413e-01],
[ 6.89115774e-01, -7.44708159e-01,  2.81831475e-01,
1.15541182e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-1.00574922e-01, -4.45760847e-01, -3.46416186e-01,
-5.91117735e-01],
[ 6.65501181e-02, -6.59437999e-01, -5.87687185e-01,
-6.65083497e-01],
[ 6.98542019e-01, -9.20863369e-01, -1.79806690e-01,
-5.99954516e-01],
[ 4.51943976e-02, -6.96216869e-01,  2.24581066e-01,
2.26274708e-01]],

[[-3.51319707e-01,  1.49917754e-01, -2.15383044e-01,
1.86161059e-01],
[ 1.49884585e-01,  9.01211697e-02,  2.69428225e-01,
4.22131910e-01],
[ 4.90920900e-02, -1.85511821e-01, -2.72926531e-01,
-6.21349190e-01],
[ 4.59842180e-01,  7.37129268e-02,  1.07200000e-01,
3.14578155e-01],
[-2.76350350e-01,  7.64132437e-01,  4.19940118e-01,
1.16972112e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[ 2.26832642e-02,  1.92024302e-01,  1.72226122e-02,
2.17402487e-01],
[-7.79134469e-01, -1.28154057e-01, -1.65715273e-01,
-2.77634664e-01],
[ 2.38680600e-01,  4.24149652e-01,  2.93258579e-01,
3.73494330e-01],
[ 4.24511017e-03,  4.40319670e-01, -7.68722045e-02,
1.54418320e-01]],

[[-1.09408880e-01,  2.98115848e-01, -3.28737125e-01,
-9.09692616e-01],
[-9.16731262e-01,  3.19857380e-01, -3.17944886e-01,
-7.62666612e-01],
[-7.45603501e-01,  3.34007819e-01, -1.98236459e-01,
-8.66206687e-01],
[-3.61202305e-01,  6.50507846e-01,  2.94681792e-01,
1.62714458e-01],
[-3.02775858e-01, -4.16505708e-01, -7.19977446e-01,
-2.63102948e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-4.28952286e-01, -2.67773294e-01, -6.43289099e-01,
-8.22043879e-01],
[-4.06657570e-01,  1.32082675e-01,  1.98028898e-01,
-4.83368823e-01],
[-8.69684974e-01, -3.23877226e-01,  3.16335853e-01,
-7.03916408e-01],
[-6.42872943e-01, -1.99653528e-01, -8.30906073e-04,
-1.44625655e-01]],

[[ 6.05777812e-02, -4.50767702e-01,  9.72448227e-01,
6.23678306e-01],
[ 2.85730454e-01, -6.29147692e-01,  9.66120395e-01,
3.15276999e-01],
[-5.67042779e-01, -5.49180510e-01,  5.45561799e-01,
-3.18379681e-01],
[-3.58817410e-01, -5.19211743e-01,  5.91274896e-01,
-1.06239458e-01],
[-1.04518332e-01, -3.47421080e-01,  6.12341250e-01,
3.03227380e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-5.52732518e-01,  2.07598635e-01,  8.08663265e-01,
-1.27953282e-02],
[-2.36802726e-01, -8.34321300e-01,  1.69530320e-01,
-1.37012736e-01],
[-3.53798733e-01, -9.88534517e-01,  8.68478106e-01,
-4.53464846e-01],
[-9.43297171e-03, -9.52015825e-01,  2.83651882e-01,
-1.21569843e-01]],

[[ 1.18019736e-01,  1.60825018e-01,  6.98939130e-01,
2.37144271e-01],
[-6.94139088e-01, -4.72109171e-01,  7.27268373e-01,
4.19458081e-04],
[-2.99713971e-01, -3.03249230e-01,  2.41375213e-01,
-8.09112976e-01],
[ 7.38263411e-02, -4.52053124e-01,  4.70673214e-01,
-6.79316060e-01],
[-8.86019774e-01, -5.68174698e-01, -4.76187349e-01,
3.86772072e-02],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-4.38955105e-01, -6.67260460e-01,  1.69865397e-01,
5.02153390e-02],
[-6.69886243e-01, -3.07490863e-01,  4.24526873e-01,
8.64766195e-02],
[-6.86211886e-01,  2.74965431e-01, -8.47307563e-02,
-3.11180769e-01],
[-9.57524161e-02, -1.13189358e-01,  3.17540159e-01,
1.78626382e-01]],

[[ 1.76377312e-01,  3.07825035e-01,  4.03275430e-01,
3.63548811e-01],
[-2.06375379e-01,  4.42708153e-01,  9.39876889e-01,
7.13567634e-01],
[-3.54883809e-01,  3.82777271e-02,  1.44164685e-01,
6.42265635e-01],
[-5.41747930e-01, -1.37730235e-01,  1.26895951e-01,
-1.32546043e-01],
[-4.75871848e-02,  5.28705830e-01,  4.44860591e-01,
6.69729208e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[-5.09774646e-01,  2.77819252e-01, -2.97300889e-02,
2.86232834e-01],
[ 8.53019166e-01,  1.68580554e-02,  3.65894387e-01,
-8.03046348e-03],
[ 6.15086526e-01, -1.08785975e-01, -1.05875715e-01,
5.18976833e-01],
[ 7.57758681e-01,  5.16471904e-01, -4.19631101e-01,
8.39954791e-01]],

[[-4.35487914e-01, -8.77156317e-02, -1.06639106e-02,
-2.48456001e-01],
[ 1.96652507e-01,  5.25617380e-01,  3.35828458e-01,
-2.46185440e-01],
[-3.80475498e-01,  5.52747075e-01,  8.91784028e-01,
6.63805357e-01],
[-5.09546098e-01,  9.44947136e-02,  4.91141013e-01,
2.52931660e-01],
[ 1.75426909e-01,  6.10191340e-01, -4.23767459e-01,
6.73467292e-01],
[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
0.00000000e+00],
[ 1.62924314e-01,  8.31354343e-01,  4.64560309e-01,
8.15303256e-01],
[-2.84305689e-01,  3.44300642e-01,  1.22574819e-01,
-2.27153392e-01],
[ 1.11797050e-01,  3.65605427e-01,  3.21852135e-01,
-4.94748250e-02],
[-1.66442380e-01,  1.00747643e-01,  3.00610291e-01,
5.17095353e-02]]])


### Exercise 3¶

1. Use sc.mean to compute the mean of the data for Alice along the Z dimension.

2. Do the same with numpy, what are the complications you encounter, that are not present when using the dataset?

### Solution 3¶

[18]:

help(sc.mean)

Help on function mean in module scipp.core.reduction:

mean(x: 'VariableLike', dim: 'Optional[str]' = None, *, out: 'Optional[VariableLike]' = None) -> 'VariableLike'
Element-wise mean over the specified dimension.

If the input has variances, the variances stored in the output are based on
the "standard deviation of the mean", i.e.,
:math:\sigma_{mean} = \sigma / \sqrt{N}.
:math:N is the length of the input dimension.
:math:\sigma is estimated as the average of the standard deviations of
the input elements along that dimension.

:param x: Input data.
:param dim: Dimension along which to calculate the mean. If not
given, the mean over all dimensions is calculated.
:param out: Optional output buffer.
:raises: If the dimension does not exist, or the dtype cannot be summed,
e.g., if it is a string.
:return: The mean of the input values.
:seealso: :py:func:scipp.nanmean.


[19]:

mean = sc.mean(d['alice'], 'z')


When using numpy to compute the mean: - We must remember (or lookup) which dimension corresponds to the Z dimensions. - We need a separate call for values and variances. - We need to manually scale the variance with the inverse of the number of data points to get the variance of the mean (standard deviation of the mean scales with 1/sqrt(N)).

[20]:

np_values = np.mean(d['alice'].values, axis=0)
np_variances = np.mean(d['alice'].variances, axis=0)
np_variances /= d['alice'].shape[0]

[21]:

print(mean.values)
print(mean.variances)
print(np_values)
print(np_variances)

[[-0.04985678  0.07278302  0.16107702 -0.02172201]
[-0.08694106 -0.07855695  0.22122118  0.12190232]
[-0.22070567 -0.19339323  0.14230793 -0.24503852]
[ 0.01820934 -0.18686048  0.22636467 -0.01275688]
[ 0.00387033 -0.0879977   0.01818467  0.13655662]
[ 0.          0.          0.          0.        ]
[-0.14405075  0.04256669  0.09315724 -0.09972966]
[-0.10725752 -0.15755554 -0.02958345 -0.2121313 ]
[ 0.02096771 -0.20261388  0.10758294 -0.1392438 ]
[ 0.10897831 -0.10156998  0.11326421  0.10667048]]
[[0.04493938 0.05363585 0.05370123 0.05155106]
[0.04575192 0.05501441 0.05294212 0.04832267]
[0.0437848  0.0531635  0.05410781 0.04600953]
[0.04493955 0.05555863 0.05563535 0.04853739]
[0.04159714 0.05455728 0.05550097 0.04897127]
[0.0430902  0.05465434 0.05462612 0.04423165]
[0.0476702  0.05817431 0.05375735 0.05148287]
[0.04280499 0.05783729 0.05630658 0.05021531]
[0.04540936 0.05322903 0.05457936 0.0500696 ]
[0.04503883 0.05316069 0.05730776 0.04649299]]
[[-0.04985678  0.07278302  0.16107702 -0.02172201]
[-0.08694106 -0.07855695  0.22122118  0.12190232]
[-0.22070567 -0.19339323  0.14230793 -0.24503852]
[ 0.01820934 -0.18686048  0.22636467 -0.01275688]
[ 0.00387033 -0.0879977   0.01818467  0.13655662]
[ 0.          0.          0.          0.        ]
[-0.14405075  0.04256669  0.09315724 -0.09972966]
[-0.10725752 -0.15755554 -0.02958345 -0.2121313 ]
[ 0.02096771 -0.20261388  0.10758294 -0.1392438 ]
[ 0.10897831 -0.10156998  0.11326421  0.10667048]]
[[0.04493938 0.05363585 0.05370123 0.05155106]
[0.04575192 0.05501441 0.05294212 0.04832267]
[0.0437848  0.0531635  0.05410781 0.04600953]
[0.04493955 0.05555863 0.05563535 0.04853739]
[0.04159714 0.05455728 0.05550097 0.04897127]
[0.0430902  0.05465434 0.05462612 0.04423165]
[0.0476702  0.05817431 0.05375735 0.05148287]
[0.04280499 0.05783729 0.05630658 0.05021531]
[0.04540936 0.05322903 0.05457936 0.0500696 ]
[0.04503883 0.05316069 0.05730776 0.04649299]]

[ ]: