POWGEN data reduction#

Introduction#

This notebook gives a concise overview of how to use the ESSDiffraction package with Sciline. It uses a simple reduction workflow for the SNS POWGEN experiment.

We begin with relevant imports:

[1]:
import scipp as sc
import scippneutron as scn
import sciline

import ess.diffraction
from ess.diffraction import powder
from ess.diffraction.external import powgen
from ess.diffraction.types import *

Define reduction parameters#

We define a dictionary containing the reduction parameters. The keys are types defined in essdiffraction.types.

[2]:
params = {
    # Input data
    Filename[SampleRun]: 'PG3_4844_event.zip',
    Filename[VanadiumRun]: 'PG3_4866_event.zip',
    CalibrationFilename: 'PG3_FERNS_d4832_2011_08_24.zip',

    # Crop data to this range in time-of-flight
    ValidTofRange: sc.array(dims=['tof'], values=[0.0, 16666.67], unit='us'),

    # Edges for binning in d-spacing
    DspacingBins: sc.linspace('dspacing', 0.0, 2.3434, 200, unit='angstrom'),
}

Create pipeline using Sciline#

We use the basic providers available in essdiffraction as well as the specialised powder and powgen providers.

[3]:
providers = [
    *ess.diffraction.providers,
    *powder.providers,
    *powgen.providers,
]
pipeline = sciline.Pipeline(
    providers,
    params=params,
)

Use the pipeline#

Compute final result#

We can get the graph for computing the final d-spacing histogram:

[4]:
dspacing_histogram = pipeline.get(DspacingHistogram)

Before computing the result, we visualize the pipeline:

[5]:
# left-right layout works better for this graph
dspacing_histogram.visualize(graph_attr={'rankdir': 'LR'})
[5]:
../_images/examples_POWGEN_data_reduction_9_0.svg

Now we compute the result:

[6]:
result = dspacing_histogram.compute()
result
Downloading file 'PG3_4866_event.zip' from 'https://public.esss.dk/groups/scipp/ess/powgen/1/PG3_4866_event.zip' to '/home/runner/.cache/ess/powgen/1'.
Downloading file 'PG3_FERNS_d4832_2011_08_24.zip' from 'https://public.esss.dk/groups/scipp/ess/powgen/1/PG3_FERNS_d4832_2011_08_24.zip' to '/home/runner/.cache/ess/powgen/1'.
Downloading file 'PG3_4844_event.zip' from 'https://public.esss.dk/groups/scipp/ess/powgen/1/PG3_4844_event.zip' to '/home/runner/.cache/ess/powgen/1'.
Unzipping contents of '/home/runner/.cache/ess/powgen/1/PG3_FERNS_d4832_2011_08_24.zip' to '/home/runner/.cache/ess/powgen/1/PG3_FERNS_d4832_2011_08_24.zip.unzip'
Unzipping contents of '/home/runner/.cache/ess/powgen/1/PG3_4844_event.zip' to '/home/runner/.cache/ess/powgen/1/PG3_4844_event.zip.unzip'
Unzipping contents of '/home/runner/.cache/ess/powgen/1/PG3_4866_event.zip' to '/home/runner/.cache/ess/powgen/1/PG3_4866_event.zip.unzip'
[6]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (6.59 KB)
    • dspacing: 199
    • dspacing
      (dspacing [bin-edge])
      float64
      Å
      0.0, 0.012, ..., 2.332, 2.343
      Values:
      array([0. , 0.01177588, 0.02355176, 0.03532764, 0.04710352, 0.0588794 , 0.07065528, 0.08243116, 0.09420704, 0.10598291, 0.11775879, 0.12953467, 0.14131055, 0.15308643, 0.16486231, 0.17663819, 0.18841407, 0.20018995, 0.21196583, 0.22374171, 0.23551759, 0.24729347, 0.25906935, 0.27084523, 0.28262111, 0.29439698, 0.30617286, 0.31794874, 0.32972462, 0.3415005 , 0.35327638, 0.36505226, 0.37682814, 0.38860402, 0.4003799 , 0.41215578, 0.42393166, 0.43570754, 0.44748342, 0.4592593 , 0.47103518, 0.48281106, 0.49458693, 0.50636281, 0.51813869, 0.52991457, 0.54169045, 0.55346633, 0.56524221, 0.57701809, 0.58879397, 0.60056985, 0.61234573, 0.62412161, 0.63589749, 0.64767337, 0.65944925, 0.67122513, 0.68300101, 0.69477688, 0.70655276, 0.71832864, 0.73010452, 0.7418804 , 0.75365628, 0.76543216, 0.77720804, 0.78898392, 0.8007598 , 0.81253568, 0.82431156, 0.83608744, 0.84786332, 0.8596392 , 0.87141508, 0.88319095, 0.89496683, 0.90674271, 0.91851859, 0.93029447, 0.94207035, 0.95384623, 0.96562211, 0.97739799, 0.98917387, 1.00094975, 1.01272563, 1.02450151, 1.03627739, 1.04805327, 1.05982915, 1.07160503, 1.0833809 , 1.09515678, 1.10693266, 1.11870854, 1.13048442, 1.1422603 , 1.15403618, 1.16581206, 1.17758794, 1.18936382, 1.2011397 , 1.21291558, 1.22469146, 1.23646734, 1.24824322, 1.2600191 , 1.27179497, 1.28357085, 1.29534673, 1.30712261, 1.31889849, 1.33067437, 1.34245025, 1.35422613, 1.36600201, 1.37777789, 1.38955377, 1.40132965, 1.41310553, 1.42488141, 1.43665729, 1.44843317, 1.46020905, 1.47198492, 1.4837608 , 1.49553668, 1.50731256, 1.51908844, 1.53086432, 1.5426402 , 1.55441608, 1.56619196, 1.57796784, 1.58974372, 1.6015196 , 1.61329548, 1.62507136, 1.63684724, 1.64862312, 1.66039899, 1.67217487, 1.68395075, 1.69572663, 1.70750251, 1.71927839, 1.73105427, 1.74283015, 1.75460603, 1.76638191, 1.77815779, 1.78993367, 1.80170955, 1.81348543, 1.82526131, 1.83703719, 1.84881307, 1.86058894, 1.87236482, 1.8841407 , 1.89591658, 1.90769246, 1.91946834, 1.93124422, 1.9430201 , 1.95479598, 1.96657186, 1.97834774, 1.99012362, 2.0018995 , 2.01367538, 2.02545126, 2.03722714, 2.04900302, 2.06077889, 2.07255477, 2.08433065, 2.09610653, 2.10788241, 2.11965829, 2.13143417, 2.14321005, 2.15498593, 2.16676181, 2.17853769, 2.19031357, 2.20208945, 2.21386533, 2.22564121, 2.23741709, 2.24919296, 2.26096884, 2.27274472, 2.2845206 , 2.29629648, 2.30807236, 2.31984824, 2.33162412, 2.3434 ])
    • gd_prtn_chrg
      ()
      float64
      µAh
      1171.953902925
      Values:
      array(1171.95390292)
    • sample_position
      ()
      vector3
      m
      [0. 0. 0.]
      Values:
      array([0., 0., 0.])
    • source_position
      ()
      vector3
      m
      [ 0. 0. -60.]
      Values:
      array([ 0., 0., -60.])
    • (dspacing)
      float64
      𝟙
      1.121, 1.037, ..., 0.322, 1.612
      σ = 0.006, 0.006, ..., 0.228, 1.140
      Values:
      array([1.12113954, 1.03691557, 0.93077426, 0.88924009, 0.86098465, 0.8544947 , 0.86587796, 0.87501281, 0.88857666, 0.89083923, 0.89290995, 0.88742713, 0.88247996, 0.87591037, 0.874725 , 0.86783488, 0.85812342, 0.85329267, 0.84666049, 0.83960529, 0.84177755, 0.8282836 , 0.82149372, 0.8364968 , 0.8299827 , 0.82412568, 0.81793549, 0.82377879, 0.87859401, 0.80411093, 0.82500294, 0.83692466, 0.8352371 , 0.84582432, 0.86069265, 0.84467294, 0.90059059, 0.84480397, 0.79974034, 0.77861988, 0.8279828 , 0.91105855, 0.89705034, 0.97979666, 0.77822939, 0.76188497, 0.99432287, 0.74037633, 1.02808431, 1.10029961, 0.82270861, 0.74632221, 1.2207846 , 0.75510113, 0.7386446 , 0.96992992, 0.72444017, 0.74783175, 0.86598892, 0.91485493, 1.28273125, 1.50519965, 0.93358866, 0.74689492, 1.15903084, 0.96753714, 0.75452346, 0.99377004, 1.21930766, 1.27536558, 1.06819046, 0.77772178, 0.83784794, 0.76811993, 0.76942183, 1.13994695, 0.83320702, 1.51682461, 0.85797373, 0.9798424 , 0.80293388, 0.89770657, 0.81648068, 2.22726891, 0.82644627, 1.40634478, 0.83865139, 0.82937133, 1.51412504, 0.84031394, 0.8303208 , 0.8194962 , 0.82096711, 0.81079516, 0.90756063, 0.8252705 , 0.83983905, 0.86813564, 0.88652115, 0.83590361, 0.83956613, 1.07607726, 1.28063425, 0.84793185, 0.8041826 , 0.76878148, 0.96158253, 0.85882008, 0.84955859, 0.86662268, 0.90406096, 4.44508774, 1.40673475, 0.90140698, 0.8782988 , 0.8909063 , 0.93666594, 7.70192563, 2.65657309, 0.89190396, 0.88560111, 0.83861977, 0.84934951, 0.87475884, 0.85085651, 0.82248666, 0.86462041, 0.86220271, 0.74346611, 0.84183464, 0.85511959, 0.82927566, 0.83529857, 0.85050984, 0.82802098, 0.84402608, 0.84327138, 0.8606399 , 0.82631634, 0.85464931, 0.83450155, 0.83891145, 0.8298331 , 1.05897999, 2.32876195, 0.86708633, 0.8637037 , 0.8354315 , 0.85930514, 0.85341073, 0.82252312, 0.83408577, 0.90434584, 0.87540864, 0.87629257, 0.8405809 , 0.89060897, 1.75516231, 1.99938225, 0.85819602, 0.85916129, 0.90054362, 0.87768546, 0.87225413, 0.89604105, 0.85913191, 0.88678255, 0.9301115 , 0.84654242, 0.89426684, 0.84135168, 0.83548963, 0.81699067, 0.84778118, 0.87559139, 1.06060689, 4.05197489, 1.86689818, 0.90206016, 0.86571447, 0.90048682, 0.8329971 , 0.82792063, 0.79560414, 0.88127355, 0.88609721, 0.85082977, 0.76940781, 0.74177597, 0.93709473, 0.9287523 , 0.88801218, 0.75597837, 0.91270768, 0.83306668, 0.92410035, 0.86265509, 0.32236059, 1.61180293])

      Variances (σ²):
      array([3.39873422e-05, 3.06349233e-05, 1.83116132e-05, 1.31048714e-05, 9.41314484e-06, 7.24653830e-06, 6.05042640e-06, 5.55030128e-06, 5.36982603e-06, 5.04103189e-06, 4.72542676e-06, 4.37697323e-06, 4.02010579e-06, 3.67651571e-06, 3.38111891e-06, 3.09643820e-06, 2.84305102e-06, 2.64373490e-06, 2.45988124e-06, 2.30490592e-06, 2.20657072e-06, 2.08570074e-06, 2.00210023e-06, 1.98544639e-06, 1.92617991e-06, 1.87925938e-06, 1.84025301e-06, 1.83605018e-06, 1.94047177e-06, 1.76067656e-06, 1.80043660e-06, 1.81535256e-06, 1.80838116e-06, 1.83201611e-06, 1.86358037e-06, 1.82992312e-06, 1.95654781e-06, 1.84559580e-06, 1.76006465e-06, 1.72299805e-06, 1.84476072e-06, 2.04909186e-06, 2.04176735e-06, 2.26324168e-06, 1.82089069e-06, 1.92142013e-06, 2.86301958e-06, 2.34658307e-06, 3.56686145e-06, 4.22166393e-06, 3.44757928e-06, 3.35188920e-06, 5.84077666e-06, 3.98177139e-06, 4.26017106e-06, 6.13483088e-06, 4.79465692e-06, 5.19702933e-06, 6.43440899e-06, 7.26426482e-06, 1.07445536e-05, 1.36051570e-05, 8.92170147e-06, 7.34711857e-06, 1.17543049e-05, 1.07725995e-05, 9.23657679e-06, 1.34547532e-05, 1.76999960e-05, 2.12311043e-05, 1.97786593e-05, 1.53231620e-05, 1.68024407e-05, 1.55482181e-05, 1.55956258e-05, 2.45013681e-05, 1.87175504e-05, 3.57526869e-05, 2.12290964e-05, 2.56427747e-05, 2.20117729e-05, 2.54364334e-05, 2.48746530e-05, 7.16743747e-05, 2.80763527e-05, 4.95405063e-05, 3.12288501e-05, 3.19888760e-05, 5.94439455e-05, 3.41206818e-05, 3.51249557e-05, 3.59092086e-05, 3.82035481e-05, 3.94804392e-05, 4.67859298e-05, 4.41565995e-05, 4.72867812e-05, 5.14794737e-05, 5.51367867e-05, 5.51487644e-05, 5.88520731e-05, 7.90134611e-05, 1.00713834e-04, 7.05720875e-05, 6.66161565e-05, 6.33806933e-05, 9.40918855e-05, 8.89820149e-05, 9.10725305e-05, 9.42209086e-05, 1.00929393e-04, 4.95717529e-04, 1.60131303e-04, 1.06283132e-04, 1.07318974e-04, 1.12695447e-04, 1.22482631e-04, 1.04157287e-03, 3.72401486e-04, 1.26368971e-04, 1.31437797e-04, 1.27175970e-04, 1.35422300e-04, 1.43242798e-04, 1.43528312e-04, 1.42838747e-04, 1.57914754e-04, 1.60076122e-04, 1.22315081e-04, 1.66436251e-04, 1.77396778e-04, 1.77424694e-04, 1.84974471e-04, 1.96834554e-04, 1.97470835e-04, 2.12397144e-04, 2.17330873e-04, 2.33218210e-04, 2.29512166e-04, 2.48359555e-04, 2.46685381e-04, 2.47807190e-04, 2.52984191e-04, 3.22994997e-04, 7.42386340e-04, 2.84464134e-04, 2.94971958e-04, 2.99034186e-04, 3.20349379e-04, 3.33017773e-04, 3.27465772e-04, 3.53505623e-04, 4.04671649e-04, 3.93196661e-04, 4.13287762e-04, 4.09135064e-04, 4.67128590e-04, 9.26773384e-04, 1.09761927e-03, 4.85178134e-04, 5.01466121e-04, 5.47219168e-04, 5.71462733e-04, 5.81672224e-04, 6.39752646e-04, 6.39608005e-04, 6.87999382e-04, 7.77974282e-04, 7.32006198e-04, 8.25297406e-04, 7.95362522e-04, 8.37986709e-04, 8.42769893e-04, 9.59590018e-04, 1.04307522e-03, 1.30346114e-03, 5.27756364e-03, 2.66054108e-03, 1.37684017e-03, 1.36265734e-03, 1.54159033e-03, 1.28974751e-03, 1.45840973e-03, 1.72475734e-03, 2.04379753e-03, 2.32987614e-03, 2.38914620e-03, 2.33987504e-03, 2.57117567e-03, 3.90287346e-03, 4.56391975e-03, 5.40113448e-03, 5.39154047e-03, 8.86207784e-03, 1.00579725e-02, 1.98595687e-02, 3.91670424e-02, 5.19581738e-02, 1.29895435e+00])
[7]:
result.plot()
[7]:
../_images/examples_POWGEN_data_reduction_12_0.svg

Save reduced data to file#

We ultimately need to write the reduced data to a file. This could be done with the result we computed above. But we can use the pipeline to provide additional parameters (in this case only the file name) as shown below. See also the File output docs of Sciline.

For simplicity we write a simply xye file with 3 columns: \(d\)-spacing, intensity, standard deviation of intensity.

[8]:
def save_xye(reduced_data: DspacingHistogram,
             out_filename: OutFilename,
) -> None:
    data = reduced_data.copy(deep=False)
    data.coords['dspacing'] = sc.midpoints(data.coords['dspacing'])
    scn.io.save_xye(out_filename, data, coord='dspacing')

Insert a new parameter to set the file name. This could have been done at the top where the other parameters are defined.

[9]:
pipeline[OutFilename] = 'reduced.xye'

And use the pipeline to write the file. Note that this recomputes the result!

[10]:
pipeline.bind_and_call(save_xye)

Compute intermediate results#

For inspection and debugging purposes, we can also compute intermediate results. To avoid repeated computation (including costly loading of files), we can request multiple results at once, including the final result, if desired. For example:

[11]:
results = pipeline.compute((
    RawData[SampleRun],
    FilteredData[SampleRun],
    FilteredData[VanadiumRun],
))
[12]:
results[RawData[SampleRun]]
[12]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (274.59 MB)
    • spectrum: 24794
    • tof: 1
    • gd_prtn_chrg
      ()
      float64
      µAh
      1171.953902925
      Values:
      array(1171.95390292)
    • position
      (spectrum)
      vector3
      m
      [ 1.17451004 -1.01106149 -2.03796699], [ 1.18147634 -0.95946649 -2.05334117], ..., [1.81428985 0.09565841 3.84338287], [1.81375055 0.1499371 3.84269584]
      Values:
      array([[ 1.17451004, -1.01106149, -2.03796699], [ 1.18147634, -0.95946649, -2.05334117], [ 1.18844265, -0.90787149, -2.06871534], ..., [ 1.81482915, 0.04137972, 3.8440699 ], [ 1.81428985, 0.09565841, 3.84338287], [ 1.81375055, 0.1499371 , 3.84269584]])
    • sample_position
      ()
      vector3
      m
      [0. 0. 0.]
      Values:
      array([0., 0., 0.])
    • source_position
      ()
      vector3
      m
      [ 0. 0. -60.]
      Values:
      array([ 0., 0., -60.])
    • spectrum
      (spectrum)
      int32
      1, 2, ..., 24793, 24794
      Values:
      array([ 1, 2, 3, ..., 24792, 24793, 24794], dtype=int32)
    • tof
      (tof [bin-edge])
      float64
      µs
      19.0, 1.669e+04
      Values:
      array([ 19. , 16694.30078125])
    • (spectrum, tof)
      DataArrayView
      binned data [len=0, len=0, ..., len=0, len=0]
      dim='event',
      content=DataArray(
                dims=(event: 17926980),
                data=float32[counts],
                coords={'tof':float64[µs]})
[13]:
scn.instrument_view(results[RawData[SampleRun]].hist())
[13]:
[14]:
tof_data = sc.DataGroup(
    sample=results[FilteredData[SampleRun]].bins.concat('spectrum'),
    vanadium=results[FilteredData[VanadiumRun]].bins.concat('spectrum'),
)
tof_data.hist(tof=100).plot()
[14]:
../_images/examples_POWGEN_data_reduction_23_0.svg

Group by scattering angle#

The above pipeline focuses the data by merging all instrument pixels to produce a 1d d-spacing curve. If instead we want to group into \(2\theta\) bins, we can alter the pipeline by replacing the focussing step:

[15]:
from ess.diffraction.grouping import group_by_two_theta, merge_all_pixels

grouping_providers = list(providers)
grouping_providers.remove(merge_all_pixels)
grouping_providers = (*grouping_providers, group_by_two_theta)

We also need to specify the grouping with a new parameter:

[16]:
params[TwoThetaBins] = sc.linspace(dim='two_theta', unit='deg', start=25.0, stop=90.0, num=16)
[17]:
grouping_pipeline = sciline.Pipeline(
    grouping_providers,
    params=params
)

Inspect the graph to check that the new provider has been inserted:

[18]:
grouped_dspacing = grouping_pipeline.get(DspacingHistogram)
grouped_dspacing.visualize(graph_attr={'rankdir': 'LR'})
[18]:
../_images/examples_POWGEN_data_reduction_30_0.svg

Compute and plot the result:

[19]:
grouped_result = grouped_dspacing.compute()
grouped_result
[19]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (50.83 KB)
    • two_theta: 15
    • dspacing: 199
    • dspacing
      (dspacing [bin-edge])
      float64
      Å
      0.0, 0.012, ..., 2.332, 2.343
      Values:
      array([0. , 0.01177588, 0.02355176, 0.03532764, 0.04710352, 0.0588794 , 0.07065528, 0.08243116, 0.09420704, 0.10598291, 0.11775879, 0.12953467, 0.14131055, 0.15308643, 0.16486231, 0.17663819, 0.18841407, 0.20018995, 0.21196583, 0.22374171, 0.23551759, 0.24729347, 0.25906935, 0.27084523, 0.28262111, 0.29439698, 0.30617286, 0.31794874, 0.32972462, 0.3415005 , 0.35327638, 0.36505226, 0.37682814, 0.38860402, 0.4003799 , 0.41215578, 0.42393166, 0.43570754, 0.44748342, 0.4592593 , 0.47103518, 0.48281106, 0.49458693, 0.50636281, 0.51813869, 0.52991457, 0.54169045, 0.55346633, 0.56524221, 0.57701809, 0.58879397, 0.60056985, 0.61234573, 0.62412161, 0.63589749, 0.64767337, 0.65944925, 0.67122513, 0.68300101, 0.69477688, 0.70655276, 0.71832864, 0.73010452, 0.7418804 , 0.75365628, 0.76543216, 0.77720804, 0.78898392, 0.8007598 , 0.81253568, 0.82431156, 0.83608744, 0.84786332, 0.8596392 , 0.87141508, 0.88319095, 0.89496683, 0.90674271, 0.91851859, 0.93029447, 0.94207035, 0.95384623, 0.96562211, 0.97739799, 0.98917387, 1.00094975, 1.01272563, 1.02450151, 1.03627739, 1.04805327, 1.05982915, 1.07160503, 1.0833809 , 1.09515678, 1.10693266, 1.11870854, 1.13048442, 1.1422603 , 1.15403618, 1.16581206, 1.17758794, 1.18936382, 1.2011397 , 1.21291558, 1.22469146, 1.23646734, 1.24824322, 1.2600191 , 1.27179497, 1.28357085, 1.29534673, 1.30712261, 1.31889849, 1.33067437, 1.34245025, 1.35422613, 1.36600201, 1.37777789, 1.38955377, 1.40132965, 1.41310553, 1.42488141, 1.43665729, 1.44843317, 1.46020905, 1.47198492, 1.4837608 , 1.49553668, 1.50731256, 1.51908844, 1.53086432, 1.5426402 , 1.55441608, 1.56619196, 1.57796784, 1.58974372, 1.6015196 , 1.61329548, 1.62507136, 1.63684724, 1.64862312, 1.66039899, 1.67217487, 1.68395075, 1.69572663, 1.70750251, 1.71927839, 1.73105427, 1.74283015, 1.75460603, 1.76638191, 1.77815779, 1.78993367, 1.80170955, 1.81348543, 1.82526131, 1.83703719, 1.84881307, 1.86058894, 1.87236482, 1.8841407 , 1.89591658, 1.90769246, 1.91946834, 1.93124422, 1.9430201 , 1.95479598, 1.96657186, 1.97834774, 1.99012362, 2.0018995 , 2.01367538, 2.02545126, 2.03722714, 2.04900302, 2.06077889, 2.07255477, 2.08433065, 2.09610653, 2.10788241, 2.11965829, 2.13143417, 2.14321005, 2.15498593, 2.16676181, 2.17853769, 2.19031357, 2.20208945, 2.21386533, 2.22564121, 2.23741709, 2.24919296, 2.26096884, 2.27274472, 2.2845206 , 2.29629648, 2.30807236, 2.31984824, 2.33162412, 2.3434 ])
    • gd_prtn_chrg
      ()
      float64
      µAh
      1171.953902925
      Values:
      array(1171.95390292)
    • incident_beam
      ()
      vector3
      m
      [ 0. 0. 60.]
      Values:
      array([ 0., 0., 60.])
    • sample_position
      ()
      vector3
      m
      [0. 0. 0.]
      Values:
      array([0., 0., 0.])
    • source_position
      ()
      vector3
      m
      [ 0. 0. -60.]
      Values:
      array([ 0., 0., -60.])
    • two_theta
      (two_theta [bin-edge])
      float64
      rad
      0.436, 0.512, ..., 1.495, 1.571
      Values:
      array([0.43633231, 0.51196325, 0.58759418, 0.66322512, 0.73885605, 0.81448698, 0.89011792, 0.96574885, 1.04137979, 1.11701072, 1.19264166, 1.26827259, 1.34390352, 1.41953446, 1.49516539, 1.57079633])
    • (two_theta, dspacing)
      float64
      𝟙
      1.159, 1.102, ..., 0.0, 0.0
      σ = 0.105, 0.096, ..., 0.0, 0.0
      Values:
      array([[1.15936702, 1.10237299, 1.15927782, ..., 0.86265509, 0.32236059, 1.61180293], [1.25117123, 1.26051255, 1.08956375, ..., 0. , 0. , 0. ], [1.25993046, 1.49141931, 1.23876557, ..., 0. , 0. , 0. ], ..., [1.1740997 , 1.21139622, 1.00356994, ..., 0. , 0. , 0. ], [1.24255994, 1.24598796, 0.97242913, ..., 0. , 0. , 0. ], [1.28773673, 1.07888312, 0.91857896, ..., 0. , 0. , 0. ]])

      Variances (σ²):
      array([[1.09279015e-02, 9.20625915e-03, 1.17888163e-02, ..., 3.91670424e-02, 5.19581738e-02, 1.29895435e+00], [9.20840844e-03, 8.68246933e-03, 8.18723567e-03, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [7.15056201e-03, 9.97458098e-03, 8.71897808e-03, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], ..., [8.36982461e-04, 1.07193630e-03, 5.82169144e-04, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [1.09500369e-03, 1.38121530e-03, 6.41967692e-04, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00], [2.19637867e-03, 2.01034332e-03, 1.05079366e-03, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]])
[20]:
angle = sc.midpoints(grouped_result.coords['two_theta'])
sc.plot({
    f'{angle[group].value:.3f} {angle[group].unit}': grouped_result['two_theta', group]
    for group in range(2, 6)
})
[20]:
../_images/examples_POWGEN_data_reduction_33_0.svg