--- myst: substitutions: sentence: python: "**`TSamplerField(tds, option = \"Gauss\")`**" cpp: "**`TSamplerField(URANIE::DataServer::TDataServer *tds, Option_t *option = \"Gauss\")`**" bloc: python: 6-29 cpp: 6-28 --- # The random fields The random fields allow to take into account the spatial characteristics of a random variable. A {{tds}} is associated to a spatial random variable from ${\rm I\!R}$, ${\rm I\!R^2}$ or ${\rm I\!R^3}$ in ${\rm I\!R}$. Currently only one **Spectral** method, with two types of variograms (**Gaussian** and **Sine Cardinal**), is available in {{uranie}}. For instance, {{uranie}} code is: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/sampler/bloc_codes_chapter/" + language + "/fields." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc[language] + "\n" + "```" }} 1. Allocation of a pointer of a random variable sampler with variables described in the {{tds}} "tds" that is based on a "gaussian" variogram type. The constructor prototype is {{sentence[language]}}. 2. The `generateSample()` method generates a sample which will be saved in the {{tds}}. 3. This step, along with the other drawing method few line earlier, gives the results shown in {numref}`sampler_gaussian_random_field`. {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/sampler/bloc_codes_chapter/cpp/producePlotsSampler/SamplerFieldgaussWeightyx.png\n" ":align: center\n" ":name: sampler_gaussian_random_field\n" + figure_scale + "\n" "\n" "Gaussian Random Field\n" "```" }} It is possible to vary the value of the parameters used to construct the field, leading to different shapes. Examples of this are shown for the two implemented types of variograms, Gaussian in {numref}`sampler_tgaussianfield_plots` and for Sine Cardinal in {numref}`sampler_tsinecardfield_plots`. {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/sampler/bloc_codes_chapter/python/GaussianField.png\n" ":align: center\n" ":name: sampler_tgaussianfield_plots\n" + figure_scale + "\n" "\n" "Gaussian variograms. Several configurations (in terms of scale factor and variance parameters) are shown as well.\n" "```" }} {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/sampler/bloc_codes_chapter/python/Sine_cardinalField.png\n" ":align: center\n" ":name: sampler_tsinecardfield_plots\n" + figure_scale + "\n" "\n" "Sine cardinal variograms. Several configurations (in terms of scale factor and variance parameters) are shown as well.\n" "```" }}