BuildingResults
BuildingResults
Interpret recorded responses using explicit building membership metadata.
Wraps a ResultSet; geometry is used to verify identities, never to
guess member roles. No files are created until export_csv() is called.
Every response method returns a pandas DataFrame with units and basis in
attrs. Missing recorded fields raise UnsupportedResultOperation.
Example
from femora.results import BuildingResults
with BuildingResults.open(
"results/building*.vtkhdf", metadata="building.structure.h5",
) as results:
drift = results.interstory_drift(direction="x")
forces = results.member_forces(kind="brace", end="both")
results.export_csv("processed", responses=["interstory_drift"])
Note
Member forces are element-end actions, not fiber stresses or failure assessments. Story/base shear is a signed element-force cut resultant, not an inertia-based estimate. Global-end moments and force lever arms are included in overturning moments. Units are supplied by the caller's metadata; the reader performs no unit conversion.
Floor quantities are arithmetic averages of structural-joint translations, not mass-weighted center-of-mass values. In SSI, relative-to-base motion removes translation only, not foundation rocking. No failure criterion is inferred from member forces or drift.
Methods:
| Name | Description |
|---|---|
open |
Open result files with a metadata mapping or explicit metadata path. |
members |
Inspect physical-member identities before selecting force histories. |
floor_displacement |
Return mean structural-joint floor translations, not mass-weighted means. |
floor_acceleration |
Return floor acceleration with explicit relative/absolute conversion. |
interstory_drift |
Calculate signed translation-based drift ratios for every story. |
member_forces |
Return recorded end forces with (member, element, end, component) columns. |
story_shear |
Return negative lower-end global force sums at each floor-bottom cut. |
base_shear |
Read the first-story force-cut resultant at the building base. |
overturning_moment |
Return base moment including global end moments and force lever arms. |
summary |
Return peak magnitudes and their recorded sample coordinates. |
export_csv |
Explicitly export selected histories and return their paths. |
close |
Close owned result readers. |
Methods:
open
classmethod
Open result files with a metadata mapping or explicit metadata path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | Path | list
|
VTKHDF path, glob, or partition paths. |
required |
metadata
|
dict | str | Path
|
Structural index from the live building, or path explicitly
written using |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BuildingResults |
BuildingResults
|
Owns its underlying readers. Close it or use it as a context manager. No building reconstruction is needed. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
Recorder or metadata files cannot be found. |
ResultFormatError
|
Metadata schema, node identities, connectivity, floor assignments, or partition timestamps are inconsistent. |
Note
Metadata and recorder files must come from the same assembled model. Include every partition containing building members. Coincident nodes/elements require unambiguous recorded nodeTags/eleTags.
members
Inspect physical-member identities before selecting force histories.
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Physical-member index and metadata columns, such as kind, story, section, and element tags. A subdivided beam is one physical member with several finite elements. |
floor_displacement
Return mean structural-joint floor translations, not mass-weighted means.
relative_to_base=True subtracts the recorded base translation at
each sample. Gravity offsets are not silently removed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
Global |
'x'
|
relative_to_base
|
bool
|
Subtract the mean translation of floor 0. This does not remove the displacement caused by foundation rotation. |
False
|
include_base
|
bool
|
Include floor 0; otherwise return floors 1 through N. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Recorder-sample index, integer floor columns, and metadata length units in attrs. The base-relative floor-0 column is zero if both options are enabled. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Direction is unsupported. |
UnsupportedResultOperation
|
Displacement was not recorded. |
ResultFormatError
|
A history is nonfinite or partition copies conflict. |
floor_acceleration
Return floor acceleration with explicit relative/absolute conversion.
For conversion, supply ground_motion=(time, acceleration) with a
scalar component or an N-by-3 array, or a DataFrame indexed by time with
x/y/z columns. Its times must cover all recorder times, including any
free-vibration tail, and its acceleration units must match the results.
No motion is guessed from a filename and no scaling is applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
Global |
'x'
|
basis
|
str
|
|
'recorded'
|
ground_motion
|
tuple | DataFrame | None
|
Motion for basis conversion; see the accepted forms above. Components are in global axes. |
None
|
include_base
|
bool
|
Include the base-floor mean acceleration if True. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Floor columns, recorder-sample index, and acceleration units and resulting basis in attrs. |
Raises:
| Type | Description |
|---|---|
UnsupportedResultOperation
|
Acceleration is absent, or conversion lacks a declared recorded basis and explicit ground motion. |
ValueError
|
Basis, direction, or supplied motion samples are invalid. |
Examples:
DRM output already declared absolute needs no added ground motion:
For metadata declared relative under uniform excitation:
interstory_drift
Calculate signed translation-based drift ratios for every story.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
Global |
'x'
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Story columns 1 through N. Each value is (upper mean translation - lower mean translation) / story height. Values are dimensionless ratios, not percentages; multiply by 100 for percent. Story 1 uses the recorded base as its lower floor. |
Raises:
| Type | Description |
|---|---|
UnsupportedResultOperation
|
Displacement was not recorded. |
Note
Neither foundation rocking nor floor torsional variation is removed. These mean-floor ratios are not maximum corner drifts or a design acceptance check.
member_forces
Return recorded end forces with (member, element, end, component) columns.
kind is beam, column, brace, or all. End i/j follows the exported
element connectivity. Moments and forces use their respective metadata
units. This is not a yield or failure assessment.
Use story or member_ids to restrict large queries without
loading histories for unrelated members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
str
|
|
'all'
|
coordinate_system
|
str
|
|
'global'
|
end
|
str
|
|
'both'
|
story
|
int | None
|
One story number, or None for every story. |
None
|
member_ids
|
Iterable[int] | None
|
Physical IDs from members(), or None for all. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Four-level columns: member, element, end, component. Components are Fx, Fy, Fz, Mx, My, Mz. Empty selections return zero columns. Force and moment units are in attrs. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Kind, coordinate system, or end is invalid. |
UnsupportedResultOperation
|
The selected force field was not recorded. |
ResultFormatError
|
End-force fields do not contain 12 components. |
story_shear
Return negative lower-end global force sums at each floor-bottom cut.
All structural members crossing the cut contribute, including braces. Subdivided physical members contribute only the segment crossing it. These are resisting-force resultants, not sums of nodal inertia.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
Global |
'x'
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Story columns 1 through N, in metadata force units. A cut is placed at each story's lower-floor elevation. |
Raises:
| Type | Description |
|---|---|
UnsupportedResultOperation
|
Global force3D is unavailable or no structural members cross a requested cut. |
ResultFormatError
|
Force arrays have an invalid component count. |
Note
A positive result is the negative sum of lower-end actions in the selected global direction. It is not a support-reaction sum.
base_shear
Read the first-story force-cut resultant at the building base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
str
|
Global |
'x'
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
One column, |
Raises:
| Type | Description |
|---|---|
UnsupportedResultOperation
|
Required global end forces are missing or no building members cross the base cut. |
Note
In SSI this is the building's base cut, not the soil boundary reaction or total foundation/pile force. Unsupported solver force responses can contain zeros; zeros alone do not demonstrate zero demand.
overturning_moment
Return base moment including global end moments and force lever arms.
Reference defaults to the plan center at base elevation. Supply a global XYZ point to choose a different moment reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
str
|
Global moment axis, |
'y'
|
reference
|
Sequence[float] | None
|
Global XYZ reference in model length units. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
One |
Raises:
| Type | Description |
|---|---|
ValueError
|
Reference point or axis is invalid. |
UnsupportedResultOperation
|
Required force histories are absent. |
summary
Return peak magnitudes and their recorded sample coordinates.
Defaults summarize displacement and drift, plus acceleration if present. Request force-derived responses explicitly; absent force fields raise an error rather than producing a misleading zero-demand summary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
responses
|
Iterable[str] | None
|
Names selected from floor_displacement, floor_acceleration, interstory_drift, story_shear, base_shear, overturning_moment, and member_forces. None uses the defaults above. |
None
|
direction
|
str
|
Global component for floor/drift/shear queries; moment axis for overturning_moment. Member forces retain all components. |
'x'
|
Returns:
| Name | Type | Description |
|---|---|---|
table |
DataFrame
|
Response, entity, direction, peak_abs, signed_value, sample, units, and basis columns. Sample is the recorded coordinate at the absolute peak, not necessarily seconds. Tied peaks use the first sample. |
Example
Note
Summary floor displacement uses recorded motion, not automatically base-relative motion. No threshold or pass/fail assessment is applied.
export_csv
Explicitly export selected histories and return their paths.
Files are named response_direction.csv. No response files are written by construction, get_results(), or individual response queries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
Output directory; created if missing. Existing files with matching response/direction names are overwritten. |
required |
responses
|
Iterable[str]
|
Response names accepted by summary(). All requested tables are evaluated before any output is written. |
required |
direction
|
str
|
Global component, or moment axis for overturning_moment. Member forces use their default all-member/global/both-end query. |
'x'
|
Returns:
| Name | Type | Description |
|---|---|---|
paths |
list[Path]
|
Written files. Each CSV includes the recorded sample index and uses the method's default response options. |
Raises:
| Type | Description |
|---|---|
ValueError
|
An unknown response or direction is requested. |
UnsupportedResultOperation
|
A required field is missing. |
OSError
|
Output paths cannot be created or written. |
Note
CSV does not preserve DataFrame attrs. To export custom options such as base-relative translation, call that method and use to_csv() on its returned table instead.