magneticalc.SamplingVolume.SamplingVolume

# ``magneticalc`.`SamplingVolume`.`SamplingVolume``

class documentation

`class SamplingVolume(Validatable):`

Constructor: `SamplingVolume()`

View In Hierarchy

Sampling volume class.

Method | `__init__` | Initializes an empty sampling volume, with zero bounds and no constraints.
Method | `recalculate` | Recalculates the sampling volume points, permeabilities, labels and neighborhoods according to the constraints.
Method | `set` | Sets the parameters.
Method | `set_bounds_nearest` | Adjusts this volume's bounding box to fully enclose a 3D wire curve. This expands the bounding box to the next integer grid coordinates.
Method | `set_padding_nearest` | Shrinks or enlarges this volume's bounding box by some amount, in each direction, symmetrically. This shrinks or expands the bounding box to the next integer grid coordinates.
Instance Variable | `resolution` | Undocumented
Property | `bounds` | Returns this volume's bounding box.
Property | `dimension` | Sampling volume dimension if it is valid, None otherwise.
Property | `extent` | Returns this volume's extent.
Property | `labeled_indices` | Returns this sampling volume's labeled indices.
Property | `labels_count` | Returns this sampling volume's label count.
Property | `neighbor_indices` | Returns this sampling volume's neighborhood indices.
Property | `permeabilities` | Returns this sampling volume's relative permeabilities µ_r.
Property | `points` | Returns this sampling volume's points.
Property | `points_count` | Returns this sampling volume's point count.
Method | `_i_to_xyz` | Convert 1D index to 3D indices. Note: "Fortran" indexing (column-major order).
Method | `_xyz_to_i` | Convert 3D indices to 1D index. Note: "Fortran" indexing (column-major order).
Instance Variable | `_bounds_max` | Undocumented
Instance Variable | `_bounds_min` | Undocumented
Instance Variable | `_constraints` | Undocumented
Instance Variable | `_dimension` | Undocumented
Instance Variable | `_label_resolution` | Undocumented
Instance Variable | `_labeled_indices` | Undocumented
Instance Variable | `_neighbor_indices` | Undocumented
Instance Variable | `_permeabilities` | Undocumented
Instance Variable | `_points` | Undocumented

Inherited from `Validatable`:

Method | `valid.setter` | No summary
Property | `valid` | True if valid, False if invalid
Instance Variable | `_valid` | Undocumented

def __init__(self):
overrides `magneticalc.Validatable.Validatable.__init__`

Initializes an empty sampling volume, with zero bounds and no constraints.

@validator
def recalculate(self, progress_callback: `Callable`) -> `bool`:

Recalculates the sampling volume points, permeabilities, labels and neighborhoods according to the constraints.

Parameters
progress_callback: `Callable` | Progress callback

Returns
`bool` | True if successful, False if interrupted

def set(self, resolution: `float`, label_resolution: `float`, constraints: `list[Constraint]`):

Sets the parameters.

Parameters
resolution: `float` | Resolution
label_resolution: `float` | Label resolution
constraints: `list[Constraint]` | List of constraints

def set_bounds_nearest(self, bounds: `np.ndarray`):

Adjusts this volume's bounding box to fully enclose a 3D wire curve. This expands the bounding box to the next integer grid coordinates.

Note: This will not automatically invalidate the sampling volume.

Parameters
bounds: `np.ndarray` | Bounding box (minimum bounds, maximum bounds)

Returns
Rounded (_bounds_min, _bounds_max)

def set_padding_nearest(self, padding: `np.ndarray`):

Shrinks or enlarges this volume's bounding box by some amount, in each direction, symmetrically. This shrinks or expands the bounding box to the next integer grid coordinates.

Note: This will not automatically invalidate the sampling volume.

Parameters
padding: `np.ndarray` | Amount of padding (3D point)

resolution =

Undocumented

@property
bounds: `tuple[np.ndarray, np.ndarray]` =

Returns this volume's bounding box.

@property
@require_valid
dimension: `tuple[int, int, int]` =

Sampling volume dimension if it is valid, None otherwise.

@property
extent: `list` =

Returns this volume's extent.

@property
@require_valid
labeled_indices: `list` =

Returns this sampling volume's labeled indices.

@property
@require_valid
labels_count: `int` =

Returns this sampling volume's label count.

@property
@require_valid
neighbor_indices: `list[np.ndarray]` =

Returns this sampling volume's neighborhood indices.

@property
@require_valid
permeabilities: `np.ndarray` =

Returns this sampling volume's relative permeabilities µ_r.

@property
@require_valid
points: `np.array` =

Returns this sampling volume's points.

@property
@require_valid
points_count: `int` =

Returns this sampling volume's point count.

def _i_to_xyz(self, _i: `int`) -> `list`:

Convert 1D index to 3D indices. Note: "Fortran" indexing (column-major order).

Parameters
_i: `int` | 1D index

Returns
`list` | 3D indices

def _xyz_to_i(self, xyz: `list`) -> `int`:

Convert 3D indices to 1D index. Note: "Fortran" indexing (column-major order).

Parameters
xyz: `list` | 3D indices

Returns
`int` | 1D index

_bounds_max: `np.ndarray` =

Undocumented

_bounds_min: `np.ndarray` =

Undocumented

_constraints =

Undocumented

_dimension: `tuple[int, int, int]` =

Undocumented

_label_resolution =

Undocumented

_labeled_indices: `list` =

Undocumented

_neighbor_indices: `list[np.ndarray]` =

Undocumented

_permeabilities =

Undocumented

_points =

Undocumented