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
    TDataServer *tds = new TDataServer("TDSField", "Weight as Field");
    tds->addAttribute( new URANIE::DataServer::TAttribute("x", 1, 51));
    tds->addAttribute( new URANIE::DataServer::TAttribute("y", 1, 51));
    tds->addAttribute( new URANIE::DataServer::TAttribute("Weight"));

    // Gaussian Sampler Field
    TSamplerField * tsf = new TSamplerField(tds);  // 1
    tsf->SetScaleFactor(10.0);
    tsf->SetRandomFunction(1000);
    tsf->setVariogram("gauss");
    tsf->SetVariance(1.0);

    tsf->generateSample();  // 2

    // Graphic
    TCanvas* canvas = new 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

  1. 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 is TSamplerField(URANIE::DataServer::TDataServer *tds, Option_t *option = "Gauss").

  2. The generateSample() method generates a sample which will be saved in the TDataServer.

  3. This step, along with the other drawing method few line earlier, gives the results shown in Figure 3.12.

../_images/SamplerFieldgaussWeightyx.png

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.

../_images/GaussianField.png

Figure 3.13 Gaussian variograms. Several configurations (in terms of scale factor and variance parameters) are shown as well.

../_images/Sine_cardinalField.png

Figure 3.14 Sine cardinal variograms. Several configurations (in terms of scale factor and variance parameters) are shown as well.