Skip to content

Ops

AndExpression(left, right)

Bases: _BinaryLogicalOperator

Represents a logical AND operation between two selection expressions.

This expression evaluates to True for an atom if and only if both the left and right sub-expressions evaluate to True for that atom.

PARAMETER DESCRIPTION

left

The SelectionExpression on the left side of the logical operation.

TYPE: SelectionExpression

right

The SelectionExpression on the right side of the logical operation.

TYPE: SelectionExpression

evaluate(ensemble, run_id=None, micro_id=None)

Evaluates the logical AND of the left and right sub-expressions.

For each microstate, this method retrieves the boolean masks from both the left and right sub-expressions and applies a NumPy logical AND operation element-wise.

PARAMETER DESCRIPTION

ensemble

The Ensemble object containing the data.

TYPE: Ensemble

run_id

The ID of the run within the ensemble.

TYPE: str | None DEFAULT: None

micro_id

Microstate IDs to evaluate expression for. If None, then it evaluates for every single possible microstate.

TYPE: OptionalSliceSpec DEFAULT: None

YIELDS DESCRIPTION
Bool

A 1D boolean NumPy array for each microstate, representing the element-wise logical AND of the masks produced by the left and right sub-expressions.

NotExpression(operand)

Bases: _UnaryLogicalOperator

Represents a logical NOT operation on a selection expression.

This expression evaluates to True for an atom if its sub-expression evaluates to False, and vice-versa.

evaluate(ensemble, run_id=None, micro_id=None)

Evaluates the logical NOT of the sub-expression.

For each microstate, this method retrieves the boolean mask from its sub-expression and applies a NumPy logical NOT operation element-wise.

PARAMETER DESCRIPTION

ensemble

The Ensemble object containing the data.

TYPE: Ensemble

run_id

The ID of the run within the ensemble.

TYPE: str | None DEFAULT: None

micro_id

Microstate IDs to evaluate expression for. If None, then it evaluates for every single possible microstate.

TYPE: OptionalSliceSpec DEFAULT: None

YIELDS DESCRIPTION
Bool

A 1D boolean NumPy array (npt.NDArray[np.bool_]) for each microstate, representing the element-wise logical NOT of the mask produced by the sub-expression.

OrExpression(left, right)

Bases: _BinaryLogicalOperator

Represents a logical OR operation between two selection expressions.

This expression evaluates to True for an atom if either the left or the right sub-expression (or both) evaluate to True for that atom.

PARAMETER DESCRIPTION

left

The SelectionExpression on the left side of the logical operation.

TYPE: SelectionExpression

right

The SelectionExpression on the right side of the logical operation.

TYPE: SelectionExpression

operand

The SelectionExpression to negate.

evaluate(ensemble, run_id=None, micro_id=None)

Evaluates the logical OR of the left and right sub-expressions.

For each microstate, this method retrieves the boolean masks from both the left and right sub-expressions and applies a NumPy logical OR operation element-wise.

PARAMETER DESCRIPTION

ensemble

The Ensemble object containing the data.

TYPE: Ensemble

run_id

The ID of the run within the ensemble.

TYPE: str | None DEFAULT: None

micro_id

Microstate IDs to evaluate expression for. If None, then it evaluates for every single possible microstate.

TYPE: OptionalSliceSpec DEFAULT: None

YIELDS DESCRIPTION
Bool

A 1D boolean NumPy array (npt.NDArray[np.bool_]) for each microstate, representing the element-wise logical OR of the masks produced by the left and right sub-expressions.

SelectionOperator

Provides static methods to act as factories for SelectionExpression instances.

AND(left, right)

Creates an AndExpression.

NOT(operand)

Creates a NotExpression.

OR(left, right)

Creates an OrExpression.