hertzforge.io.adf¶
adf
¶
Read and write I-DEAS Associated Data Files: .afu (functions), .ati (time histories) and .ash (mode shapes).
ADF is the binary counterpart of the universal file's dataset 58: the same function types, the same data-type codes and the same interleaved convention for uneven abscissas, stored in 512-byte blocks of little-endian float32. Shape files add a node table for the whole file and a record per mode. The format comes from SDRC I-DEAS and is still written by Siemens NX. There is no public specification, so this reader was worked out from paired sample files and from published documentation.
Two facts about the data, both established against those samples. ADF files store SI whatever unit system the writing session used (checked through all nine unit systems the format allows, with and without the G's flag), so imports arrive with their units defined. And the file stores float32 only: data written as double precision was rounded to single by the writer and cannot be recovered.
Function records are parsed into the same entries the universal file's
dataset 58 parser produces and are grouped by the same function
(unv._build_data_objects, with SI factors), so an .afu and the
equivalent .unv import through one code path and give the same
objects.
Functions:
| Name | Description |
|---|---|
sniff |
True for an |
load |
Read an ADF file. |
handles_functions |
Whether |
handles_time |
Whether |
handles_shapes |
Whether |
save |
Write an ADF file, chosen by the suffix of |
Classes¶
Functions:¶
sniff
¶
True for an .afu, .ati or .ash file that is a whole number of
512-byte blocks, at least three, starting with four 0xFF bytes.
load
¶
Read an ADF file.
A shape file (one with a node table) returns a ShapeSet. Functions
and time histories are grouped as a universal file's dataset 58
records are: one object per function type, returned directly when
there is one and in a dict keyed by function name, as unv.load
keys them ('time', 'frf', 'psd' and so on), when there are several. A record whose data type is
Unknown or General is read unit-less, with its ordinate units label
kept as a hint, because the label is free text and is often wrong.
Raises ValueError when the file is not an ADF or its directory has no records.
handles_functions
¶
Whether obj writes to an .afu: an FRF, coherence, PSD or
spectrum; a time history goes to .ati instead.
save
¶
save(obj: DataArray | ShapeSet, path: str | PathLike, unit_system: UnitSystem | None = None) -> None
Write an ADF file, chosen by the suffix of path.
A ShapeSet is written to .ash; a time history to .ati; an FRF,
coherence, PSD or spectrum to .afu. Values are written as stored,
which is SI when their units are defined, since the format stores SI
by definition, and as float32, the only precision it has. A record
whose units are not defined is written with data type Unknown.
unit_system is accepted and not used.
Raises ValueError for a ShapeSet to any suffix but .ash, a suffix
that is not an ADF suffix, or a data type the format has no function
type for.