Skip to content

object_training_image builtin

object_training_image(
    grid, objects, *, background=0, column="facies", seed=0
)

Categorical training image drawn from channels and ellipsoids.

The image starts as background. Each object set, in order, adds objects of its shape with its code at random places until the code covers its proportion of the cells. A later set overwrites the cells of the earlier ones, so their final shares can end below their proportions; the last object of a set can overshoot. Objects cut by the edges of the grid are as frequent as whole ones.

Every size and angle of a set is a number, or a (min, max) range drawn uniformly for each object. Lengths are in the units of the cell sizes and angles in degrees, in world coordinates: azimuth clockwise from north, dip positive down.

  • {"shape": "channel", ...}: a channel across the whole grid, with a flat top and a lens-shaped cross-section, thickness deep at its centreline. Keys width, thickness (optional on a 2D grid), azimuth (default 0), amplitude (how far the centreline swings to each side, default 0 for straight channels) and wavelength (distance between two bends on the same side, needed with amplitude). On a 2D grid, a sinuous band.
  • {"shape": "ellipsoid", ...}: keys radii (major, semi-major, minor; the minor radius is optional on a 2D grid), azimuth, dip and rake of the major axis (default 0). On a 2D grid, an ellipse along azimuth.

Every set also has code, an integer 0 to 254, and proportion, above 0 and below 1.

Parameters:

Name Type Description Default
grid BlockModel

The grid whose geometry the image takes, 2D (one layer) or 3D, optionally rotated.

required
objects sequence of dict

The object sets, in the order they are laid down.

required
background int

Code of the cells no object covers, 0 to 254.

0
column str

Name of the code column.

"facies"
seed int

The same seed and objects give the same image on any number of threads.

0

Returns:

Type Description
BlockModel

A regular model on the geometry of grid with the codes in column.

Raises:

Type Description
InvalidInput

If a set has an unknown shape or key, a size is not positive, a range is reversed, a proportion is outside (0, 1), or a set has not reached its proportion after 100 000 objects.

Examples:

>>> grid = bt.BlockModel((0, 0, 0), (1, 1, 1), (120, 120, 1))
>>> ti = bt.object_training_image(
...     grid,
...     [
...         {"shape": "channel", "code": 1, "proportion": 0.25, "width": 8,
...          "azimuth": (-20, 20), "amplitude": 8, "wavelength": 60},
...         {"shape": "ellipsoid", "code": 2, "proportion": 0.05, "radii": (10, 6)},
...     ],
...     seed=0,
... )

used in