Skip to content

ResultSet

ResultSet

ResultSet(readers: Sequence[ResultReader])

Query one recorder's serial or MPI-partitioned output.

Usually obtained from open_results(), not constructed directly. Each file keeps its own mesh and entity indices; this object does not merge meshes or identify physical members.

Start with the example below. The Methods and Attributes summary tables link directly to each member's detailed reference further down this page.

Parameters:

Name Type Description Default
readers Sequence[ResultReader]

Nonempty reader sequence. The result set owns them and closes them on context-manager exit or close().

required

Raises:

Type Description
ValueError

No readers were supplied.

Example
from femora.results import open_results

with open_results("results/response*.vtkhdf") as results:
    print(results.paths)
    point = results.nearest_point((0, 0, 0), tolerance=0.01)
    ux = results.point_history("displacement", point, component="x")
Note

Queries return NumPy arrays without unit conversion or automatic acceleration-basis conversion. Use BuildingResults for building-aware tables, identity checks, and structural response interpretation.

Methods:

Name Description
supports

Check that every reader implements an operation.

mesh

Return one partition's undeformed mesh.

nearest_point

Find the closest recorded mesh point across all partitions.

point_history

Read one selected point over all recorded samples.

cell_history

Read one local element/cell history from one partition.

deformation_renderer

Create a DeformationRenderer; no movie is written yet.

close

Release all owned readers; prefer a with block for automatic cleanup.

Attributes:

Name Type Description
paths tuple[Path, ...]

Input file paths in reader/partition order.

number_of_partitions int

Number of input readers, not the solver's total MPI rank count.

times Optional[ndarray]

Common recorded sample coordinates, or None if none were recorded.

number_of_steps int

Recorded sample count, which may differ from solver step count.

available_point_responses tuple[str, ...]

Sorted point-field names available in every partition.

available_cell_responses tuple[str, ...]

Sorted cell-field names common to every partition, such as force3D.

Attributes

paths property

paths: tuple[Path, ...]

Input file paths in reader/partition order.

number_of_partitions property

number_of_partitions: int

Number of input readers, not the solver's total MPI rank count.

times property

times: Optional[ndarray]

Common recorded sample coordinates, or None if none were recorded.

Returns:

Type Description
Optional[ndarray]

numpy.ndarray | None: One-dimensional samples, usually in model time units; a static recorder may store load-factor/pseudo-time.

Raises:

Type Description
ResultFormatError

Partitions disagree on timestamps or on whether timestamps exist. Validation is performed when first accessed.

number_of_steps property

number_of_steps: int

Recorded sample count, which may differ from solver step count.

Raises:

Type Description
ResultFormatError

Partition sample counts differ.

available_point_responses property

available_point_responses: tuple[str, ...]

Sorted point-field names available in every partition.

Typical normalized names are displacement, velocity, and acceleration. Inspect this property rather than assuming a field was recorded.

available_cell_responses property

available_cell_responses: tuple[str, ...]

Sorted cell-field names common to every partition, such as force3D.

Methods:

supports

supports(capability: str) -> bool

Check that every reader implements an operation.

Parameters:

Name Type Description Default
capability str

Capability name such as "mesh", "point_history", "cell_history", "point_frame", or "cell_frame".

required

Returns:

Name Type Description
bool bool

True only if all readers support that operation. This does not guarantee that a particular response field exists in the files.

mesh

mesh(partition: int = 0, *, copy: bool = False)

Return one partition's undeformed mesh.

Parameters:

Name Type Description Default
partition int

Zero-based reader position, not the MPI rank or filename suffix.

0
copy bool

Return a deep copy if True; otherwise return the reader's cached mesh. Use a copy before changing coordinates or arrays.

False

Returns:

Name Type Description
grid UnstructuredGrid

Mesh supplied by the selected reader.

Raises:

Type Description
UnsupportedResultOperation

The reader has no mesh capability.

IndexError

The partition index is outside the reader sequence.

nearest_point

nearest_point(coordinate: Iterable[float], *, tolerance: Optional[float] = None) -> PointSelection

Find the closest recorded mesh point across all partitions.

Parameters:

Name Type Description Default
coordinate Iterable[float]

Three global XYZ coordinates in model length units.

required
tolerance Optional[float]

Maximum permitted distance in those units. None accepts the closest point regardless of its distance.

None

Returns:

Name Type Description
PointSelection PointSelection

Reader position, local index, and distance. Equal-distance ties use the first partition/point encountered.

Raises:

Type Description
ValueError

Coordinate does not contain three values, or the nearest point exceeds tolerance.

ResultFormatError

All partition meshes are empty.

UnsupportedResultOperation

A reader does not provide geometry.

Note

This is nearest-node selection, not interpolation. Coincident points cannot be distinguished by coordinate alone; use structural metadata and BuildingResults when node identity is important.

point_history

point_history(response: str, point: PointSelection, component: Component = None) -> np.ndarray

Read one selected point over all recorded samples.

Parameters:

Name Type Description Default
response str

Recorded field name, normally "displacement", "velocity", or "acceleration" for VTKHDF.

required
point PointSelection

Selection returned by this result set's nearest_point().

required
component Component

None for every component, or "x", "y", "z" or an integer component index, as supported by the reader.

None

Returns:

Type Description
ndarray

numpy.ndarray: Shape (samples, components), or (samples,) when a component is selected. Recorded units and basis are retained.

Raises:

Type Description
KeyError

The reader does not contain the requested field.

UnsupportedResultOperation

Point histories are unsupported.

cell_history

cell_history(response: str, cell_index: int, *, partition: int = 0, component: Component = None) -> np.ndarray

Read one local element/cell history from one partition.

Parameters:

Name Type Description Default
response str

Cell field name, for example "force3D".

required
cell_index int

Zero-based local mesh-cell index, not an OpenSees element tag.

required
partition int

Zero-based reader position in this collection.

0
component Component

None for all components, or a reader-supported component index.

None

Returns:

Type Description
ndarray

numpy.ndarray: Shape (samples, components), or (samples,) for one component. Force3D contains 12 end actions for supported beams.

Raises:

Type Description
KeyError

The requested cell field was not recorded.

UnsupportedResultOperation

Cell histories are unsupported.

Example
with open_results("results/building_response*.vtkhdf") as results:
    forces = results.cell_history("force3D", cell_index=0, partition=0)

deformation_renderer

deformation_renderer()

Create a DeformationRenderer; no movie is written yet.

Returns:

Name Type Description
renderer DeformationRenderer

Renderer referencing these readers. Call its write() method before closing the result set.

Raises:

Type Description
UnsupportedResultOperation

Mesh or point-frame access is unsupported.

close

close() -> None

Release all owned readers; prefer a with block for automatic cleanup.