Scaling#

MTZ IO#

ess.nmx has MTZ IO helper functions. They can be used as providers in a workflow of scaling routine.

They are wrapping MTZ IO functions of gemmi.

[1]:
%matplotlib inline
[2]:
import gemmi
from ess.nmx.mtz_io import (
    read_mtz_file,
    mtz_to_pandas,
    MTZFilePath,
    get_unique_space_group,
    MtzDataFrame,
    merge_mtz_dataframes,
)
from ess.nmx.data import get_small_random_mtz_samples


small_mtz_sample = get_small_random_mtz_samples()[0]
mtz = read_mtz_file(MTZFilePath(small_mtz_sample))
df = mtz_to_pandas(mtz)
df.head()
Downloading file 'mtz_random_samples.tar.gz' from 'https://public.esss.dk/groups/scipp/ess/nmx/1/mtz_random_samples.tar.gz' to '/home/runner/.cache/ess/nmx'.
Untarring contents of '/home/runner/.cache/ess/nmx/mtz_random_samples.tar.gz' to '/home/runner/.cache/ess/nmx/mtz_random_samples.tar.gz.untar'
[2]:
I SIGI LAMBDA H K L
0 124.962219 16.215948 3.199984 34.0 99.0 0.0
1 120.856743 14.550026 3.199915 -25.0 -24.0 71.0
2 119.300064 13.047421 3.199908 52.0 -84.0 63.0
3 117.497627 16.257229 3.199904 -36.0 93.0 18.0
4 114.670326 11.597502 3.199864 -96.0 51.0 -47.0

Build Pipeline#

Scaling routine includes:

  • Reducing individual MTZ dataset

  • Merging MTZ dataset

  • Reducing merged MTZ dataset

These operations are done on pandas dataframe as recommended in gemmi. And multiple MTZ files are expected, so we need to use sciline.ParamTable.

[3]:
import pandas as pd
import sciline as sl
import scipp as sc

from ess.nmx.mtz_io import providers as mtz_io_providers, default_parameters as mtz_io_params
from ess.nmx.mtz_io import SpaceGroupDesc
from ess.nmx.scaling import providers as scaling_providers, default_parameters as scaling_params
from ess.nmx.scaling import (
    WavelengthBins,
    FilteredEstimatedScaledIntensities,
    ReferenceWavelength,
    ScaledIntensityLeftTailThreshold,
    ScaledIntensityRightTailThreshold,
)

pl = sl.Pipeline(
    providers=mtz_io_providers + scaling_providers,
    params={
        SpaceGroupDesc: "C 1 2 1",
        ReferenceWavelength: sc.scalar(
            3, unit=sc.units.angstrom
        ),  # Remove it if you want to use the middle of the bin
        ScaledIntensityLeftTailThreshold: sc.scalar(
            0.1,  # Increase it to remove more outliers
        ),
        ScaledIntensityRightTailThreshold: sc.scalar(
            4.0,  # Decrease it to remove more outliers
        ),
        **mtz_io_params,
        **scaling_params,
        WavelengthBins: 250,
    },
)
pl
[3]:
Name Value Source
EstimatedScaleFactor
estimate_scale_factor_per_hkl_asu_from_reference ess.nmx.scaling.estimate_scale_factor_per_hkl_asu_from_reference
EstimatedScaledIntensities
average_roughly_scaled_intensities ess.nmx.scaling.average_roughly_scaled_intensities
FilteredEstimatedScaledIntensities
cut_tails ess.nmx.scaling.cut_tails
FittingResult
fit_wavelength_scale_factor_polynomial ess.nmx.scaling.fit_wavelength_scale_factor_polynomial
IntensityColumnName I
MTZFilePath
Mtz
read_mtz_file ess.nmx.mtz_io.read_mtz_file
MtzDataFrame
process_single_mtz_to_dataframe ess.nmx.mtz_io.process_single_mtz_to_dataframe
NMXMtzDataArray
nmx_mtz_dataframe_to_scipp_dataarray ess.nmx.mtz_io.nmx_mtz_dataframe_to_scipp_dataarray
NMXMtzDataFrame
process_mtz_dataframe ess.nmx.mtz_io.process_mtz_dataframe
ReciprocalAsu
get_reciprocal_asu ess.nmx.mtz_io.get_reciprocal_asu
ReferenceIntensities
get_reference_intensities ess.nmx.scaling.get_reference_intensities
ReferenceWavelength
<scipp.Variable> () ... <scipp.Variable> () int64 [Å] 3
ScaledIntensityLeftTailThreshold
<scipp.Variable> () f... <scipp.Variable> () float64 [dimensionless] 0.1
ScaledIntensityRightTailThreshold
<scipp.Variable> () f... <scipp.Variable> () float64 [dimensionless] 2
SelectedReferenceWavelength
get_reference_wavelength ess.nmx.scaling.get_reference_wavelength
SpaceGroup
SpaceGroup | NoneType
get_space_group_from_mtz ess.nmx.mtz_io.get_space_group_from_mtz
SpaceGroupDesc C 1 2 1
StdDevColumnName SIGI
WavelengthBinned
get_wavelength_binned ess.nmx.scaling.get_wavelength_binned
WavelengthBins 250
WavelengthColumnName LAMBDA
WavelengthFittingPolynomialDegree 7
WavelengthScaleFactors
calculate_wavelength_scale_factor ess.nmx.scaling.calculate_wavelength_scale_factor
[4]:
file_paths = pd.DataFrame({MTZFilePath: get_small_random_mtz_samples()}).rename_axis(
    "mtzfile"
)
mapped = pl.map(file_paths)
pl[gemmi.SpaceGroup] = mapped[gemmi.SpaceGroup | None].reduce(
    index='mtzfile', func=get_unique_space_group
)
pl[MtzDataFrame] = mapped[MtzDataFrame].reduce(
    index='mtzfile', func=merge_mtz_dataframes
)

Build Workflow#

[5]:
from ess.nmx.scaling import WavelengthScaleFactors

scaling_nmx_workflow = pl.get(WavelengthScaleFactors)
scaling_nmx_workflow.visualize(graph_attr={"rankdir": "LR"})
[5]:
../_images/user-guide_scaling_workflow_7_0.svg

Compute Desired Type#

[6]:
from ess.nmx.scaling import (
    SelectedReferenceWavelength,
    FittingResult,
    WavelengthScaleFactors,
)

results = scaling_nmx_workflow.compute(
    (
        FilteredEstimatedScaledIntensities,
        SelectedReferenceWavelength,
        FittingResult,
        WavelengthScaleFactors,
    )
)

results[WavelengthScaleFactors]
[6]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (3.76 KB)
    • wavelength: 247
    • wavelength
      (wavelength)
      float32
      Å
      2.8012676, 2.8044639, ..., 3.1944056, 3.196004
      Values:
      array([2.8012676, 2.8044639, 2.8060622, 2.80766 , 2.8092585, 2.8108563, 2.8124547, 2.8140526, 2.815651 , 2.8172488, 2.8188472, 2.820445 , 2.8220434, 2.8236413, 2.8252397, 2.8268375, 2.828436 , 2.8300338, 2.8316321, 2.83323 , 2.8348284, 2.8364263, 2.8380246, 2.8396225, 2.8412209, 2.8428187, 2.844417 , 2.846015 , 2.8476133, 2.8492112, 2.8508096, 2.8524075, 2.8540058, 2.8556037, 2.857202 , 2.8588 , 2.8603983, 2.8619962, 2.8635945, 2.8651924, 2.8667908, 2.8683887, 2.869987 , 2.871585 , 2.8731833, 2.8747811, 2.8763795, 2.8779774, 2.8795757, 2.8811736, 2.882772 , 2.8843699, 2.8859682, 2.887566 , 2.8891644, 2.8907623, 2.8923607, 2.8939586, 2.895557 , 2.8971548, 2.8987532, 2.9003513, 2.9019494, 2.9035475, 2.9051456, 2.906744 , 2.908342 , 2.9099402, 2.9115381, 2.9131365, 2.9147344, 2.9163327, 2.9179306, 2.919529 , 2.9211268, 2.9227252, 2.924323 , 2.9259214, 2.9275193, 2.9291177, 2.9307156, 2.932314 , 2.9339118, 2.9355102, 2.937108 , 2.9387064, 2.9403043, 2.9419026, 2.9435005, 2.9450989, 2.9466968, 2.948295 , 2.949893 , 2.9514914, 2.9530892, 2.9546876, 2.9562855, 2.9578838, 2.9594817, 2.96108 , 2.962678 , 2.9642763, 2.9658742, 2.9674726, 2.9690704, 2.9706688, 2.9722667, 2.973865 , 2.975463 , 2.9770613, 2.9786592, 2.9802575, 2.9818554, 2.9834538, 2.9850516, 2.98665 , 2.9882479, 2.9898462, 2.991444 , 2.9930425, 2.9946404, 2.9962387, 2.9978366, 2.999435 , 3.0010328, 3.0026312, 3.004229 , 3.0058274, 3.0074253, 3.0090237, 3.0106215, 3.01222 , 3.0138178, 3.0154161, 3.017014 , 3.0186124, 3.0202103, 3.0218086, 3.0234065, 3.0250049, 3.0266027, 3.028201 , 3.029799 , 3.0313973, 3.0329952, 3.0345936, 3.0361915, 3.0377898, 3.0393877, 3.040986 , 3.042584 , 3.0441823, 3.0457802, 3.0473785, 3.0489764, 3.0505748, 3.0521727, 3.053771 , 3.055369 , 3.0569673, 3.0585651, 3.0601635, 3.0617614, 3.0633597, 3.0649576, 3.066556 , 3.0681539, 3.0697522, 3.07135 , 3.0729485, 3.0745463, 3.0761447, 3.0777426, 3.079341 , 3.0809388, 3.0825372, 3.084135 , 3.0857334, 3.0873313, 3.0889297, 3.0905275, 3.092126 , 3.0937238, 3.0953221, 3.0969203, 3.0985184, 3.1001165, 3.1017146, 3.1033127, 3.1049109, 3.106509 , 3.108107 , 3.1097052, 3.1113033, 3.1129014, 3.1144996, 3.1160977, 3.1176958, 3.119294 , 3.120892 , 3.1224904, 3.1240883, 3.1256866, 3.1272845, 3.128883 , 3.1304808, 3.1320791, 3.133677 , 3.1352754, 3.1368732, 3.1384716, 3.1400695, 3.1416678, 3.1432657, 3.144864 , 3.146462 , 3.1480603, 3.1496582, 3.1512566, 3.1528544, 3.1544528, 3.1560507, 3.157649 , 3.159247 , 3.1608453, 3.1624432, 3.1640415, 3.1656394, 3.1672378, 3.1688356, 3.170434 , 3.1720319, 3.1736302, 3.175228 , 3.1768265, 3.1784244, 3.1800227, 3.1816206, 3.183219 , 3.1848168, 3.1864152, 3.188013 , 3.1896114, 3.1912093, 3.1928077, 3.1944056, 3.196004 ], dtype=float32)
    • (wavelength)
      float64
      𝟙
      0.113, 0.158, ..., 1.845, 1.868
      Values:
      array([0.11304956, 0.15792468, 0.17930914, 0.20000859, 0.22005404, 0.23945186, 0.25823168, 0.27640001, 0.2939851 , 0.31099356, 0.32745236, 0.34336818, 0.35876671, 0.37365468, 0.38805658, 0.40197915, 0.41544572, 0.428463 , 0.44105322, 0.45322305, 0.46499364, 0.4763716 , 0.48737706, 0.49801652, 0.50830915, 0.51826132, 0.52789125, 0.5372052 , 0.54622048, 0.55494319, 0.56338976, 0.57156615, 0.57948795, 0.58716092, 0.59459988, 0.60181036, 0.60880644, 0.61559343, 0.62218468, 0.62858529, 0.63480788, 0.64085733, 0.64674561, 0.65247733, 0.65806383, 0.66350946, 0.66882496, 0.67401442, 0.67908799, 0.68404948, 0.68890849, 0.69366857, 0.69833879, 0.7029224 , 0.70742797, 0.71185847, 0.71622199, 0.72052121, 0.72476377, 0.72895205, 0.73309326, 0.73719009, 0.74124752, 0.74526976, 0.74926083, 0.75322517, 0.75716472, 0.76108535, 0.76498811, 0.76887853, 0.77275736, 0.77662983, 0.78049638, 0.78436195, 0.78822669, 0.79209524, 0.79596749, 0.79984781, 0.8037358 , 0.80763558, 0.8115465 , 0.81547242, 0.81941242, 0.82337016, 0.82734445, 0.83133874, 0.8353516 , 0.83938627, 0.8434411 , 0.84751913, 0.85161848, 0.85574203, 0.85988767, 0.86405812, 0.86825106, 0.87246906, 0.87670961, 0.88097515, 0.88526296, 0.88957536, 0.89390945, 0.89826744, 0.90264628, 0.90704805, 0.91146954, 0.91591276, 0.92037436, 0.92485624, 0.92935494, 0.93387228, 0.93840468, 0.9429539 , 0.94751625, 0.95209344, 0.95668169, 0.96128266, 0.96589249, 0.97051281, 0.97513969, 0.97977474, 0.98441398, 0.98905899, 0.99370577, 0.99835586, 1.00300528, 1.00765554, 1.01230266, 1.01694816, 1.02158806, 1.02622391, 1.03085174, 1.03547312, 1.04008413, 1.04468637, 1.04927596, 1.05385454, 1.05841832, 1.06296898, 1.0675028 , 1.07202153, 1.07652154, 1.08100464, 1.08546732, 1.08991148, 1.09433372, 1.09873601, 1.10311512, 1.1074731 , 1.11180688, 1.11611861, 1.12040538, 1.12466948, 1.12890815, 1.13312383, 1.13731395, 1.14148108, 1.14562286, 1.149742 , 1.15383638, 1.15790887, 1.16195755, 1.16598549, 1.16999102, 1.17397738, 1.17794316, 1.1818918 , 1.18582215, 1.18973787, 1.19363807, 1.19752667, 1.20140305, 1.20527137, 1.20913129, 1.21298725, 1.21683922, 1.22069191, 1.22454558, 1.22840525, 1.2322715 , 1.23614967, 1.24004063, 1.24395009, 1.24787924, 1.25183414, 1.25581689, 1.25983215, 1.26388417, 1.26797736, 1.27211635, 1.27630594, 1.28055114, 1.28485714, 1.28922934, 1.29367336, 1.29819499, 1.30280027, 1.30749544, 1.31228693, 1.31718144, 1.32218585, 1.32730807, 1.33255312, 1.33793173, 1.34344851, 1.34911481, 1.35493557, 1.3609228 , 1.36708173, 1.3734251 , 1.37995843, 1.38669519, 1.39364118, 1.40081066, 1.40820971, 1.41585339, 1.42374805, 1.43190959, 1.44034462, 1.44906994, 1.45809238, 1.46742968, 1.4770889 , 1.48708874, 1.49743648, 1.50815183, 1.51924225, 1.53072853, 1.54261829, 1.55493343, 1.56768172, 1.58088623, 1.59455483, 1.6087118 , 1.62336515, 1.63854039, 1.65424559, 1.67050761, 1.68733455, 1.70475465, 1.72277602, 1.74142832, 1.76071967, 1.7806812 , 1.80132099, 1.82267171, 1.84474137, 1.86756426])

Plots#

Here are plotting examples of the fitting/estimation results.

Estimated Scaled Intensities.#

[7]:
import scipy.stats as stats
import matplotlib.pyplot as plt

fig, (density_ax, prob_ax) = plt.subplots(1, 2, figsize=(10, 5))

densities = sc.values(results[FilteredEstimatedScaledIntensities].data).values
sc.values(results[FilteredEstimatedScaledIntensities].data).hist(intensity=50).plot(
    title="Filtered Estimated Scaled Intensities\nDensity Plot",
    grid=True,
    linewidth=3,
    ax=density_ax,
)
stats.probplot(densities, dist="norm", plot=prob_ax)
prob_ax.set_title("Filtered Estimated Scaled Intensities\nProbability Plot")
[7]:
Text(0.5, 1.0, 'Filtered Estimated Scaled Intensities\nProbability Plot')
../_images/user-guide_scaling_workflow_11_1.png

Curve Fitting#

[8]:
import plopp as pp
import numpy as np
from ess.nmx.scaling import FittingResult

chebyshev_func = np.polynomial.chebyshev.Chebyshev(np.array([1, -1, 1]))
scale_function = np.vectorize(
    chebyshev_func / chebyshev_func(results[SelectedReferenceWavelength].value)
)
pp.plot(
    {
        "Original Data": results[FilteredEstimatedScaledIntensities],
        "Fit Result": results[FittingResult].fit_output,
    },
    grid=True,
    title="Fit Result [Intensities vs Wavelength]",
    marker={"Chebyshev": None, "Fit Result": None},
    linestyle={"Chebyshev": "solid", "Fit Result": "solid"},
)
[8]:
../_images/user-guide_scaling_workflow_13_0.svg
[9]:
reference_wavelength = sc.DataArray(
    data=sc.concat(
        [
            results[WavelengthScaleFactors].data.min(),
            results[WavelengthScaleFactors].data.max(),
        ],
        "wavelength",
    ),
    coords={
        "wavelength": sc.broadcast(
            results[SelectedReferenceWavelength], dims=["wavelength"], shape=[2]
        )
    },
)
wavelength_scale_factor_plot = pp.plot(
    {
        "scale_factor": results[WavelengthScaleFactors],
        "reference_wavelength": reference_wavelength,
    },
    title="Wavelength Scale Factors",
    grid=True,
    marker={"reference_wavelength": None},
    linestyle={"reference_wavelength": "solid"},
)
wavelength_scale_factor_plot.ax.set_xlim(2.8, 3.2)
reference_wavelength = results[SelectedReferenceWavelength].value
wavelength_scale_factor_plot.ax.text(
    3.0,
    0.25,
    f"{reference_wavelength=:} [{results[SelectedReferenceWavelength].unit}]",
    fontsize=8,
    color="black",
)
wavelength_scale_factor_plot
[9]:
../_images/user-guide_scaling_workflow_14_0.svg

Change Provider#

Here is an example of how to insert different filter function.

In this example, we will swap a provider that filters EstimatedScaledIntensities and provide FilteredEstimatedScaledIntensities.

After updating the providers, you can go back to Compute Desired Type and start over.

[10]:
from typing import NewType
import scipp as sc
from ess.nmx.scaling import (
    EstimatedScaledIntensities,
    FilteredEstimatedScaledIntensities,
)

# Define the new types for the filtering function
NRoot = NewType("NRoot", int)
"""The n-th root to be taken for the standard deviation."""
NRootStdDevCut = NewType("NRootStdDevCut", float)
"""The number of standard deviations to be cut from the n-th root data."""


def _calculate_sample_standard_deviation(var: sc.Variable) -> sc.Variable:
    """Calculate the sample variation of the data.

    This helper function is a temporary solution before
    we release new scipp version with the statistics helper.
    """
    import numpy as np

    return sc.scalar(np.nanstd(var.values))


# Define the filtering function with right argument types and return type
def cut_estimated_scaled_intensities_by_n_root_std_dev(
    scaled_intensities: EstimatedScaledIntensities,
    n_root: NRoot,
    n_root_std_dev_cut: NRootStdDevCut,
) -> FilteredEstimatedScaledIntensities:
    """Filter the mtz data array by the quad root of the sample standard deviation.

    Parameters
    ----------
    scaled_intensities:
        The scaled intensities to be filtered.

    n_root:
        The n-th root to be taken for the standard deviation.
        Higher n-th root means cutting is more effective on the right tail.
        More explanation can be found in the notes.

    n_root_std_dev_cut:
        The number of standard deviations to be cut from the n-th root data.

    Returns
    -------
    :
        The filtered scaled intensities.

    """
    # Check the range of the n-th root
    if n_root < 1:
        raise ValueError("The n-th root should be equal to or greater than 1.")

    copied = scaled_intensities.copy(deep=False)
    nth_root = copied.data ** (1 / n_root)
    # Calculate the mean
    nth_root_mean = nth_root.nanmean()
    # Calculate the sample standard deviation
    nth_root_std_dev = _calculate_sample_standard_deviation(nth_root)
    # Calculate the cut value
    half_window = n_root_std_dev_cut * nth_root_std_dev
    keep_range = (nth_root_mean - half_window, nth_root_mean + half_window)

    # Filter the data
    return FilteredEstimatedScaledIntensities(
        copied[(nth_root > keep_range[0]) & (nth_root < keep_range[1])]
    )


pl.insert(cut_estimated_scaled_intensities_by_n_root_std_dev)
pl[NRoot] = 4
pl[NRootStdDevCut] = 1.0

pl.compute(FilteredEstimatedScaledIntensities)
[10]:
Show/Hide data repr Show/Hide attributes
scipp.DataArray (2.98 KB)
    • wavelength: 180
    • wavelength
      (wavelength)
      float32
      Å
      2.857202, 2.8588, ..., 3.1432657, 3.144864
      Values:
      array([2.857202 , 2.8588 , 2.8619962, 2.8635945, 2.8651924, 2.8667908, 2.8683887, 2.869987 , 2.871585 , 2.8731833, 2.8747811, 2.8763795, 2.8779774, 2.8795757, 2.8811736, 2.882772 , 2.8843699, 2.8859682, 2.887566 , 2.8891644, 2.8907623, 2.8923607, 2.8939586, 2.895557 , 2.8971548, 2.8987532, 2.9003513, 2.9019494, 2.9035475, 2.9051456, 2.906744 , 2.908342 , 2.9099402, 2.9115381, 2.9131365, 2.9147344, 2.9163327, 2.9179306, 2.919529 , 2.9211268, 2.9227252, 2.924323 , 2.9259214, 2.9275193, 2.9291177, 2.9307156, 2.932314 , 2.9339118, 2.9355102, 2.937108 , 2.9387064, 2.9403043, 2.9419026, 2.9435005, 2.9450989, 2.9466968, 2.948295 , 2.949893 , 2.9514914, 2.9530892, 2.9546876, 2.9562855, 2.9578838, 2.9594817, 2.96108 , 2.962678 , 2.9642763, 2.9658742, 2.9674726, 2.9690704, 2.9706688, 2.9722667, 2.973865 , 2.975463 , 2.9770613, 2.9786592, 2.9802575, 2.9818554, 2.9834538, 2.9850516, 2.98665 , 2.9882479, 2.9898462, 2.991444 , 2.9930425, 2.9946404, 2.9962387, 2.9978366, 2.999435 , 3.0010328, 3.0026312, 3.004229 , 3.0058274, 3.0074253, 3.0090237, 3.0106215, 3.01222 , 3.0138178, 3.0154161, 3.017014 , 3.0186124, 3.0202103, 3.0218086, 3.0234065, 3.0250049, 3.0266027, 3.028201 , 3.029799 , 3.0313973, 3.0329952, 3.0345936, 3.0361915, 3.0377898, 3.0393877, 3.040986 , 3.042584 , 3.0441823, 3.0457802, 3.0473785, 3.0489764, 3.0505748, 3.0521727, 3.053771 , 3.055369 , 3.0569673, 3.0585651, 3.0601635, 3.0617614, 3.0633597, 3.0649576, 3.066556 , 3.0681539, 3.0697522, 3.07135 , 3.0729485, 3.0745463, 3.0761447, 3.0777426, 3.079341 , 3.0809388, 3.0825372, 3.084135 , 3.0857334, 3.0873313, 3.0889297, 3.0905275, 3.092126 , 3.0937238, 3.0953221, 3.0969203, 3.0985184, 3.1001165, 3.1017146, 3.1033127, 3.1049109, 3.106509 , 3.108107 , 3.1097052, 3.1113033, 3.1129014, 3.1144996, 3.1160977, 3.1176958, 3.119294 , 3.120892 , 3.1224904, 3.1240883, 3.1256866, 3.1272845, 3.128883 , 3.1304808, 3.1320791, 3.133677 , 3.1352754, 3.1368732, 3.1384716, 3.1400695, 3.1416678, 3.1432657, 3.144864 ], dtype=float32)
    • (wavelength)
      float32
      𝟙
      0.6070114, 0.6354325, ..., 1.4262968, 1.4329288
      σ = 0.007581526, 0.009966516, ..., 0.015530329, 0.015853887
      Values:
      array([0.6070114 , 0.6354325 , 0.61014795, 0.6068784 , 0.6406334 , 0.64477855, 0.63060856, 0.63542855, 0.6324167 , 0.6801704 , 0.64791816, 0.652414 , 0.6717658 , 0.6621639 , 0.6798379 , 0.7657368 , 0.6897617 , 0.6949786 , 0.68923384, 0.6942186 , 0.71312326, 0.71762073, 0.719248 , 0.71350837, 0.7397376 , 0.7398708 , 0.7309188 , 0.7652437 , 0.7870944 , 0.7594039 , 0.7531101 , 0.75556797, 0.76490945, 0.8025271 , 0.7721254 , 0.78140897, 0.7865576 , 0.80898607, 0.7910712 , 0.80424136, 0.81415737, 0.8031877 , 0.8225756 , 0.82421577, 0.8191481 , 0.83883417, 0.8289338 , 0.83124685, 0.83585805, 0.8385015 , 0.84103566, 0.8469526 , 0.8568808 , 0.8694568 , 0.85906804, 0.9218925 , 0.8691482 , 0.910457 , 0.88111806, 0.9104874 , 0.9135022 , 0.92319083, 0.90916634, 0.9476996 , 0.9178994 , 0.9017219 , 0.91642 , 1.0024371 , 0.9270845 , 0.9234043 , 0.9451939 , 0.9580411 , 0.95741826, 0.94907516, 0.9626036 , 0.9487712 , 0.9515659 , 0.9979782 , 0.9831484 , 0.9640661 , 0.9879607 , 0.9713198 , 0.9780923 , 1.0047737 , 0.98358345, 0.9882377 , 0.99075764, 1.018909 , 1.0000254 , 1.0028013 , 1.0172088 , 1.024566 , 1.0286235 , 1.0433916 , 1.1104821 , 1.0264289 , 1.0312595 , 1.0576755 , 1.0381942 , 1.0659459 , 1.0475025 , 1.0555083 , 1.0599737 , 1.0647993 , 1.1044763 , 1.0716054 , 1.085836 , 1.1003727 , 1.0791866 , 1.096032 , 1.0906415 , 1.1422418 , 1.1413152 , 1.1131383 , 1.1150991 , 1.1492105 , 1.1475223 , 1.1539438 , 1.1373259 , 1.12481 , 1.1319934 , 1.1355053 , 1.1449871 , 1.1513128 , 1.1601958 , 1.1492685 , 1.2059618 , 1.1931733 , 1.2093873 , 1.172439 , 1.1882433 , 1.2029705 , 1.2417048 , 1.1958982 , 1.192574 , 1.2114031 , 1.2002187 , 1.2199563 , 1.2094076 , 1.256482 , 1.2189393 , 1.2234412 , 1.2631079 , 1.2533275 , 1.246985 , 1.2448152 , 1.2749248 , 1.2598064 , 1.2584211 , 1.26102 , 1.2679971 , 1.2830582 , 1.2782192 , 1.2803183 , 1.2984796 , 1.2955241 , 1.308334 , 1.3730578 , 1.307733 , 1.3506969 , 1.316869 , 1.3708428 , 1.3499488 , 1.3652765 , 1.3402617 , 1.3605239 , 1.3775644 , 1.3633896 , 1.385249 , 1.3687915 , 1.381712 , 1.3882626 , 1.3878992 , 1.4007676 , 1.4101408 , 1.4342211 , 1.4354299 , 1.4360559 , 1.4262968 , 1.4329288 ], dtype=float32)

      Variances (σ²):
      array([5.74795376e-05, 9.93314388e-05, 3.98175434e-05, 5.14143139e-05, 6.59856814e-05, 6.35042234e-05, 5.12313964e-05, 5.03618030e-05, 5.48519383e-05, 6.64681502e-05, 5.44289178e-05, 5.28388628e-05, 6.18483537e-05, 6.49031790e-05, 5.17519657e-05, 1.58387702e-04, 5.97466023e-05, 6.94945847e-05, 6.17728219e-05, 6.55613185e-05, 6.64384133e-05, 6.10811840e-05, 6.79638761e-05, 6.27376867e-05, 6.04419656e-05, 5.94244702e-05, 6.86752101e-05, 6.63347600e-05, 1.16998461e-04, 7.06466308e-05, 7.18489682e-05, 6.07973707e-05, 6.64159816e-05, 9.21256287e-05, 7.51157058e-05, 7.64880751e-05, 7.49804167e-05, 8.41489455e-05, 8.22133006e-05, 8.44401584e-05, 8.60130967e-05, 8.42609152e-05, 9.90535991e-05, 8.61488079e-05, 8.50271390e-05, 8.76785271e-05, 8.34146922e-05, 7.02328107e-05, 1.00364952e-04, 9.05520501e-05, 9.42670522e-05, 9.19481608e-05, 9.79183460e-05, 9.65009240e-05, 8.78656865e-05, 1.20414938e-04, 9.97904062e-05, 1.23560938e-04, 9.40254249e-05, 1.04686864e-04, 1.14489587e-04, 1.22188212e-04, 1.13109927e-04, 1.28414715e-04, 1.25353123e-04, 1.21911195e-04, 9.33227857e-05, 1.74027431e-04, 1.04913488e-04, 1.25347389e-04, 1.10791552e-04, 1.26701852e-04, 1.09050285e-04, 1.24742073e-04, 1.30781860e-04, 1.05761384e-04, 1.11854650e-04, 1.41779499e-04, 1.31608744e-04, 1.30743283e-04, 1.20826429e-04, 1.26319152e-04, 1.34927235e-04, 1.38158532e-04, 1.27356092e-04, 1.19864315e-04, 1.11187808e-04, 1.48789157e-04, 1.01213933e-04, 1.20698089e-04, 1.43554687e-04, 1.38697913e-04, 1.25700622e-04, 1.37931595e-04, 1.61406861e-04, 1.37677387e-04, 1.58749288e-04, 1.38160191e-04, 1.55284506e-04, 1.42545759e-04, 1.27560212e-04, 1.42550489e-04, 1.49925720e-04, 1.52065113e-04, 1.55441434e-04, 1.23287304e-04, 1.55261441e-04, 1.44539532e-04, 1.24982442e-04, 1.57909060e-04, 1.49287778e-04, 2.06205310e-04, 1.90313207e-04, 1.77068432e-04, 1.71384701e-04, 1.79194976e-04, 1.81565265e-04, 1.82234216e-04, 1.63582881e-04, 1.53892339e-04, 1.61651551e-04, 1.55816175e-04, 1.77663547e-04, 1.43336118e-04, 1.79886978e-04, 1.44532270e-04, 2.15440523e-04, 1.78006536e-04, 1.68227794e-04, 1.43395737e-04, 1.68639366e-04, 2.08071913e-04, 2.88074225e-04, 1.69707899e-04, 2.09134174e-04, 1.68616767e-04, 1.68781975e-04, 1.89460785e-04, 1.70585758e-04, 2.13972060e-04, 1.83197044e-04, 1.77821799e-04, 2.12173894e-04, 1.94450797e-04, 2.00403243e-04, 2.15643304e-04, 1.80441697e-04, 2.11129067e-04, 2.12913204e-04, 2.02940195e-04, 1.92602383e-04, 1.97268106e-04, 2.11366874e-04, 2.23142299e-04, 2.23695009e-04, 1.99477669e-04, 2.05906850e-04, 2.75295926e-04, 2.21289927e-04, 2.34401392e-04, 2.12831786e-04, 2.33427883e-04, 2.35852815e-04, 2.32453123e-04, 2.25265467e-04, 2.60025292e-04, 2.28782679e-04, 2.31453407e-04, 2.34481500e-04, 2.85590824e-04, 3.04085901e-04, 2.48227967e-04, 2.44201190e-04, 2.40701804e-04, 2.76635052e-04, 2.38082663e-04, 2.61420006e-04, 2.59264576e-04, 2.41191126e-04, 2.51345773e-04], dtype=float32)