English Français

Documentation / Manuel utilisateur en C++ : PDF version

III.5. The random fields

III.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 , or in . 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 III.12.

Figure III.12. Gaussian Random Field

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 III.13 and for Sine Cardinal in Figure III.14.

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

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

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

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

/language/en