visualdynamics.io.escdf_objects¶
escdf_objects
¶
Write a project to an ESCDF file and read one back, with each object written both as the standard's own type and whole, as Visual Dynamics keeps it.
The standard has types for what a test produces: geometry,
channel_table, data, response_spectrum and mode. Each object of
those kinds is written as that type, so any reader of the format gets
the nodes, channels, records and modes from the standard fields alone.
The standard has no fields for much of what a project holds: element
blocks and their properties, coordinate systems, the processing record
and provenance, reports, matched modes, sine and random specifications,
and a geometry's view. Those are kept in the attachments every group
has, one attachment per object, holding the object in its .vdyn
layout (written by io.native into memory). A file written here
therefore reads back complete, and a reader that does not know the
attachment can ignore it. A report is attached twice: rendered as a
self-contained HTML page, and as its definition, so it opens again
editable.
Values in the standard fields are written in the units their labels
name. A geometry's positions are in its declared length unit
(position_units), each data record is in its own declared unit
(ordinate_unit), and mode shape coefficients are normalized against
the declared mass unit (modal_mass_unit). An object whose units are
not defined is written as stored, with the unit left blank. Abscissas
are written in seconds or hertz.
An activity is an object group: the group's results (data and mode shapes) are the activity's data, and the geometry and channel tables it uses are metadata at the root, linked from the activity. A named group becomes an activity with that name; an unnamed one takes the name of its geometry, or of its first member. Objects in no group form one more activity. Photos, reports, matched modes and sine specifications are metadata as well, written as parameter sets and linked to the activity whose group holds them, because the standard puts anything that is not a result at the root.
A file this program did not write is read from the standard fields: a geometry's nodes, lines, elements and per-node directions (a node whose axes are not the global ones gets a coordinate system of its own), a data record's values and units, and a mode set's frequencies, damping and shapes. The declared units are applied on reading, so positions, records and shapes are converted from the units the file names. Unit strings are written with '^' for a power, as the format's examples spell them, and either '^' or '**' is read.
Functions:
| Name | Description |
|---|---|
handles |
True for a whole project, or for any one kind of object a project |
to_file |
A project as an ESCDF |
save |
Write a project, or one object as a project of one, as an ESCDF |
from_file |
A project from an ESCDF |
load |
Read an ESCDF file as a project (see |
Classes¶
Functions:¶
handles
¶
True for a whole project, or for any one kind of object a project holds.
Source code in src/visualdynamics/io/escdf_objects.py
to_file
¶
A project as an ESCDF File, ready for escdf.write.
Each object is written as the standard's type with the object whole
in an attachment, and each object group becomes an activity. The
project's name, object groups, provenance and settings go in a
parameter set at the root named visualdynamics_project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
What to write. |
required |
created_by
|
str
|
The file's creator; the login name when left out. |
None
|
unit_system
|
UnitSystem
|
The system the reports are rendered in; SI when left out. It does not change the units of the standard fields, which are the objects' own declared units. |
None
|
Returns:
| Type | Description |
|---|---|
File
|
|
Source code in src/visualdynamics/io/escdf_objects.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |
save
¶
save(obj: Any, path: str | PathLike, unit_system: Any = None, created_by: str | None = None, **_ignored: Any) -> None
Write a project, or one object as a project of one, as an ESCDF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Project or object
|
What to write. |
required |
path
|
path - like
|
Where; |
required |
unit_system
|
UnitSystem
|
The system reports are rendered in; SI when left out. The standard fields are written in each object's declared units whatever this is. |
None
|
created_by
|
str
|
The creator recorded in the file; the login name when left out. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/visualdynamics/io/escdf_objects.py
from_file
¶
A project from an ESCDF File.
Each dataset becomes an object, built from its whole-object attachment when it has one and from the standard fields otherwise. A dataset whose type the specifications do not define is left out with a note. The project's own record, when the file has one, restores the object names, order, object groups and provenance; without it, each activity with two or more objects becomes an object group named for the activity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
File
|
As |
required |
Returns:
| Type | Description |
|---|---|
Project
|
|