Relations (geomdb.cond)

In GeomDB, the relations in the relational database are defined using Condition and its derived objects.

class geomdb.cond.Condition

Base class for all conditions.

__abstractmethods__ = frozenset({'from_pytree_impl', 'mask'})
__and__(other)
__annotations__ = {'args': list[str]}
__call__(voxel, props)

Call self as a function.

Return type:

VoxelGrid

__invert__()
__module__ = 'geomdb.cond'
__or__(other)

Return self|value.

__xor__(other)
args: list[str]
abstract mask(voxel, props)

Find voxels that satisfy this condition.

Parameters:
  • voxel (VoxelGrid) – The voxelation on which to evaluate the condition.

  • props (dict[str, PropertyValue]) – The dictionary of already-evaluated properties. The dictionary keys are the names of each property, and the dictionary values are the evaluated properties.

Return type:

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns:

The masking array.

to_pytree_impl()

Serialize this object’s data into a PyTree. The resulting PyTree only contains information about the data, and does not include any metadata needed to reconstruct this object. The metadata are generated using geomdb.cp.Checkpointable.to_pytree_meta().

Any checkpointable concrete class that contains data should override this method. See the checkpoint module on how to save and load an object.

Return type:

dict

Returns:

The partial PyTree (data only).

class geomdb.cond.ConditionBinaryOp(cond1, cond2, op)

Apply a binary operator on two conditions.

__abstractmethods__ = frozenset({})
__annotations__ = {'args': 'list[str]'}
__init__(cond1, cond2, op)
Parameters:
  • cond1 (Condition) – LHS of the operator.

  • cond2 (Condition) – RHS of the operator.

  • op (str) – The binary operator.

__module__ = 'geomdb.cond'
static from_pytree_impl(params)

Reconstruct this object given a PyTree. Usually this is as simple as calling the constuctor.

All checkpointable concrete class should override this method. See the checkpoint module on how to save and load an object.

Return type:

Self

Returns:

The reconstructed object.

mask(voxel, props)

Find voxels that satisfy this condition.

Parameters:
  • voxel (VoxelGrid) – The voxelation on which to evaluate the condition.

  • props (dict[str, PropertyValue]) – The dictionary of already-evaluated properties. The dictionary keys are the names of each property, and the dictionary values are the evaluated properties.

Return type:

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns:

The masking array.

to_pytree_impl()

Serialize this object’s data into a PyTree. The resulting PyTree only contains information about the data, and does not include any metadata needed to reconstruct this object. The metadata are generated using geomdb.cp.Checkpointable.to_pytree_meta().

Any checkpointable concrete class that contains data should override this method. See the checkpoint module on how to save and load an object.

Return type:

dict

Returns:

The partial PyTree (data only).

class geomdb.cond.ConditionUnaryOp(cond, op)

Apply a unary operator on a given condition.

__abstractmethods__ = frozenset({})
__annotations__ = {'args': 'list[str]'}
__init__(cond, op)
Parameters:
  • cond (Condition) – The condition to be operated on.

  • op (str) – The unary operator.

__module__ = 'geomdb.cond'
static from_pytree_impl(params)

Reconstruct this object given a PyTree. Usually this is as simple as calling the constuctor.

All checkpointable concrete class should override this method. See the checkpoint module on how to save and load an object.

Return type:

Self

Returns:

The reconstructed object.

mask(voxel, props)

Find voxels that satisfy this condition.

Parameters:
  • voxel (VoxelGrid) – The voxelation on which to evaluate the condition.

  • props (dict[str, PropertyValue]) – The dictionary of already-evaluated properties. The dictionary keys are the names of each property, and the dictionary values are the evaluated properties.

Return type:

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns:

The masking array.

to_pytree_impl()

Serialize this object’s data into a PyTree. The resulting PyTree only contains information about the data, and does not include any metadata needed to reconstruct this object. The metadata are generated using geomdb.cp.Checkpointable.to_pytree_meta().

Any checkpointable concrete class that contains data should override this method. See the checkpoint module on how to save and load an object.

Return type:

dict

Returns:

The partial PyTree (data only).

class geomdb.cond.ParsedCondition(expr)

Condition defined by a parsed expression.

__abstractmethods__ = frozenset({})
__annotations__ = {'args': 'list[str]'}
__init__(expr)
Parameters:

expr (str) – The expression string to be parsed. Must be a relational.

__module__ = 'geomdb.cond'
static from_pytree_impl(params)

Reconstruct this object given a PyTree. Usually this is as simple as calling the constuctor.

All checkpointable concrete class should override this method. See the checkpoint module on how to save and load an object.

Return type:

Self

Returns:

The reconstructed object.

mask(voxel, props)

Find voxels that satisfy this condition.

Parameters:
  • voxel (VoxelGrid) – The voxelation on which to evaluate the condition.

  • props (dict[str, PropertyValue]) – The dictionary of already-evaluated properties. The dictionary keys are the names of each property, and the dictionary values are the evaluated properties.

Return type:

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns:

The masking array.

to_pytree_impl()

Serialize this object’s data into a PyTree. The resulting PyTree only contains information about the data, and does not include any metadata needed to reconstruct this object. The metadata are generated using geomdb.cp.Checkpointable.to_pytree_meta().

Any checkpointable concrete class that contains data should override this method. See the checkpoint module on how to save and load an object.

Return type:

dict

Returns:

The partial PyTree (data only).