hertzforge.io.sdynpy_shapes¶
sdynpy_shapes
¶
Read and write sdynpy mode shape files (.npy).
The file is a structured NumPy array with one record per mode and the fields 'frequency' (Hz), 'damping' (fraction of critical), 'coordinate' ((node, direction) pairs, one per DOF), 'shape_matrix' (a coefficient per DOF), 'modal_mass' and 'comment1' to 'comment5'. Every mode must cover the same DOFs.
The file does not record which mass unit the shapes were normalized
against, so they import unit-less unless mass_unit is declared.
Functions:
| Name | Description |
|---|---|
sniff |
True for a |
load |
Read an sdynpy mode shape file as a ShapeSet. |
handles |
True for any ShapeSet, real or complex. |
save |
Write mode shapes in the sdynpy .npy layout. |
Classes¶
Functions:¶
sniff
¶
True for a .npy holding a structured array with at least the fields
frequency, damping, coordinate and shape_matrix.
Only the file's header is read, which names the fields, and a file without one is not this format.
load
¶
load(path: str | PathLike, mass_unit: str | None = None) -> ShapeSet
Read an sdynpy mode shape file as a ShapeSet.
modal_mass may be absent from the file, and each mode's five comment
fields are joined with '; '. mass_unit declares the mass the shapes
were normalized against; without it they import unit-less. Raises
ValueError for a file with no modes, with modes over differing DOFs,
or holding Python objects.
handles
¶
True for any ShapeSet, real or complex. save still refuses real
shapes with a complex modal mass.
save
¶
save(shapes: ShapeSet, path: str | PathLike, unit_system: UnitSystem | None = None) -> None
Write mode shapes in the sdynpy .npy layout.
The shape coefficients are written against the mass unit of
unit_system when the units are defined, and as stored otherwise;
the modal masses are written as stored, since against coefficients in
1/sqrt(mass) a modal mass carries no unit. The format records neither
the unit nor the normalization. Complex shapes are written in the
layout's complex form, coefficients and modal masses both complex;
real shapes with a complex modal mass are refused with ValueError.
The first comment field holds the mode's description, or
its comment when it has none.