Selectivity curves¶

This file demonstrates the use of Selectivity curves

Import packages¶

In [1]:
import matplotlib.pyplot as plt
import gstlearn as gl
import gstlearn.plot as gp
import gstlearn.document as gdoc

gdoc.setNoScroll()

Reading the Grid file

In [2]:
filename = gdoc.loadData("Selectivity", "Grid_100.ascii")
db100 = gl.DbGrid.createFromNF(filename)
db100.display()
Data Base Grid Characteristics
==============================

Data Base Summary
-----------------
File is organized as a regular grid
Space dimension              = 2
Number of Columns            = 4
Total number of samples      = 100

Grid characteristics:
---------------------
Origin :       0.000      0.000
Mesh   :       1.000      1.000
Number :          10         10

Variables
---------
Column = 0 - Name = rank - Locator = NA
Column = 1 - Name = x1 - Locator = x1
Column = 2 - Name = x2 - Locator = x2
Column = 3 - Name = z1 - Locator = z1

Plotting the grid of samples

In [3]:
gp.raster(db100, name="z1")
gp.decoration(title="Data")
No description has been provided for this image
In [4]:
gp.literal(db100, name="z1")
gp.decoration(title="Data")
No description has been provided for this image
In [5]:
gp.histogram(db100, name="z1", bins=20)
gp.decoration(title="Data")
No description has been provided for this image
In [6]:
gl.dbStatisticsMono(db100, ["z1"], [gl.EStatOption.MEAN, gl.EStatOption.VAR])
Out[6]:
          Mean    Variance
z1       1.531       1.615

Creating the grid of blocks by averaging samples 2 by 2

In [7]:
db25 = gl.DbGrid.create(nx=[5, 5], dx=[2, 2], x0=[0.5, 0.5])
dum = gl.dbStatisticsOnGrid(
    db100, db25, gl.EStatOption.MEAN, namconv=gl.NamingConvention("")
)
In [8]:
gp.raster(db25, name="z1")
gp.decoration(title="Blocks")
No description has been provided for this image
In [9]:
gp.literal(db25, name="z1")
gp.decoration(title="Blocks")
No description has been provided for this image
In [10]:
gp.histogram(db25, name="z1", bins=10)
gp.decoration(title="Blocks")
No description has been provided for this image
In [11]:
gl.dbStatisticsMono(db25, ["z1"], [gl.EStatOption.MEAN, gl.EStatOption.VAR])
Out[11]:
          Mean    Variance
z1       1.531       0.974

Creating a samping grid keeping only the upper right corner sample for each block

In [12]:
db25s = gl.DbGrid.create(nx=[5, 5], dx=[2, 2], x0=[0.5, 0.5])
dum = gl.migrate(db100, db25s, name="z1", namconv=gl.NamingConvention(""))
In [13]:
gp.raster(db25s, name="z1")
gp.decoration(title="Sampling")
No description has been provided for this image
In [14]:
gp.literal(db25s, name="z1")
gp.decoration(title="Sampling")
No description has been provided for this image
In [15]:
gl.dbStatisticsMono(db25s, ["z1"], [gl.EStatOption.MEAN, gl.EStatOption.VAR])
Out[15]:
          Mean    Variance
z1       1.364       1.165

Using the Selectivity Curves¶

We compare the selectivity curves between Data and Blocks:

In [16]:
selectivity = gl.Selectivity(100)
table100 = selectivity.eval(db100, True)
table25 = selectivity.eval(db25, True)
table25s = selectivity.eval(db25s, True)
In [17]:
table100.getColumnNames()
Out[17]:
('Z-Cut', 'T-estim', 'Q-estim', 'B-estim', 'M-estim')
  • Ore tonnage as a function of the cutoff
In [18]:
gp.table(table100, [1, 0], color="blue")
gp.table(table25, [1, 0], color="red")
gp.decoration(title="T(z)")
No description has been provided for this image
  • Metal as a function of the cutoff
In [19]:
gp.table(table100, [2, 0], color="blue")
gp.table(table25, [2, 0], color="red")
gp.decoration(title="Q(z)")
No description has been provided for this image
  • Recovered grade as a function of the cutoff
In [20]:
gp.table(table100, [4, 0], color="blue")
gp.table(table25, [4, 0], color="red")
gp.decoration(title="M(z)")
No description has been provided for this image
  • Conventional Benefit as a function of the cutoff
In [21]:
gp.table(table100, [3, 0], color="blue")
gp.table(table25, [3, 0], color="red")
gp.decoration(title="B(z)")
No description has been provided for this image
  • Metal as a function of Ore Tonnage
In [22]:
gp.table(table100, [2, 1], color="blue")
gp.table(table25, [2, 1], color="red")
plt.plot([0.0, 1.0], [0.0, db100.getMean("z1")], linestyle="dashed")
gp.decoration(title="Q(T)")
No description has been provided for this image

Regressions¶

Display regressions

In [23]:
gp.correlation(
    db25, namex="z1", namey="z1", db2=db25s, asPoint=True, diagLine=True, regrLine=True
)
gp.decoration(ylabel="Blocks", xlabel="Samples", title="Block vs. Sample")
No description has been provided for this image
In [24]:
gp.correlation(
    db25s, namex="z1", namey="z1", db2=db25, asPoint=True, diagLine=True, regrLine=True
)
gp.decoration(xlabel="Blocks", ylabel="Samples", title="Sample vs. Block")
No description has been provided for this image

Comparing selectivity curves¶

In [25]:
gp.table(table100, [2, 1], color="blue")
gp.table(table25, [2, 1], color="red")
gp.table(table25s, [2, 1], color="green")
plt.plot([0.0, 1.0], [0.0, db100.getMean("z1")], linestyle="dashed")
plt.plot([0.0, 1.0], [0.0, db25s.getMean("z1")], linestyle="dashed")
gp.decoration(title="Q(T)")
No description has been provided for this image
In [ ]: