Skip to content

Note

Click here to download the full example code

section validation plates

you check a block model one section at a time: true block edges (so a sub-blocked model shows its real geometry instead of a resampled raster), the estimate on those blocks, the lens behind it and its drill-hole composites, all on one plate and one color scale. section draws true edges whenever the cut is normal to one of the model's own axes; slab overlays the lens trace and the composites on the same plane. sample and scatter show whether the model honors the composites.

import sys
from pathlib import Path

HERE = Path(__file__).parent if "__file__" in globals() else Path.cwd()
sys.path.insert(0, str(HERE.parents[1]))
import boitata as bt
import matplotlib.pyplot as plt
import numpy as np
from common import save

sub-block the parent grid to one lens (sub-blocks), then estimate Zn on the sub-blocks from the composites inside the lens.

data = bt.datasets.stacked_sulphide_lenses()
lens = data["lens_2"]
parents = bt.BlockModel.from_extents(lens, size=(40, 40, 20), buffer=10, snap=True)
model = parents.subblock([(lens, "inside", "ore")], 4, fill="waste")

holes = bt.Drillholes.from_tables(data)
composites = holes.composite(2.0, ["ZN_PCT"])
inside = composites.drop_null("ZN_PCT")
inside = inside.filter(lens.contains(inside.coords))
ore = model["domain"] == "ore"
grade = np.full(len(model), np.nan)
estimator = bt.InverseDistance(bt.Search(100, max_samples=12)).fit(inside, "ZN_PCT")
grade[ore] = estimator.predict(model.coords[ore])
model = model.with_column("zn", grade)

here the cut is an east-west plane, normal to one of the model's axes, so section draws true block edges. slab overlays the lens trace and the composites within 25 m of that same plane, on the same color scale.

plane = (lens.coords.mean(axis=0), 90, 90)
fig, ax = plt.subplots(figsize=(9, 6), layout="constrained")
bt.plot.section(model, "zn", plane=plane, cmap="viridis", vmin=0, vmax=8, ax=ax)
bt.plot.slab(
    composites,
    "ZN_PCT",
    plane=plane,
    thickness=25,
    meshes=lens,
    cmap="viridis",
    vmin=0,
    vmax=8,
    colorbar=False,
    ax=ax,
)
ax.set(title="East-west section: sub-block edges, lens trace, composites")
save(fig, "section")

East-west section: sub-block edges, lens trace, composites

adherence

adherence is a resubstitution test: it asks whether the model honors the holes it came from, which cross-validation leaves aside. sample reads the sub-block holding each composite, and scatter gives the 1:1 line and the regression slope.

paired = model.contains(inside.coords)
fig, ax = plt.subplots(figsize=(5, 5), layout="constrained")
bt.plot.scatter(inside["ZN_PCT"][paired], model.sample(inside.coords, "zn")[paired], ax=ax)
ax.set(xlabel="composite Zn (%)", ylabel="block Zn (%)", title=f"Adherence, {paired.sum()} composites")
save(fig, "adherence")

Adherence, 280 composites

Total running time of the script: ( 0 minutes 0.275 seconds)

Download Python source code: example_10_07.py

Download Jupyter notebook: example_10_07.ipynb

Gallery generated by mkdocs-gallery