3.5. The random fields
The random fields allow to take into account the spatial characteristics of a random variable.
A TDataServer 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:
# Define the DataServer
tds = DataServer.TDataServer("TDSField", "Weight as Field")
tds.addAttribute(DataServer.TAttribute("x", 1, 51))
tds.addAttribute(DataServer.TAttribute("y", 1, 51))
tds.addAttribute(DataServer.TAttribute("Weight"))
# Gaussian Sampler Field
tsf = Sampler.TSamplerField(tds) # 1
tsf.SetScaleFactor(10.0)
tsf.SetRandomFunction(1000)
tsf.setVariogram("gauss")
tsf.SetVariance(1.0)
tsf.generateSample() # 2
# Graphic
canvas = ROOT.TCanvas()
canvas.Divide(1,2)
canvas.cd(1)
tds.Draw("Weight:y:x")
canvas.Modified()
canvas.Update()
canvas.cd(2)
tsf.Draw2D("x", "y", "tri2Z") # 3
Allocation of a pointer of a random variable sampler with variables described in the
TDataServer“tds” that is based on a “gaussian” variogram type. The constructor prototype isTSamplerField(tds, option = "Gauss").The
generateSample()method generates a sample which will be saved in theTDataServer.This step, along with the other drawing method few line earlier, gives the results shown in Figure 3.12.
Figure 3.12 Gaussian Random Field
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 Figure 3.13 and for Sine Cardinal in Figure 3.14.
Figure 3.13 Gaussian variograms. Several configurations (in terms of scale factor and variance parameters)
are shown as well.
Figure 3.14 Sine cardinal variograms. Several configurations (in terms of scale factor and variance
parameters) are shown as well.