SNESIM ¶
SNESIM (Strebelle, 2002): categories, or classes of values, simulated from the patterns of a training image.
The patterns around each cell of the image are counted once into search
trees, one per multigrid level and template class, on simulate. A node
reads the categories at the template_size cells nearest to it and draws
its own from the image's counts of that data event. Patterns are read in
cell index space, so the targets' cells match the image's cells one to
one, unless simulate turns or stretches them with local anisotropy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ti
|
BlockModel or dict
|
Regular or masked training image; null and masked-out cells are not
patterns. A dict |
required |
column
|
str
|
Column of |
required |
template_size
|
int
|
Cells every node reads, nearest first. |
40
|
n_levels
|
int
|
Coarse grids above the finest, at spacings |
3
|
min_replicates
|
int
|
Fewest replicates of a data event in the image; the farthest informed cells are dropped until enough remain, down to the image's proportions. |
10
|
target_proportions
|
sequence of float
|
Proportion of each code |
required |
servo
|
float
|
Servosystem strength in [0, 1): a node draws from
|
0.5
|
angle_step
|
float
|
Degrees the local angles of |
10.0
|
categorical
|
bool
|
Whether |
required |
cutoffs
|
sequence of float
|
Strictly ascending values cutting a continuous image into classes, which SNESIM simulates as categories. Each simulated cell then takes the value of a cell of its image in its class: of 32 drawn at random, the one whose 8 nearest neighbors best match the values already simulated around it. By default the quartiles of the image's values; few classes keep the patterns frequent enough to count. Ignored for a categorical image. |
required |
Examples:
>>> grid = bt.BlockModel((0, 0), (1, 1), (80, 80))
>>> ti = bt.object_training_image(
... grid,
... [{"shape": "channel", "code": 1, "proportion": 0.3, "width": 6,
... "azimuth": (80, 100), "amplitude": 6, "wavelength": 50}],
... )
>>> summary = bt.SNESIM(ti, "facies", template_size=24).simulate(grid, n=4)
categorical
property
¶
categorical
Whether the training images hold codes rather than continuous values.
n_classes
property
¶
n_classes
Template classes whose search trees the last simulate used: one
per training image in use, times the distinct rounded local
anisotropies.
fit
method descriptor
¶
fit(coords, values)
Takes hard data: codes 0..k of a categorical training image, or
values of a continuous one, at coords. Each goes to the target cell
holding it, several in one cell to their most frequent category or
class (a cell keeps the mean of the values in that class), and every
realization reproduces it; data outside the targets are ignored.
Without fit, realizations are unconditional.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
(array_like, PointSet or BlockModel)
|
Data locations, |
required |
values
|
array_like or str
|
Code or value of each datum, or the column of |
required |
Returns:
| Type | Description |
|---|---|
SNESIM
|
This simulator. |
from_parquet
staticmethod
¶
from_parquet(path)
Reads to_parquet output; raises InvalidInput on another class's file
or a newer format.
simulate
method descriptor
¶
simulate(
targets,
*,
n=100,
seed=0,
keep=None,
soft=None,
anisotropy=None,
domains=None,
domain_column=None,
)
Summary of n realizations, each seeded from seed and its index,
the same for any number of threads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
targets
|
BlockModel
|
Regular or masked grid; one category per row. |
required |
n
|
int
|
Realizations. |
100
|
seed
|
int
|
Seed of the realizations. |
0
|
keep
|
bool or sequence of int
|
Realizations to return beside the summary. |
None
|
soft
|
sequence of str or array_like
|
Soft probabilities: one column of |
None
|
anisotropy
|
LocalAnisotropy
|
Turns and stretches the patterns at each target, taken from its
nearest location. At angles 0 the image's y axis runs north, along
the major axis, its x axis east, against the semi-major axis, and
its z axis up, along the minor axis; the angles (azimuth clockwise
from north, dip positive down, rake; azimuth only on a grid one
cell thick) turn them as they turn a variogram. The image's
structures grow by |
None
|
domains
|
array_like or label
|
Domain of each target, picking its training image when |
None
|
domain_column
|
str
|
Column of |
None
|
Returns:
| Type | Description |
|---|---|
CategoricalSummary or SimulationSummary
|
Probabilities, most likely category and entropy per target for a categorical training image; mean and variance per target for a continuous one. |
Raises:
| Type | Description |
|---|---|
InvalidInput
|
If |
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