Skip to content

hertzforge.core.merge

merge

Merging several objects of one type into one.

mergeable returns None when the objects can be merged and the reason when they cannot, for a test or a tooltip to show; the app does not offer a merge that would be refused. merge builds the combined object and does not change the objects it was given.

The rules:

  • Only objects of exactly the same type merge.
  • Channel tables merge when their rows agree. A multi-pass survey has one table per pass, with the reference rows repeated exactly and different response rows. Rows that are identical apart from the channel number become one row, the rest are concatenated, and the channels are renumbered from 1, because a channel number is the wiring of one acquisition and not the identity of a measurement point. The same point in the same role described two different ways is refused, and the message names the point.
  • Geometries must have different node ids. A coordinate system id may appear in more than one geometry only if it is the same system (type and matrix) in each. Element ids are only labels, so the elements are renumbered.
  • Shape sets must cover the same DOFs. The merged modes are sorted by frequency.
  • Data arrays must share one abscissa, and specifications must carry the same limit curves. FRFs and every other frequency-domain array are refused when two records share a (response, reference) pair, since the same measurement twice is not one set. Time histories are the exception: a repeated DOF is another average and gets its own averaging label (block). Time data merges only as repeat runs (every channel shared) or as one acquisition split across files (no channel shared), with every channel holding the same number of captures. A mixture, such as the passes of a roving survey, is refused.
  • Sine sweep specifications merge their tones when they name the same control channels in the same unit and no tone name repeats.
  • Geometries and shape sets have units for the whole object, so either all of them have units defined or none do; mixing SI values with values that have no units would add meters to plain numbers. A data array's units are per record and are carried over as they are.

Functions:

Name Description
mergeable

None when the objects can be merged, otherwise the reason they cannot.

merge

The combined object. The objects given are not changed.

Classes

Functions:

mergeable

mergeable(objects: Sequence[Any]) -> str | None

None when the objects can be merged, otherwise the reason they cannot.

The rules are in this module's docstring. Fewer than two objects, or objects of different types, are refused.

merge

merge(objects: Sequence[Any]) -> Any

The combined object. The objects given are not changed.

Raises ValueError with the reason from mergeable when the objects cannot be merged.