darsia.WeightedGeometry#

class WeightedGeometry(weight, space_dim, num_voxels, dimensions=None, voxel_size=None, weight_source=None, **kwargs)[source]#

Bases: Geometry

Geometry with weighted volume.

The voxel volume is the voxel size times the weight. Voxels where the weight is NaN (e.g. a facies without porosity, a gap in the depth measurements) contribute no volume: the weight is zero there, in the whole geometry as in its regions. Such voxels are reported by a warning when the geometry is built.

Constructor for extruded two-dimensional geometry.

Parameters:
weightfloat or array

Weight compatible with geometry.

space_dimint

See Geometry.

num_voxelstuple

See Geometry.

dimensionslist

See Geometry.

voxel_sizelist

See Geometry.

weight_sourceCallable, optional

Gives the weight (NaN replaced by zero, as weight after the replacement) whenever weight is asked for; then the weight is not kept. Otherwise a copy of weight is kept.

Raises:
ValueError

If weight has wrong dimensions.

Methods

integrate(data)

Integrate data over the entire geometry.

make_extensive(data)

Convert intensive values to integrated per-cell values on geometry grid.

normalize(img, img_ref[, return_ratio])

Normalize image with respect to another one, such that both have the same integral.

subregion(roi)

Extract subregion of the geometry.

voxel_volumes(shape)

Voxel volumes with which integrate weights data of the given shape.

Attributes

weight

Weight of the geometry, a scalar or an array (NaN replaced by zero).

voxel_volume

Effective voxel volume in 3d.

cached_voxel_volume

Voxel volume for data of the current shape (the voxel volume itself, or a resized one, see _prepare_cached_voxel_volume).

space_dim

Spatial dimension of geometry.

num_voxels

Number of voxels in each spatial direction.

voxel_size

Dimensions of a single voxel.

dimensions

Dimensions of geometry.

subregion(roi)[source]#

Extract subregion of the geometry.

Parameters:
roidarsia.CoordinateArray

Region of interest.

Returns:
WeightedGeometry

Subregion geometry. It keeps its weight, or computes it when asked for (see _region_weight_source); it does not reference this geometry.

cached_voxel_volume#

Voxel volume for data of the current shape (the voxel volume itself, or a resized one, see _prepare_cached_voxel_volume). It may be the same array as voxel_volume: neither of them may be modified in place.

voxel_volume#

Effective voxel volume in 3d.

property weight#

Weight of the geometry, a scalar or an array (NaN replaced by zero).