darsia.WeightedGeometry#
- class WeightedGeometry(weight, space_dim, num_voxels, dimensions=None, voxel_size=None, weight_source=None, **kwargs)[source]#
Bases:
GeometryGeometry 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:
- weight
floatorarray Weight compatible with geometry.
- space_dim
int See Geometry.
- num_voxels
tuple See Geometry.
- dimensions
list See Geometry.
- voxel_size
list See Geometry.
- weight_source
Callable,optional Gives the weight (NaN replaced by zero, as weight after the replacement) whenever
weightis asked for; then the weight is not kept. Otherwise a copy of weight is kept.
- weight
- Raises:
ValueErrorIf 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 of the geometry, a scalar or an array (NaN replaced by zero).
Effective voxel volume in 3d.
Voxel volume for data of the current shape (the voxel volume itself, or a resized one, see _prepare_cached_voxel_volume).
space_dimSpatial dimension of geometry.
num_voxelsNumber of voxels in each spatial direction.
voxel_sizeDimensions of a single voxel.
dimensionsDimensions of geometry.
- subregion(roi)[source]#
Extract subregion of the geometry.
- Parameters:
- roi
darsia.CoordinateArray Region of interest.
- roi
- Returns:
WeightedGeometrySubregion 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).