pyfebiopt.xplt.views
Sliceable result views for XPLT data.
Philosophy
Views delay all heavy lifting until evaluation. Selections are chained, carry no
copies, and respect FEBio’s storage format. When you finally call comp(...) or
eval(), indices are applied in order: time → region/item → node/enode →
component. Returned arrays are float32 and keep the ranks written by FEBio.
Selector cheatsheet
time(sel)narrows time indices; pass":"for all.region(name)/domain(name)/surface(name)switch to a stored block.nodes(...)oritems(...)/elems(...)/faces(...)/enodes(...)limit rows inside a region or stream.comp(...)picks components; names like"x"or"zz"are accepted when FEBio exposes them.__getitem__mirrors the same axis order for quick slicing.
Component name mapping
VEC3F →
x, y, zMAT3FD →
xx, yy, zzMAT3FS →
xx, yy, zz, xy, yz, xzMAT3F → full 3x3 row-major names
TENS4FS → Voigt-6 pairs such as
xxyyoryzzz(order-insensitive)
Examples.
U = results["displacement"]
U_tip = U.time(-1).nodes(-1).comp("z")
U_fast = U[0, ":", "x"] # shorthand
S = results["stress"].domain("arteria")
S_last = S.time(-1).items(slice(0, 10)).comp("xx")
Q = results["strain"].domain("arteria")
q = Q.time(0).items(0).enodes(":").comp("xx")
Notes.
Missing data for a step/region returns the right shape filled with
NaN.Slices are applied on demand, so you can compose selections in any order before requesting data.
Classes
Global nodal results (FMT_NODE). |
|
Per-domain nodal results (FMT_NODE split by region). |
|
Per-item results (FMT_ITEM). |
|
Per-item per-element-node results (FMT_MULT). |
|
Per-region vector results (FMT_REGION). |
Module Contents
- class pyfebiopt.xplt.views.NodeResultView(meta: _FieldMeta, times: numpy.ndarray, per_t: list[numpy.ndarray | None], mesh: pyfebiopt.mesh.mesh.Mesh)
Bases:
_BaseViewGlobal nodal results (FMT_NODE).
Axes follow
(time, node, component). Component names are resolved when FEBio provides them; otherwise numeric indices work.nodes(...)accepts integer indices, slices, boolean masks, or numpy arrays matching the mesh node order.Create a nodal view backed by per-time arrays.
- __slots__ = ('_mesh', '_node_idx', '_per_t')
- nodes(ids: pyfebiopt.xplt.types.Index) Self
Select node rows by indices, slices, masks, or lists.
- Returns:
View for chaining.
- nodeset(name: str) Self
Select by nodeset name from the mesh.
- Returns:
View for chaining.
Example
view.nodeset("base").comp("z")selects nodesetbase.
- dims() tuple[str, Ellipsis]
Describe array axes.
- Returns:
Axis labels as
("time", "node", "component").
- eval() numpy.ndarray
Return an array with the current selections applied.
- __getitem__(key: Any) numpy.ndarray
Shorthand selection:
[time, nodes, comp].- Parameters:
key – Tuple of selectors or single selector for time.
- Returns:
Array with selections applied.
- __repr__() str
- __str__
- class pyfebiopt.xplt.views.NodeRegionResultView(meta: _FieldMeta, times: numpy.ndarray, per_name: dict[str, list[numpy.ndarray | None]], region_nodes: dict[str, numpy.ndarray])
Bases:
_BaseViewPer-domain nodal results (FMT_NODE split by region).
Axes follow
(time, node_in_region, component). Useregions()to list domains then callregion(name)ordomain(name)to focus on one block.nodes(...)is relative to the region-local node order stored in FEBio.Create a per-region nodal view.
- __slots__ = ('_node_idx', '_per_name', '_region_nodes')
- regions() list[str]
Return available region names.
- domains
- region(name: str) NodeRegionResultView
Restrict the view to a single region.
- Returns:
View for the selected region.
- domain
- region_nodes() numpy.ndarray
Return node ids for the selected region.
- nodes(ids: pyfebiopt.xplt.types.Index) Self
Select nodes by indices relative to the region list.
- Returns:
View for chaining.
- dims() tuple[str, Ellipsis]
Describe array axes.
- Returns:
Axis labels as
("time", "node_in_region", "component").
- eval(*, region: str | None = None) numpy.ndarray
Return array with current selections.
- __repr__() str
- __str__
- class pyfebiopt.xplt.views.ItemResultView(meta: _FieldMeta, times: numpy.ndarray, per_name: dict[str, list[numpy.ndarray | None]])
Bases:
_BaseViewPer-item results (FMT_ITEM).
Axes follow
(time, item, component). Items correspond to elements or faces depending on where the variable was defined. Region-aware variables expose one block per domain or surface; callregions()andregion(name)to pick.Create an item view backed by per-region arrays.
- __slots__ = ('_item_idx', '_per_name')
- regions() list[str]
Return available regions.
- domains
- surfaces
- region(name: str) ItemResultView
Restrict the view to a single region.
- Returns:
View limited to
name.
- domain
- items(idx: pyfebiopt.xplt.types.Index) ItemResultView
Select items by indices, slices, masks, or lists.
- Returns:
View for chaining.
- elems
- faces
- dims() tuple[str, Ellipsis]
Describe array axes.
- Returns:
Axis labels as
("time", "item", "component").
- eval(*, region: str | None = None) numpy.ndarray
Return array with current selections.
- __repr__() str
- __str__
- class pyfebiopt.xplt.views.MultResultView(meta: _FieldMeta, times: numpy.ndarray, per_name: dict[str, list[pyfebiopt.xplt.types.MultLike | None]])
Bases:
_BaseViewPer-item per-element-node results (FMT_MULT).
Axes follow
(time, item, enode, component). Useitems(...)to select elements/faces andenodes(...)to pick a position inside each connectivity list. Region-aware streams need an explicitregion(name)before evaluation.Create a per-item per-enode view backed by region blocks.
- __slots__ = ('_enode_idx', '_item_idx', '_per_name')
- regions() list[str]
Return available regions.
- domains
- surfaces
- region(name: str) MultResultView
Restrict the view to a single region.
- Returns:
View limited to
name.
- domain
- items(idx: pyfebiopt.xplt.types.Index) MultResultView
Select items by indices, slices, masks, or lists.
- Returns:
View for chaining.
- elems
- faces
- enodes(idx: pyfebiopt.xplt.types.Index) MultResultView
Select element-node positions by indices or slices.
- Returns:
View for chaining.
- nodes
- dims() tuple[str, Ellipsis]
Describe array axes.
- Returns:
Axis labels as
("time", "item", "enode", "component").
- eval(*, region: str | None = None) numpy.ndarray
Return array with current selections.
- __repr__() str
- __str__
- class pyfebiopt.xplt.views.RegionResultView(meta: _FieldMeta, times: numpy.ndarray, per_name: dict[str, list[numpy.ndarray | None]])
Bases:
_BaseViewPer-region vector results (FMT_REGION).
Axes follow
(time, component). Each region stores a compact vector, often integrals or aggregated values. Useregions()to list andregion(name)to focus on one block before evaluating.Create a per-region vector view.
- __slots__ = ('_per_name', '_region_idx')
- regions() list[str]
Return available regions.
- domains
- surfaces
- region(name: str) RegionResultView
Restrict the view to a single region.
- Returns:
View limited to
name.
- domain
- dims() tuple[str, Ellipsis]
Describe array axes.
- Returns:
Axis labels as
("time", "component").
- eval() numpy.ndarray
Return array with current selections.
- __repr__() str
- __str__