Skip to content

SGS

Sequential Gaussian simulation. variogram is the normal-score variogram (unit sill); data are normal-scored internally, with optional declustering weights, and realizations are back-transformed.

With a trend at fit, the data are normal-scored within classes equal-probability classes of the trend (a stepwise conditional transform of [trend, values]); variogram is then the variogram of those scores, and each node is back-transformed within the class of its trend.

search is a Search, or a sequence of them as passes: each node takes the first that finds min_samples among the data, as kriging by passes does, or the last when none does, and is simulated from that pass's neighbors among the data and the nodes already simulated.

With domains at fit, each domain is transformed on its own, with the declustering weights and within its own trend classes, and its nodes are back-transformed through its transform; variogram is the one normal-score variogram of every domain. Search.soft lets data and nodes already simulated of another domain inform a node within the soft distance, each as its grade (and trend) transformed through the node's domain; boundaries are hard without it. high_grade compares grades, of data and of simulated nodes, with its threshold; a clamped neighbor is kriged as the score of the threshold. One random path visits the nodes of every domain. Simulated domains at simulate, one realization of the domains per realization of the grades, carry the uncertainty of the domains into the grades.

correlation property

correlation

Correlation of the primary and secondary normal scores used in collocated cosimulation; None when fitted without secondary.

fit method descriptor

fit(
    coords,
    values,
    *,
    weights=None,
    holes=None,
    trend=None,
    domains=None,
    domain_column=None,
    secondary=None,
    correlation=None,
)

Takes the conditioning data. Samples sharing a location keep the first, with a warning naming their holes.

Parameters:

Name Type Description Default
coords (array_like, shape(n, 2) or (n, 3), PointSet or BlockModel)
required
values array_like, shape (n,), or str

Values, or the column of coords holding them; so for weights, holes and trend.

required
weights array_like or str

Declustering weights, for every normal score.

None
holes array_like or str

Drill-hole ids or names, for max_per_hole.

None
trend array_like or str

Trend at the data, from any model or estimator; simulate then needs the trend at the targets.

None
domains array_like or label

Domain label of each sample, or one label for all: strings, numbers or booleans. Samples sharing a location in different domains are all kept.

None
domain_column str

The column of coords holding the domains, instead of domains.

None
secondary array_like or str

A secondary variable at the data, for collocated cosimulation: simulate then needs it at every target, and draws each node from the collocated simple cokriging of its normal score from its neighbors and the secondary score at the node, under the Markov model (the cross-covariance is correlation times the primary covariance). The secondary is normal-scored with the declustering weights.

None
correlation float

Correlation of the primary and secondary normal scores, in [-1, 1]; by default the weighted correlation of their scores at the data. 0 simulates as without secondary.

None

Raises:

Type Description
InvalidInput

If a Search.soft names a domain without samples, or has no domains to work on, or both domains and domain_column are given, or correlation comes without secondary or outside [-1, 1].

from_parquet staticmethod

from_parquet(path)

Reads to_parquet output; raises InvalidInput on another class's file or a newer format.

passes method descriptor

passes(
    targets,
    *,
    anisotropy=None,
    domains=None,
    domain_column=None,
)

The search pass of every target.

A target takes the first search that finds min_samples among the data, whatever the realization; with the same searches, data, holes and variogram anisotropy this is the "pass" of kriging's predict(diagnostics=True).

Parameters:

Name Type Description Default
targets array_like or BlockModel
required
anisotropy LocalAnisotropy

As in simulate.

None
domains array_like or label

As in simulate.

None
domain_column str

As in simulate.

None

Returns:

Type Description
ndarray

The pass, 1-based; NaN where no search finds enough data, and simulate uses the last.

simulate method descriptor

simulate(
    targets,
    *,
    n=100,
    seed=0,
    cutoffs=None,
    quantiles=Ellipsis,
    tolerances=Ellipsis,
    keep=None,
    anisotropy=None,
    blocks=None,
    window=None,
    groups=None,
    trend=None,
    domains=None,
    domain_column=None,
    secondary=None,
    path=None,
    batch=None,
    grade_tonnage_cutoffs=None,
    density=None,
    tonnage=None,
    categories=None,
)

Summary of n realizations at targets, each seeded from seed and its index, with the probability and mean above each of cutoffs and the values at quantiles; the (n, targets) realizations only when keep. anisotropy (a LocalAnisotropy) orients each node's variogram and search. With blocks (a coarser BlockModel), each realization is averaged to its blocks, weighted by node volume, and summarized at block support; nodes outside every block are ignored and a block holding no node is an error. window, (dx, dy) or (dx, dy, dz) (dz 0 when left out), gives each row (the blocks when given, else the targets) the average of the rows whose center lies in the box of that size centered on it, along the model axes of a BlockModel or the world axes of points; boxes overlap, stop at the edge of the rows, weigh rows by volume and leave out NaN. Regular and masked models use summed-area tables, so the cost does not grow with the box. groups, a label per row or a column name, such as the period of a mine plan, summarizes the mean of each distinct label instead, weighted by volume, or by tonnes with grade_tonnage_cutoffs so that grade times tonnes is the metal, one row per label in numpy.unique order (numbers before text), named by SimulationSummary.groups; null labels belong to none, NaN values are left out, and grade_tonnage_cutoffs counts each volume with its rows' tonnes. Give one of window or groups. trend, needed when fitted with one, is the trend at the targets: an array, or the name of a column of PointSet or BlockModel targets; each node is back-transformed within its trend class before any averaging. domains, needed when fitted with them, labels the targets, or is one label for all; a target in a domain without samples raises InvalidInput. Simulated domains, an (n, targets) array such as the realizations of SIS or Plurigaussian, give each realization its own: realization k of the grades is simulated within row k. domain_column, instead of domains, names the column of PointSet or BlockModel targets holding them. secondary, needed when fitted with one, is the secondary variable at the targets: an array, the name of a column of PointSet or BlockModel targets, or an (n, targets) array such as the realizations of a simulation of the secondary, realization k then cosimulated with row k. path orders the nodes. On a regular or masked BlockModel every realization follows, by default, one multigrid path (coarse cells first), so each node's neighbors and kriging weights are found once for a batch of realizations; a node on a datum takes its grade. "random" draws a new random path per realization, which points, sub-blocked models, local anisotropy, simulated domains, octant searches, high-grade restrictions and soft boundaries need and the default then uses; "shared" raises InvalidInput where it cannot run. batch, on a shared path, is the number of realizations simulated together, by default as many as fit in 70 % of the free memory; a run whose quantiles, tolerances and kept realizations alone exceed that memory raises InvalidInput. Realizations do not depend on batch. grade_tonnage_cutoffs accumulates, per realization, the tonnes, metal and mean grade of the summary rows (the blocks when given) at or above each cutoff, as grade_tonnage counts them: tonnes from density, a number, array or column, times each row's block volume (1 per point), or tonnage per row; one curve per categories label besides all rows. SimulationSummary.grade_tonnage reads them. tolerances, such as (0.15,), gives SimulationSummary.precision, the fraction of realizations within r * |mean| of the mean for each tolerance r; like quantiles, it holds every value.

to_parquet method descriptor

to_parquet(path)

Writes arrays as Parquet columns and parameters as JSON in the file metadata; from_parquet reads it back.

used in