Skip to content

hertzforge

hertzforge

Hertzforge: data acquisition and structural dynamics in one toolset.

import hertzforge gives the Project and the one-call report functions, the data objects (TimeHistory, Frf, Psd, ShapeSet, Geometry and the rest), the readers and writers (import_file, export_file, load, save), and the unit systems and convert.

Classes:

Name Description
Issue

Why one object does not fit the geometry or shape set it answers to.

Report

The result of check_compatibility: an Issue for each object

ChannelTable

Per-channel metadata, in one fixed set of typed columns.

DataArray

Base class; use a concrete subclass (TimeHistory, Spectrum, Frf, Psd).

Frf

Frequency response function: response per unit reference.

Geometry

Nodes, coordinate systems, elements and element groups.

Psd

Power spectral density. The declared unit is the engineering unit

ShapeSet

Mode shapes over a shared set of DOFs.

ShockSpecification

What a shock test was controlled to: an SRS and its limits.

Specification

What a random vibration test was controlled to: a PSD and its

Spectrum

A linear spectrum: amplitude and phase at each frequency line.

Srs

A shock response spectrum: the peak response of an oscillator at

TimeHistory

A measurement against time, as it was acquired.

TransientSpecification

What a transient test was controlled to: a target time history.

View

The direction a geometry is viewed from in 3-D: where the eye is,

Project

Every object in one test, by name, and how the objects are grouped.

UnitsRequired

Raised when an operation needs units that have not been defined.

UnitSystem

A named mapping of dimension tag to display unit.

Functions:

Name Description
check_compatibility

Check every object in a test against the geometry it answers to.

frequency_axis

Read or set how frequency axes are drawn in every plot, 3-D view

export_file

Write obj to a file in a format chosen by name or by suffix.

from_sep005

Convert SEP 005 timeseries to TimeHistory objects.

import_file

Import a file, returning the Hertzforge object it contains.

importers

Every format Hertzforge can read, in the order they are

load

Load a .hforge or .vdyn file: the object it holds, or a whole test.

register_importer

Add a format to the importers. Registered importers are tried in

save

Save one Hertzforge object to a .hforge (HDF5) file.

mixed_run

Work a Rattlesnake random run with a sine sweep under it up into a

random_vibration_report

Read a Rattlesnake random vibration run and write an HTML report.

random_vibration_run

Work a Rattlesnake random vibration run up into a project.

report_kind

Which one-call reports a Rattlesnake run gets: 'random', 'mixed',

run_report

Read a Rattlesnake run and write the report its type calls for.

sine_report

Read a Rattlesnake sine sweep run and write an HTML report.

sine_run

Work a Rattlesnake sine sweep run up into a project.

system_id_report

Read a Rattlesnake system identification and write an HTML

system_id_run

Work a Rattlesnake system identification up into a project.

export_figure

Write one interactive figure as a JSON data file, and optionally

export_html

Write one interactive figure as a single self-contained HTML file.

convert

values converted from one unit to another, through SI.

si_factor

Multiplier converting values in unit to SI.

Classes

Issue dataclass

Issue(name: str, kind: str, message: str, missing_dofs: list = list(), sub_items: list = list())

Why one object does not fit the geometry or shape set it answers to.

kind is 'dofs-not-in-geometry', 'modes-not-in-set' (an object of modal coordinates alone), or 'modes-beyond-set' (modal records beside physical ones, the physical ones fitting). missing_dofs lists the DOFs at fault, and sub_items the indices of the records, shapes or channels that name them.

Report dataclass

Report(geometry_name: str | None = None, issues: dict = dict())

The result of check_compatibility: an Issue for each object that does not fit, by name, and the geometry the rest were judged against.

Methods:

Name Description
is_compatible

Whether one object fits the geometry or shape set it answers to.

issue_for

What is wrong with one object, or None if nothing is.

sub_item_flagged

Whether one record, shape or channel within an object is

Attributes:

Name Type Description
incompatible_names list[str]

The names of the objects that have an issue, which the tree

Attributes
incompatible_names property
incompatible_names: list[str]

The names of the objects that have an issue, which the tree marks in red.

Methods:
is_compatible
is_compatible(name: str) -> bool

Whether one object fits the geometry or shape set it answers to.

Parameters:

Name Type Description Default
name str

The object to ask about.

required

Returns:

Type Description
bool

True when no issue was found for it.

issue_for
issue_for(name: str) -> Issue | None

What is wrong with one object, or None if nothing is.

Parameters:

Name Type Description Default
name str

The object to ask about.

required

Returns:

Type Description
Issue or None

What is wrong with it, or None if nothing is.

sub_item_flagged
sub_item_flagged(name: str, index: int) -> bool

Whether one record, shape or channel within an object is flagged.

Parameters:

Name Type Description Default
name str

The object to ask about.

required
index int

Its index within the object.

required

Returns:

Type Description
bool

True when that item names a DOF the geometry lacks, or a mode no shape set has.

ChannelTable

ChannelTable(columns: Mapping[str, Any] | DataFrame, environments: Mapping[str, Environment] | None = None)

Per-channel metadata, in one fixed set of typed columns.

Parameters:

Name Type Description Default
columns mapping or DataFrame

The columns, by name, each with one entry per channel. Names are read through canonical_name, columns outside COLUMNS are dropped, missing ones take their default, and the values are read leniently (see the module description). The controller's columns (CONTROLLER) are there when the source has any of them, and absent otherwise. A channel type left blank is filled in from the unit when the unit names one.

required
environments mapping of str to Environment

The run's control loops by name, each checked as set_environment checks it.

None

Raises:

Type Description
ValueError

If a column in CORE is missing, or the columns differ in length.

Attributes:

Name Type Description
frame DataFrame

The table, one row per channel, columns in SCHEMA order, then the CONTROLLER columns on a table that carries them. Every cell is text except channel, which is an integer. node is text too, blank where no node was recorded.

environments dict of str to Environment

The control loops, in the order they were set. Empty for a table that describes no controller run. While a table has any, its Control column is the union of their control channels and is set through them (set_control), not directly.

Methods:

Name Description
rule_errors

What the table breaks of the rules a row is checked by on both

set_cell

Write one cell, or refuse a value the column cannot hold.

units_for

The units to offer for this channel, given its declared type.

add_channels

Add blank channels at the end of the table, numbered on from

chosen

The rows of the channels choice picks, in table order.

choices

The CHANNEL_CHOICES that pick a channel, in that order:

delete_channels

Remove the given rows in place. At least one row must remain.

add_controller_settings

Convert the table to carry the settings a controller runs each

remove_controller_settings

Drop the controller's columns (CONTROLLER), and nothing else:

orientation

One channel's measured direction on a geometry.

derived_cells

The derived columns' cells for one row, as text.

dof_strings

Each channel's degree of freedom, as '101Z+' strings: the node

rename_dof

Give the channel at coordinate old the coordinate new, in

identities

Each row as the (DOF, quantity) channel of history it names.

roles

Each channel's declared role ('reference', 'response' or

controls

Which channels are control channels, as a boolean per row.

controls_for

The control channels a reference over dofs was held at, as

drives

Which channels the environment drove, as a boolean per row.

rows_of

The rows of the given channel numbers, in the given order.

set_environment

Record a control loop, or replace the one of that name.

remove_environment

Forget a control loop. The Control column keeps what it

set_control

Check or clear Control on one channel for one environment.

transformation

A control loop's transformation as a labeled matrix.

transformed_responses

What a control loop's response transformation made of a

types

Each channel's type (what it measures), '' where undeclared.

sensitivities

Each channel's sensitivity in mV per engineering unit, NaN where

daq_ranges

Each channel's DAQ input range in volts, NaN where unstated.

sensor_ranges

Each sensor's full-scale output in volts, NaN where unstated.

clip_ranges

The level each channel clips at, in volts: the smaller of its

save

Write the table to a file of its own, in the .hforge format.

Attributes
num_channels property
num_channels: int

How many channels the table describes, one per row.

column_names property
column_names: list[str]

The table's column names, in order (title_of gives the headers shown).

has_controller_settings property
has_controller_settings: bool

Whether the table carries the controller's columns (CONTROLLER).

Methods:
rule_errors
rule_errors() -> list[str]

What the table breaks of the rules a row is checked by on both sides of the program, beyond what one cell can say (schema/PROTOCOL.md, "Channel Table"): a sensitivity of 0 on an enabled row that is not a drive, and a negative sensitivity on any enabled row (a channel read inverted says so in its polarity column). A table without the controller's columns has every row on and none a drive. Empty when it breaks none.

Returns:

Type Description
list of str

One sentence per finding, naming the channel.

set_cell
set_cell(name: str, row: int, value: object) -> None

Write one cell, or refuse a value the column cannot hold.

A unit that is not of the channel's declared type is refused; change the type first. Changing the type clears a unit of another kind. A model in the sensor catalog (core.sensor_catalog) fills a blank Make with its maker; a make already written is kept. A triaxial accelerometer's model or serial number is written once: the other acceleration rows at its node, its other legs, get its Make, Model and Serial Number where theirs are blank (and their model is blank or the same). A row of another type at that node, a force gauge, is never filled.

Parameters:

Name Type Description Default
name str

The column to write.

required
row int

Which channel.

required
value object

The value, refused if the column cannot hold it.

required

Returns:

Type Description
None

Raises:

Type Description
KeyError

If there is no column name.

ValueError

If the value cannot be read for that column, repeats a channel number, or disagrees with the channel's type.

units_for
units_for(row: int) -> list[str]

The units to offer for this channel, given its declared type.

Parameters:

Name Type Description Default
row int

Which channel.

required

Returns:

Type Description
list of str

The shortlist for the declared type, or every unit in every shortlist when the type is blank.

add_channels
add_channels(count: int = 1) -> list[int]

Add blank channels at the end of the table, numbered on from the highest channel in it (from 1 in an empty table).

Every other cell takes its column's default, so the node, direction and unit are blank until they are typed in.

Parameters:

Name Type Description Default
count int

How many channels to add.

1

Returns:

Type Description
list of int

The new channels' numbers.

Raises:

Type Description
ValueError

If count is less than 1.

chosen
chosen(choice: str = 'all') -> list[int]

The rows of the channels choice picks, in table order.

Parameters:

Name Type Description Default
choice str

One of CHANNEL_CHOICES: 'control' for the channels with Control checked, whatever their role, or a role.

'all'

Returns:

Type Description
list of int

The rows.

Raises:

Type Description
ValueError

If choice is not one of CHANNEL_CHOICES.

choices
choices() -> list[str]

The CHANNEL_CHOICES that pick a channel, in that order: 'all' always, then 'control' when a channel has Control checked, then each role a channel holds.

delete_channels
delete_channels(indices: Sequence[int]) -> None

Remove the given rows in place. At least one row must remain.

Parameters:

Name Type Description Default
indices sequence of int

Which rows to remove.

required

Returns:

Type Description
None

Raises:

Type Description
IndexError

If an index is out of range.

ValueError

If every row would be removed.

add_controller_settings
add_controller_settings() -> None

Convert the table to carry the settings a controller runs each channel at: the CONTROLLER columns, added after the others.

Nothing the table holds changes, and a table that has them already is left as it is. The new columns start from what the table says: every channel on, none a drive; the control channels are already the Control column's and a reference its role of reference, since a channel's role in the loop is read from those; and each input's full scale in its own unit is its clip level in volts over its sensitivity, where both are stated. The rest start blank: unbound, no IEPE, positive polarity, no control group and no abort limits.

Returns:

Type Description
None
remove_controller_settings
remove_controller_settings() -> None

Drop the controller's columns (CONTROLLER), and nothing else: the table describes the measurement alone again. A table without them is left as it is.

Returns:

Type Description
None
orientation
orientation(row: int, geometry: Any) -> tuple[ndarray | None, str | None, float | None]

One channel's measured direction on a geometry.

The row's DOF (node and direction) is read through the coordinate system its node is measured in (Geometry.dof_direction). The result is that direction as a unit vector in the geometry's global system, the signed global axis nearest it ('X+', 'Z-'), and the angle between the two in degrees. These are the values the derived columns show.

Parameters:

Name Type Description Default
row int

The channel's row.

required
geometry Geometry

The geometry the channel is measured on.

required

Returns:

Type Description
tuple

(vector, axis, angle), each None when the geometry is None or cannot place the channel: the node is not on it, the direction is missing, or the node is measured in a coordinate system that turns with position.

derived_cells
derived_cells(row: int, geometry: Any) -> list[str]

The derived columns' cells for one row, as text.

The three components of the direction to three decimals, the nearest axis, and the angle to a tenth of a degree; all empty when the geometry cannot place the channel.

Parameters:

Name Type Description Default
row int

The channel's row.

required
geometry Geometry

The geometry the channel is measured on.

required

Returns:

Type Description
list of str

One cell per DERIVED_COLUMNS entry.

dof_strings
dof_strings() -> list[str]

Each channel's degree of freedom, as '101Z+' strings: the node and direction cells joined, so a missing one is left out.

rename_dof
rename_dof(old: str, new: str, quantity: str | None = None) -> int

Give the channel at coordinate old the coordinate new, in place, by rewriting its node and direction cells.

This is the same correction as DataArray.rename_dof, made in the table that names the channels. Only the channels at old that match quantity are changed, not every channel at the node.

Parameters:

Name Type Description Default
old str

The coordinate as the table has it, '101Z+'.

required
new str

The coordinate to give it: a node number then a direction, normalized as every DOF is. It is refused if either part is missing, although a table row may lack one.

required
quantity str

Which channel at old, by its type, or the quantity its unit names when it has none ('acceleration', 'force' and so on; 'unknown' where neither says). Every channel at the coordinate when omitted.

None

Returns:

Type Description
int

How many channels changed; 0 when new equals old.

Raises:

Type Description
ValueError

If new is not a whole DOF, or no channel matches.

identities
identities(history: Any = None) -> list[Any]

Each row as the (DOF, quantity) channel of history it names.

The row's channel type is the quantity, the same word a time history's ordinate_dim uses. A row with no channel type names the history's channel at its DOF when there is exactly one there. A row that names none of the history's channels is None.

Parameters:

Name Type Description Default
history TimeHistory

The recording the table describes. Without one, each row's own (DOF, type) is returned.

None

Returns:

Type Description
list of (str, str) or None

One entry per row.

roles
roles() -> list[str]

Each channel's declared role ('reference', 'response' or 'monitor'), '' where undeclared.

controls
controls(environment: str | None = None) -> ndarray

Which channels are control channels, as a boolean per row.

Parameters:

Name Type Description Default
environment str

One of environments: that loop's control channels. Left out, the Control column, which is the union of every environment's when the table has any.

None

Returns:

Type Description
ndarray

True where the channel is a control channel, one per row.

Raises:

Type Description
ValueError

If there is no environment of that name.

controls_for
controls_for(dofs: Sequence[Any]) -> ndarray

The control channels a reference over dofs was held at, as a boolean per row.

A reference belongs to the loop that controlled what it is over: a transformed loop's rows ('1', '2', ...), or another loop's control channels. With no environments, or one, that is the Control column (controls). With several, it is the one loop the DOFs name; where none or more than one is named, no channel is flagged, so a reader falls back to the reference's own pairing rather than taking every loop's controls.

Parameters:

Name Type Description Default
dofs sequence

The reference's DOFs, compared as text.

required

Returns:

Type Description
ndarray

True where the channel is a control channel of that loop.

drives
drives(environment: str) -> ndarray

Which channels the environment drove, as a boolean per row.

Parameters:

Name Type Description Default
environment str

One of environments.

required

Returns:

Type Description
ndarray

True where the channel is one of that loop's drives.

Raises:

Type Description
ValueError

If there is no environment of that name.

rows_of
rows_of(numbers: Sequence[int]) -> list[int]

The rows of the given channel numbers, in the given order.

Parameters:

Name Type Description Default
numbers sequence of int

Channel numbers (the channel column).

required

Returns:

Type Description
list of int

Their rows.

Raises:

Type Description
ValueError

If a number is no channel of the table.

set_environment
set_environment(name: str, environment: Environment) -> None

Record a control loop, or replace the one of that name.

Parameters:

Name Type Description Default
name str

The environment's name, as the controller names it.

required
environment Environment

Its channels and matrices. Every channel number must be a channel of the table, listed once; a response transformation must be two-dimensional with one column per control channel, and a reference transformation one per drive.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

If the name is blank or any of that fails. Nothing is recorded then.

remove_environment
remove_environment(name: str) -> None

Forget a control loop. The Control column keeps what it showed, which a table without environments may then edit.

Parameters:

Name Type Description Default
name str

The environment to forget.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

If there is no environment of that name.

set_control
set_control(environment: str, row: int, value: object) -> None

Check or clear Control on one channel for one environment.

A channel checked joins the loop's control channels, after the ones it has; cleared, it leaves them. The Control column follows as the union.

Parameters:

Name Type Description Default
environment str

Which loop.

required
row int

Which channel.

required
value object

True or False, in any spelling Control accepts.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

If there is no such environment, the flag cannot be read, or the environment transforms its control channels: the matrix's columns are those channels, so it is set with them (set_environment), not one at a time.

transformation
transformation(environment: str, form: str = 'response') -> MatrixAt

A control loop's transformation as a labeled matrix.

Parameters:

Name Type Description Default
environment str

Which loop.

required
form str

'response' for the matrix over its control channels, applied to what they measure, or 'reference' for the one over its drives, applied to the drive signals.

'response'

Returns:

Type Description
MatrixAt

The rows numbered from 1, as the controller's records of them are named, and a column per control (or drive) channel headed by its DOF, in the controller's order.

Raises:

Type Description
ValueError

If there is no such environment, or it holds no such transformation.

transformed_responses
transformed_responses(history: Any, environment: str) -> Any

What a control loop's response transformation made of a recording: its rows, as the controller computed them, as a time history of their own.

The controller applies the matrix to every frame of its control channels in their engineering units and controls the rows in their place, so its specification and spectra are over the rows. The rows are computed the same way here, from each control channel's values in its own stated unit, frame by frame when the recording holds one record per frame. A row is in the control channels' unit when they all share one; over a mix of units its values are numbers in no unit, left undeclared rather than labelled with a guess.

Parameters:

Name Type Description Default
history TimeHistory

The recording, with a record of every control channel.

required
environment str

Which loop.

required

Returns:

Type Description
TimeHistory

A record per row and frame, rows numbered from 1 as the controller's own records of them are, each a response, on the recording's clock and with its averaging.

Raises:

Type Description
ValueError

If the loop holds no response transformation, or the recording lacks a control channel or holds a different number of records of two of them.

types
types() -> list[str]

Each channel's type (what it measures), '' where undeclared.

sensitivities
sensitivities() -> ndarray

Each channel's sensitivity in mV per engineering unit, NaN where undeclared.

daq_ranges
daq_ranges() -> ndarray

Each channel's DAQ input range in volts, NaN where unstated.

sensor_ranges
sensor_ranges() -> ndarray

Each sensor's full-scale output in volts, NaN where unstated.

clip_ranges
clip_ranges() -> ndarray

The level each channel clips at, in volts: the smaller of its DAQ range and its sensor range, whichever is stated, NaN where neither is.

save
save(path: str | PathLike) -> None

Write the table to a file of its own, in the .hforge format.

Parameters:

Name Type Description Default
path str or PathLike

Where to write it; .hforge is added when the suffix is not there.

required

Returns:

Type Description
None

DataArray

DataArray(abscissa: ArrayLike, ordinate: ArrayLike, response_dof: str | Sequence[str], reference_dof: str | Sequence[str] | None = None, ordinate_dim: str | Sequence[str] | None = None, comment: str | Sequence[str] | None = None, ordinate_unit: str | Sequence[str | None] | None = None, reference_unit: str | Sequence[str | None] | None = None, dimension_hint: str | Sequence[str | None] | None = None, block: str | Sequence[str] | None = None)

Base class; use a concrete subclass (TimeHistory, Spectrum, Frf, Psd).

One object holds many records, such as 36 accelerometer channels or the 2 592 FRFs of a 36-by-72 matrix, all sharing one abscissa. Everything that varies between records is a list with one entry per record, so record i is ordinate[i] measured at response_dof[i].

Values are stored in SI once their units are known. A record whose units were never declared keeps the file's raw numbers and has ordinate_dim == 'unknown'; what the file said it was, without giving its unit, is kept in dimension_hint.

Parameters:

Name Type Description Default
abscissa array - like

The x axis, in seconds or hertz.

required
ordinate array - like

The values, shape (records, len(abscissa)); a single record may be one-dimensional.

required
response_dof str or sequence of str

One DOF string per record, or one string for every record.

required
reference_dof str or sequence of str

One per record. Required by the kinds that need a reference (Frf).

None
ordinate_dim str or sequence of str

The dimension of each record; 'unknown' when omitted.

None
comment str or sequence of str

Free text per record.

None
ordinate_unit str or sequence of str

The unit each record was declared in. Filled with the SI unit where the dimension is known and no unit is given.

None
reference_unit str or sequence of str

The unit each record was declared in. Filled with the SI unit where the dimension is known and no unit is given.

None
dimension_hint str or sequence of str

The quantity the source named for each record, kept only where the dimension is unknown.

None
block str or sequence of str

A label per record for repeats of the same measurement.

None

Raises:

Type Description
ValueError

If the ordinate's shape does not match the abscissa, a list has the wrong length, a DOF cannot be read, or a needed reference is missing.

Attributes:

Name Type Description
abscissa ndarray

The x axis, shared by every record: seconds for a time history, hertz for anything in the frequency domain. It is stored as it arrived, and uneven spacing and out-of-order samples are both allowed, since both occur in real data. Anything that needs an even step (anything with an FFT in it) checks for one when it runs and raises a ValueError saying what is wrong.

ordinate ndarray

Shape (records, len(abscissa)). Complex where the subclass says so (complex_ordinate), real otherwise.

response_dof list of str

What each record was measured at, as a DOF string ('101X+').

reference_dof list of str or None

What each record was measured against, for the kinds that have one: the shaker on an FRF, the other channel of a cross spectrum. None where the kind has no reference.

block list of str or None

Which repeat of the same measurement each record is: an average, a run, a shock. A short label, not a time.

ordinate_dim list of str

The quantity each record measures ('acceleration', 'force'), or 'unknown' while its units are undeclared.

ordinate_unit list of str or None

The unit each record was declared in, such as 'g'. The values are stored in SI whatever the declared unit; a record made with a known dimension and no unit is given the SI unit. None means undeclared.

reference_unit list of str or None

The same for the reference of a ratio, so an FRF record has both halves of (m/s²)/N.

dimension_hint list of str or None

What the file said a record measures, without giving its unit. Nothing is ever scaled by a hint: it limits the units offered, labels an axis, and is written back out on export.

comment list of str

Free text per record, as the source file had it.

Methods:

Name Description
known_dim

What quantity record i holds, whether or not its unit is known.

units_for

The (ordinate unit, reference unit) a unit system gives for a

record_fields

Each record's description (DOFs, quantity, units, hint, comment

rename_dof

Give a channel's coordinate a new name, in place.

kept

A copy holding only records, in the object's order and once

delete_records

Remove records in place, by index, by DOF, or by capture.

define_units

Declare what the ordinate values are in, converting them to SI.

undefine_units

Withdraw a units declaration, restoring the file's raw values.

column_keys

What tells one record from another besides its response DOF.

record_label

A short label for one record, for a legend or an axis.

record_pair

The (response, reference) DOFs of record i.

log_scaled

Whether this object's magnitude is drawn on a log axis.

display_abscissa

The abscissa converted into a unit system's own units.

display_ordinate

The ordinate in display units; records with undefined units are

display_blocks

display_ordinate, a block of records at a time.

save

Write this object to a .hforge file of its own.

Attributes
num_records property
num_records: int

How many records this object holds, all sharing its one abscissa.

units_defined property
units_defined: bool

Whether every record has its units defined. False while any record still holds the file's unconverted numbers.

undefined_records property
undefined_records: list[int]

The indices of the records with no declared dimension, which hold the file's raw numbers until define_units is called.

Methods:
known_dim
known_dim(i: int) -> str

What quantity record i holds, whether or not its unit is known.

The dimension when the units are defined, otherwise the dimension hint, otherwise 'unknown'. Do not scale values by this: a hinted record's values are raw, and its scale is what is not known.

Parameters:

Name Type Description Default
i int

Which record.

required

Returns:

Type Description
str

The quantity the record holds, falling back to its dimension hint when the unit is undeclared.

units_for classmethod
units_for(dimension: str, system: UnitSystem = SI) -> tuple[str, str | None]

The (ordinate unit, reference unit) a unit system gives for a known dimension.

With SI, the default, this is the pair a record is labeled with when it is made with a known dimension and no unit. With another system it is the pair a record is labeled with when its values are written in that system, as the .mat writer does in the display units. The base class returns no reference unit; Frf and Psd split the dimension into its two halves.

Parameters:

Name Type Description Default
dimension str

An ordinate_dim, such as 'acceleration'.

required
system UnitSystem

The unit system; SI when omitted.

SI

Returns:

Type Description
tuple of (str, str or None)

The ordinate unit and the reference unit, None where the record has no reference.

record_fields
record_fields() -> dict[str, Any]

Each record's description (DOFs, quantity, units, hint, comment and block) as the keyword arguments for making a derived object with the same records. Every list is a copy.

A filter, a truncation and an octave banding keep their source's records and change only the values. Override comment where the derived object should say how it was made.

Returns:

Type Description
dict

Keyword arguments for a DataArray constructor, without the abscissa and ordinate.

rename_dof
rename_dof(old: str, new: str, quantity: str | None = None) -> int

Give a channel's coordinate a new name, in place.

A channel is a coordinate and a quantity: a drive point has a load cell and an accelerometer at one DOF. With quantity given, only that channel is renamed, so a force labeled at the wrong node can be moved without moving the accelerometer at the same node. The channel is renamed wherever it appears, as a response and as a reference, since a CPSD's accelerometer is on both sides of its cross terms and is one sensor. A rename that would give two records the same coordinate and quantity (two accelerometers at one point) is refused.

Parameters:

Name Type Description Default
old str

The coordinate as it is, '101Z+'.

required
new str

The coordinate to give it; normalized the way every DOF is ('101Z' is '101Z+'), and refused when it is not one.

required
quantity str

Which channel at old: 'acceleration', 'force' and so on, as channel_quantities names a record's factors. When omitted, every quantity at the coordinate is renamed.

None

Returns:

Type Description
int

How many DOFs changed, counting a response and a reference on one record separately; 0 when new equals old.

Raises:

Type Description
ValueError

If new is not a DOF, no record matches, or the rename would put two channels of one quantity at one coordinate.

kept
kept(records: Sequence[int] | None) -> DataArray

A copy holding only records, in the object's order and once each, with everything each record has (delete_records on the copy); the object itself when records is None. The records picked in the tree are what an action reads.

Only the rows kept are copied: the ordinate is sliced, and the object itself is not changed.

Parameters:

Name Type Description Default
records sequence of int or None

Which records to keep, by zero-based index.

required

Returns:

Type Description
DataArray

The copy, of the object's own type, or the object itself for None.

Raises:

Type Description
ValueError

For an empty records.

IndexError

For a record the object does not have.

delete_records
delete_records(indices: Sequence[int] | None = None, *, dof: str | Sequence[str] | None = None, dim: str | Sequence[str] | None = None, reference: str | Sequence[str] | None = None, capture: int | Sequence[int] | None = None) -> None

Remove records in place, by index, by DOF, or by capture.

Everything a record has is removed with it: its row of the ordinate, its DOFs, units, comment, hint and block, and on a specification its limit curves. Removing every record is refused, since an empty data array cannot be shown. Numbered block labels are renumbered without gaps afterward; named ones are kept.

dof, dim, reference and capture select records by what they are ("channel 101Z+", "the third run"). Together they select the records that match all of them, and that selection is added to any indices given.

Parameters:

Name Type Description Default
indices sequence of int

Which records to remove, by position.

None
dof str or sequence of str

Remove the records at these response DOFs. A drive point has two records at one DOF, a force and an acceleration, and the DOF alone selects both; add dim to select one.

None
dim str or sequence of str

Limit the selection to records whose ordinate_dim is one of these ('force', 'acceleration', ...).

None
reference str or sequence of str

Remove the records at these reference DOFs: a column of an FRF matrix, where dof is a row.

None
capture int or sequence of int

Remove these captures, numbered as capture_indices numbers them (each channel's n-th recording). Time histories only.

None

Returns:

Type Description
None

Raises:

Type Description
ValueError

If the selection matches nothing, would remove every record, or uses reference or capture on a kind that has none.

IndexError

If an index is out of range.

define_units
define_units(units: str | Sequence[str | None], reference_units: str | Sequence[str | None] | None = None) -> DataArray

Declare what the ordinate values are in, converting them to SI.

units is one unit applied to every record, a sequence with one entry per record, or a {record index: unit} mapping to set only some. An entry of None leaves that record as it is. A record that already has units is converted from its original values, so it is never scaled twice. The record's dimension is set from the unit.

Parameters:

Name Type Description Default
units str, sequence of str, or dict

The unit each record's values are in.

required
reference_units str, sequence of str, or dict

The reference unit, in the same forms: an FRF's denominator (required for an FRF), or a cross spectrum's second channel. Kinds with no reference ignore it.

None

Returns:

Type Description
DataArray

Self, converted to SI in place.

Raises:

Type Description
UnitError

If a unit cannot be read or names no tracked dimension.

undefine_units
undefine_units(records: Sequence[int] | None = None) -> DataArray

Withdraw a units declaration, restoring the file's raw values.

The inverse of define_units. The records return to dimension 'unknown' with no unit. There is no unit string that means "not known", so withdrawing a declaration has its own call. Records that have no units are left as they are.

Parameters:

Name Type Description Default
records sequence of int

Which records to revert. All of them when omitted.

None

Returns:

Type Description
DataArray

Self, with the file's raw values restored.

column_keys
column_keys() -> list[str] | None

What tells one record from another besides its response DOF.

The reference DOFs when the records are a matrix of measurements, the block labels when they are the same measurement repeated, and None when the response DOF alone identifies a record. An object with column keys is shown as a grid.

record_label
record_label(i: int) -> str

A short label for one record, for a legend or an axis.

Parameters:

Name Type Description Default
i int

Which record.

required

Returns:

Type Description
str

The record's DOF, plus whatever tells it from its neighbors.

record_pair
record_pair(i: int) -> tuple[str, str]

The (response, reference) DOFs of record i.

A record with no reference is an autospectrum, a channel against itself, so its reference is its own response DOF (the diagonal, which is what a specification bounds).

Parameters:

Name Type Description Default
i int

The record.

required

Returns:

Type Description
tuple of str

Response DOF, reference DOF.

log_scaled
log_scaled() -> bool

Whether this object's magnitude is drawn on a log axis.

Logarithmic for frequency-domain data unless the class sets log_ordinate (a coherence is a ratio from 0 to 1 and is drawn linear).

Returns:

Type Description
bool

True for a log ordinate axis.

display_abscissa
display_abscissa(unit_system: UnitSystem) -> ndarray

The abscissa converted into a unit system's own units.

Parameters:

Name Type Description Default
unit_system UnitSystem

The units to present in.

required

Returns:

Type Description
ndarray

The abscissa in display units.

display_ordinate
display_ordinate(unit_system: UnitSystem, records: Iterable[int] | None = None) -> ndarray

The ordinate in display units; records with undefined units are returned unchanged.

Only the records in records are converted, in that order.

Parameters:

Name Type Description Default
unit_system UnitSystem

The units to present the values in.

required
records iterable of int

Which records to convert. All of them when omitted.

None

Returns:

Type Description
ndarray

The values in display units, one row per record asked for. Records with undefined units are unchanged.

display_blocks
display_blocks(unit_system: UnitSystem, records: Iterable[int] | None = None, block_bytes: int | None = None) -> Iterator[tuple[int, int, ndarray]]

display_ordinate, a block of records at a time.

Yields (start, stop, values): positions within records and the converted rows for them, each block at most block_bytes (DISPLAY_BLOCK_BYTES by default). A caller that reduces each record before drawing it, such as the 3-D view, then never holds a converted copy of the whole object. A record larger than the limit is one block on its own; a row is never split.

Parameters:

Name Type Description Default
unit_system UnitSystem

The units to present the values in.

required
records iterable of int

Which records to convert. All of them when omitted.

None
block_bytes int

The most a block may hold, in bytes.

None

Yields:

Type Description
tuple of (int, int, numpy.ndarray)

The block's positions among records, and its values in display units.

save
save(path: str | PathLike) -> None

Write this object to a .hforge file of its own.

Parameters:

Name Type Description Default
path str or PathLike

Where to write it; .hforge is added when the suffix is not there.

required

Returns:

Type Description
None

Frf

Frf(abscissa: ArrayLike, ordinate: ArrayLike, response_dof: str | Sequence[str], reference_dof: str | Sequence[str] | None = None, ordinate_dim: str | Sequence[str] | None = None, comment: str | Sequence[str] | None = None, ordinate_unit: str | Sequence[str | None] | None = None, reference_unit: str | Sequence[str | None] | None = None, dimension_hint: str | Sequence[str | None] | None = None, block: str | Sequence[str] | None = None)

Bases: DataArray

Frequency response function: response per unit reference.

Every record has a reference DOF. Units are declared as a response unit and a reference unit (define_units('g', 'lbf')), and the dimension is their ratio, such as 'acceleration/force'.

Methods:

Name Description
units_for

The (response unit, reference unit) a unit system gives for an

conditioning

The singular values and condition number of this FRF matrix at

half_power

Read Q from the half-power width of the peak nearest near

Methods:
units_for classmethod
units_for(dimension: str, system: UnitSystem = SI) -> tuple[str, str]

The (response unit, reference unit) a unit system gives for an FRF dimension: 'acceleration/force' in SI is ('m/s**2', 'N'). See DataArray.units_for.

Parameters:

Name Type Description Default
dimension str

An ordinate_dim, such as 'acceleration/force'.

required
system UnitSystem

The unit system; SI when omitted.

SI

Returns:

Type Description
tuple of (str, str)

The response unit and the reference unit.

conditioning
conditioning(records: Sequence[int] | None = None, *, limit: float | None = None, progress: Callable[[int, int], None] | None = None) -> Conditioning

The singular values and condition number of this FRF matrix at every line, and the lines where it is ill-conditioned (core.matrix_checks.read_conditioning).

The records make the matrix of responses by references; two references or more, every response against every reference, one unit. Where the condition number is over limit, the drives reach the responses in nearly the same proportions and an inverse of this matrix, which a controller makes to drive them, amplifies the error in it by up to that much.

Parameters:

Name Type Description Default
records sequence of int

The records that make the matrix; all of them when omitted.

None
limit float

The condition number lines are flagged over; core.matrix_checks.CONDITION_LIMIT when omitted.

None
progress callable

Told (0, core.progress.BUSY) before the decomposition; the app's progress bar uses it.

None

Returns:

Type Description
Conditioning

The singular values at every line, with the condition number, the effective rank and the flagged bands.

Raises:

Type Description
ValueError

For an empty selection, one reference, records in different units, or an incomplete matrix.

half_power
half_power(near: float, record: int = 0, *, within: tuple[float, float] | None = None, warn: bool = True) -> HalfPower

Read Q from the half-power width of the peak nearest near on one record's magnitude.

core.half_power.read_half_power does the reading and says how; hertzforge.drawing.plot.plot_half_power draws it on the record.

Parameters:

Name Type Description Default
near float

A frequency on the peak to read, in Hz.

required
record int

Which record.

0
within tuple of float

A (low, high) band in Hz whose tallest line is the peak.

None
warn bool

Warn a missing crossing or too few lines across the peak as a HalfPowerWarning; the notes are on the reading either way.

True

Returns:

Type Description
HalfPower

The peak's frequency and height (in SI, as the record is stored), its half-power crossings, Q and damping ratio.

Geometry

Geometry(node_id: Ids, node_xyz: ArrayLike, node_def_cs: ArrayLike | None = None, node_disp_cs: ArrayLike | None = None, node_color: ArrayLike | None = None, cs_id: Ids | None = None, cs_name: Sequence[str] | None = None, cs_type: ArrayLike | None = None, cs_matrix: ArrayLike | None = None, elem_id: Ids | None = None, elem_type: ArrayLike | None = None, elem_color: ArrayLike | None = None, elem_conn: Sequence[ArrayLike] | None = None, elem_group: Ids | None = None, group_id: Ids | None = None, group_name: Sequence[str] | None = None, length_unit: str | None = None, group_properties: Mapping[int, Any] | None = None, from_deck: bool = False, mass_unit: str | None = None)

Nodes, coordinate systems, elements and element groups.

The parameters are array-likes with the names of the attributes below; elem_conn holds one integer array of node ids per element. Coordinates are in the global cartesian frame, in meters once length_unit is declared. Without coordinate systems the geometry gets one, the global cartesian system with id 1. An element whose descriptor does not match its node count is corrected (reconcile_type), and an element group holding more than one element family is split (split_groups_by_family). Raises ValueError when the result is not consistent (validate).

The arrays below hold the data; nodes, coordinate_systems, elements and groups are views of them, which is how the project tree lists a geometry and usually the easiest way for a script to use one. A view is not a copy, so writing through a row writes into the geometry.

There are no separate tracelines. A line drawn through nodes is an element group of two-node line elements with no properties: add_beams creates one, and drawn_lines returns them for the file formats that store tracelines separately. The same element group becomes part of the structure once it is given a section.

Attributes: node_id: Every node's id. Unique, because elements and placement refer to nodes by id. node_xyz: (nodes, 3) coordinates, in meters once length_unit is declared and the file's numbers before that. node_def_cs: The coordinate system each node is placed in. node_disp_cs: The coordinate system each node is measured in, which is the system a shape's values at that node are in. node_color: Palette index per node. cs_id: Coordinate system ids. Unique, for the same reason as node ids. cs_name: A name per system, often empty. cs_type: 0 cartesian, 1 cylindrical, 2 spherical (CS_TYPES). cs_matrix: (systems, 4, 3): three direction rows, then the origin, so cs_matrix[i, 3] is the origin of system i. elem_id: Element ids. They are only labels; nothing refers to them. elem_type: UFF dataset 2412 descriptor code per element (ELEMENT_TYPES names them and says how each is drawn). elem_color: Palette index per element. elem_conn: One array of node ids per element. elem_group: The id of the element group each element belongs to. group_id: The declared element groups. Unique, since elements refer to them by id. group_name: A name per element group, such as 'wing' or 'arm front left'. This is where a mesh records that a region is a different part from its neighbor, and fem.Model.from_geometry reads a member's section from it. group_properties: {element group id: fem.GroupProperties}, the material and thickness or section of each element group that has them. length_unit: The unit of the coordinates, or None while it has not been declared, in which case they are the file's own numbers and nothing has been scaled. mass_properties: The reference point, mass and inertia for the rigid-body shapes (core.rigid.MassProperties), or None. view: The direction the geometry opens in 3-D (View), or None for DEFAULT_VIEW. solids: The solid shapes of the parts before they are meshed (core.solids). mates: Where element groups' surfaces are joined, by rigid links or springs made when a model is built (core.mates).

Methods:

Name Description
validate

Check that the geometry is consistent, and raise ValueError

node_index

Positions of the given node ids in the node arrays.

contains_nodes

Boolean array: which of node_ids this geometry defines.

missing_dofs

The DOF strings whose node this geometry does not define.

suggest_mass_properties

Mass properties with the centroid of the nodes as the reference

define_units

Declare the length unit of the coordinates, converting them to SI.

undefine_units

Remove the length unit and restore the original coordinates; returns self.

dof_direction

A DOF's direction in global coordinates, from the coordinate

add_node

Add a node at xyz and return its id.

add_nodes

Add nodes at xyz, numbered from one more than the highest id.

add_coordinate_system

Add a coordinate system and return its id.

place_coordinate_system

Rotate a coordinate system, move it, or both, as the 3-D

set_coordinate_system_type

Make a coordinate system cartesian (0), cylindrical (1) or

node_local_xyz

Each node's coordinates in the coordinate system it is placed

set_node_local_xyz

Place the node at row at xyz, given in the coordinate

set_node_placement

Place nodes in another coordinate system, keeping their

add_beams

Add a chain of two-node line elements through the given nodes,

mixed_groups

{element group id: families} for every element group that

split_groups_by_family

Split every element group that holds more than one element family.

attach_drawn_lines

Add drawn lines read from a format that stores them separately

is_drawn_line

Whether an element group is a drawn line.

drawn_lines

The drawn lines, in the form used by file formats that store

group_of

The name of the element group an element belongs to, or '' when

elements_in

The ids of the elements in an element group, given by id or name.

nodes_in

The ids of the nodes used by the elements of these element

add_group

Declare an element group and return its id.

add_element

Add an element and return its row index.

add_elements

Add many elements at once, numbered from one more than the

renumber_node

Give a node a new id, and update the elements that use it.

rename_group

Give an element group a name.

move_elements

Put elements in another element group, as dragging them onto it in the tree does.

renumber_group

Give an element group a new id, and update its elements.

renumber_coordinate_system

Give a coordinate system a new id, and update the nodes that use it.

delete_nodes

Remove nodes, and the elements that use them.

coincident_nodes

{node: the node it coincides with} for every node within

duplicate_elements

{element id: the element it duplicates} for every solid

merge_duplicate_elements

Remove duplicate solid elements (duplicate_elements).

node_spacing

The mesh's finest spacing: the shortest nonzero distance between

coincident_spots

The places where a merge would make one node.

merge_folds

Why this merge would be refused, or None.

merge_collapses

The ids of the line elements this merge would remove.

merge_coincident_nodes

Merge nodes that are at one point into one node.

align_reach

The default reach of Align Meshes: half the mesh size of the

align_moves

The moves Align Meshes would make, each [node, onto]: a node

align_folds

Why these moves would be refused, or None.

align_meshes

Move the nodes of the coarser piece onto the nodes of the finer

delete_coordinate_systems

Remove coordinate systems, and give the nodes that used them to

delete_groups

Remove element groups with their elements, their properties, and

merge_refusal

Why these element groups cannot be merged, or None when they can.

merge_groups

Merge several element groups into the first one (Merge Element

delete_elements

Remove elements by id. Ids that are not present are ignored.

save

Write the geometry to a file of its own.

load

Read a geometry written by save.

Attributes:

Name Type Description
opening_view View

The view the geometry opens in 3-D: its own view, or

num_nodes int

How many nodes the geometry defines.

nodes EntityView

Every node: ids, xyz, colors, placement_systems and

coordinate_systems EntityView

Every coordinate system: ids, names, types and matrices

elements EntityView

Every element: ids, types, colors, groups and nodes

groups EntityView

Every element group: ids and names (an EntityView).

extent tuple[ndarray, ndarray]

(min_xyz, max_xyz) of the nodes, in meters once units are defined.

units_defined bool

Whether the length unit of the coordinates has been declared.

Attributes
opening_view property
opening_view: View

The view the geometry opens in 3-D: its own view, or DEFAULT_VIEW (from +X+Y+Z, Z up) when it has none.

num_nodes property
num_nodes: int

How many nodes the geometry defines.

nodes property
nodes: EntityView

Every node: ids, xyz, colors, placement_systems and displacement_systems (an EntityView).

coordinate_systems property
coordinate_systems: EntityView

Every coordinate system: ids, names, types and matrices (an EntityView).

elements property
elements: EntityView

Every element: ids, types, colors, groups and nodes (an EntityView).

groups property
groups: EntityView

Every element group: ids and names (an EntityView).

An element group does not store its elements. Which elements are in one is read from elem_group (elements_in), so moving an element to another element group is an edit to the element.

extent property
extent: tuple[ndarray, ndarray]

(min_xyz, max_xyz) of the nodes, in meters once units are defined.

units_defined property
units_defined: bool

Whether the length unit of the coordinates has been declared. False until define_units is called.

Methods:
validate
validate() -> None

Check that the geometry is consistent, and raise ValueError naming the first problem found.

Node, coordinate system and element group ids must be unique, every element's nodes must exist, every element must name an element group the geometry has, every element type must be in ELEMENT_TYPES, and each element group must hold one element family.

node_index
node_index(node_ids: Ids) -> ndarray

Positions of the given node ids in the node arrays.

Every id must be one the geometry has (contains_nodes asks without raising).

Parameters:

Name Type Description Default
node_ids int or sequence of int

The identifiers, one or many.

required

Returns:

Type Description
ndarray

Each identifier's row in the node arrays.

Raises:

Type Description
KeyError

Naming the ids the geometry does not have.

contains_nodes
contains_nodes(node_ids: Ids) -> ndarray

Boolean array: which of node_ids this geometry defines.

Parameters:

Name Type Description Default
node_ids int or sequence of int

The identifiers, one or many.

required

Returns:

Type Description
ndarray

A boolean per identifier: whether the geometry has it.

missing_dofs
missing_dofs(dofs: Sequence[str]) -> list[str]

The DOF strings whose node this geometry does not define.

Parameters:

Name Type Description Default
dofs sequence of str

The degrees of freedom to check, such as '101Z+'.

required

Returns:

Type Description
list of str

The DOFs whose node the geometry does not have, including any DOF that names no node. A data object with such DOFs is not compatible with this geometry.

suggest_mass_properties
suggest_mass_properties() -> MassProperties

Mass properties with the centroid of the nodes as the reference point and no mass, which give unit rigid-body shapes about the middle of the model.

The rigid-body panel opens with these values, and generate_rigid_body_modes uses them when nothing has been set. They are the settings the virtual point transformation needs most often. Raises ValueError when the geometry has no nodes.

Returns:

Type Description
MassProperties

The centroid, unscaled.

define_units
define_units(length_unit: str, mass_unit: str | None = None) -> Geometry

Declare the length unit of the coordinates, converting them to SI.

The node coordinates, the coordinate system origins and the solids' lengths are converted. Declaring again reinterprets the original values instead of scaling twice, so a wrong unit can be corrected.

A geometry read from a finite element deck (from_deck) also holds the deck's property values, in the consistent system its length unit, a mass unit and seconds make: a thickness is a length, a modulus a force per area, a density a mass per volume, a point mass a mass, a spring a force per length (or, about an axis, a force times a length). Those are converted with the coordinates (deck_to_si). The mass unit is mass_unit, or the one a deck in that length is written with when it is omitted (DECK_MASS_UNITS: tonnes with millimeters, lbf·s²/in with inches). A material whose converted modulus or density is not a structural material's is warned about, since that is what a wrong mass unit looks like.

Parameters:

Name Type Description Default
length_unit str

The unit the coordinates are in, such as 'm' or 'in'.

required
mass_unit str

The mass unit of a deck's properties, such as 'tonne'.

None

Returns:

Type Description
Geometry

Self, converted to SI in place.

undefine_units
undefine_units() -> Geometry

Remove the length unit and restore the original coordinates; returns self.

dof_direction
dof_direction(dof: str) -> ndarray | None

A DOF's direction in global coordinates, from the coordinate system its node is measured in.

'101X+' at a node whose node_disp_cs is rotated is not global X. The report's table of control channels uses this to show which global axis each channel is nearest and how far it is from it. A rotational DOF points along its axis, as the DOF arrows draw it. A node whose system is not in the geometry is taken to be in the global system.

Parameters:

Name Type Description Default
dof str

The DOF, such as '101X+' or '1313RZ-'.

required

Returns:

Type Description
ndarray or None

A unit vector, or None when the DOF names no node this geometry has, has no axis (a node number alone), or is at a node measured in a cylindrical or spherical system, whose local axes depend on the node's position and are not computed here.

add_node
add_node(xyz: ArrayLike, node_id: int | None = None, color: int = 1, def_cs: int | None = None, disp_cs: int | None = None) -> int

Add a node at xyz and return its id.

Raises ValueError if a node with node_id already exists.

Parameters:

Name Type Description Default
xyz array_like

The node's coordinates in the global cartesian frame, in meters once units are defined. They are stored as given.

required
node_id int

Its identifier. One more than the highest node id when omitted.

None
color int

Its display color index.

1
def_cs int

The coordinate system the node is placed in, which a writer uses to give its position. xyz is not converted from it. The first coordinate system when omitted.

None
disp_cs int

The coordinate system displacements at the node are measured in. The first coordinate system when omitted.

None

Returns:

Type Description
int

The node's identifier.

add_nodes
add_nodes(xyz: ArrayLike) -> ndarray

Add nodes at xyz, numbered from one more than the highest id.

This is add_node for many nodes at once, with the defaults of add_node. Each array is copied once instead of once per node, so adding the thousands of nodes of a meshed plane is fast.

Parameters:

Name Type Description Default
xyz array_like

(n, 3) coordinates in the global cartesian frame, in meters once units are defined.

required

Returns:

Type Description
ndarray

The new nodes' identifiers, in order.

add_coordinate_system
add_coordinate_system(origin: ArrayLike = (0.0, 0.0, 0.0), rotation: ArrayLike | None = None, cs_id: int | None = None, name: str = '', cs_type: int = 0) -> int

Add a coordinate system and return its id.

Raises ValueError if a system with cs_id already exists.

Parameters:

Name Type Description Default
origin array_like

The system's origin, in meters once units are defined.

(0, 0, 0)
rotation array_like

A 3x3 matrix whose rows are the system's axes. Identity when omitted.

None
cs_id int

Its identifier. One more than the highest id when omitted.

None
name str

What to call it.

''
cs_type int

0 cartesian, 1 cylindrical, 2 spherical.

0

Returns:

Type Description
int

The coordinate system's identifier.

place_coordinate_system
place_coordinate_system(cs_id: int, *, origin: ArrayLike | None = None, angles: ArrayLike | None = None, rotation: ArrayLike | None = None) -> None

Rotate a coordinate system, move it, or both, as the 3-D view's rings and arrows do. The nodes placed in it move with it, keeping their coordinates in it.

Raises KeyError for an unknown cs_id, and ValueError when both angles and rotation are given.

Parameters:

Name Type Description Default
cs_id int

Which coordinate system.

required
origin array_like

The new origin, in the geometry's stored length unit (meters once its units are declared). Unchanged when omitted.

None
angles array_like

The rotation as angles in degrees about the fixed global X, then Y, then Z axes (rotate.frame_from_angles), the same angles the view's angle box and the box panel use. (0, 0, 0) removes any rotation. Unchanged when omitted.

None
rotation array_like

The rotation as a 3x3 matrix whose rows are the system's axes, instead of angles.

None

Returns:

Type Description
None
set_coordinate_system_type
set_coordinate_system_type(cs_id: int, cs_type: int) -> None

Make a coordinate system cartesian (0), cylindrical (1) or spherical (2). The nodes placed in it keep their coordinates, which now mean (r, theta, z) or (r, theta, phi), so they move.

Raises KeyError for an unknown cs_id, and ValueError for a type that is none of the three.

Parameters:

Name Type Description Default
cs_id int

Which coordinate system.

required
cs_type int

0 cartesian, 1 cylindrical, 2 spherical.

required

Returns:

Type Description
None
node_local_xyz
node_local_xyz(rows: Ids | None = None) -> ndarray

Each node's coordinates in the coordinate system it is placed in, as the node table shows them: (x, y, z) in a cartesian system, (r, theta, z) in a cylindrical one and (r, theta, phi) in a spherical one, angles in degrees.

Parameters:

Name Type Description Default
rows sequence of int

Which nodes, by row; all of them when omitted.

None

Returns:

Type Description
ndarray

(nodes, 3).

set_node_local_xyz
set_node_local_xyz(row: int, xyz: ArrayLike) -> None

Place the node at row at xyz, given in the coordinate system it is placed in (node_local_xyz).

Parameters:

Name Type Description Default
row int

The node's row.

required
xyz array_like

Its three coordinates in its placement system.

required

Returns:

Type Description
None
set_node_placement
set_node_placement(rows: Ids, cs_id: int) -> None

Place nodes in another coordinate system, keeping their coordinates: the same numbers, now in cs_id, so the nodes move to where those numbers put them.

Raises ValueError for a system the geometry does not have.

Parameters:

Name Type Description Default
rows int or sequence of int

The nodes, by row.

required
cs_id int

The coordinate system to place them in.

required

Returns:

Type Description
None
add_beams
add_beams(node_ids: Ids, group: int | None = None, color: int = 1, elem_type: int = 21) -> int

Add a chain of two-node line elements through the given nodes, in order, and return the element group's id.

This is how a drawn line (a traceline in some file formats) is stored, and it becomes a run of beams once the element group is given a section. Raises ValueError for fewer than two nodes, an unknown node, or an elem_type that is not a two-node line.

Parameters:

Name Type Description Default
node_ids sequence of int

The nodes the line runs through, in order; two at least.

required
group int

The element group the segments are added to. A new, unnamed element group when omitted; a drawn line is its own element group, named for the line.

None
color int

The display color index of every segment.

1
elem_type int

The two-node line code (ELEMENT_TYPES): a beam, unless the source says rod, pipe or rigid bar.

21

Returns:

Type Description
int

The element group the segments are in.

mixed_groups
mixed_groups() -> dict[int, list[str]]

{element group id: families} for every element group that holds more than one element family.

It is empty for any geometry that passes validate.

Returns:

Type Description
dict of int to list of str
split_groups_by_family
split_groups_by_family() -> dict[int, list[int]]

Split every element group that holds more than one element family.

The group keeps its first family, and each other family is moved into a new element group named with the old name and the family, such as 'wing quads', with the old group's properties. A file without element groups (UNV dataset 2412, the sdynpy layout) puts every element in one group, so this is applied when such a file is read.

Returns:

Type Description
dict of int to list of int

{old element group: [the new element groups made from it]}, empty when no group was mixed.

attach_drawn_lines
attach_drawn_lines(lines: Sequence[tuple[str, int, Sequence[Ids]]]) -> list[int]

Add drawn lines read from a format that stores them separately from elements, each as its own element group of two-node line elements with no properties.

This is the reading side of drawn_lines.

Parameters:

Name Type Description Default
lines sequence of (name, color, chains)

One entry per line: its name, its color index, and its runs, each a sequence of node ids in drawing order (a UNV line that lifts the pen has several).

required

Returns:

Type Description
list of int

The element groups made, one per line.

is_drawn_line
is_drawn_line(group: int) -> bool

Whether an element group is a drawn line.

It is when every element in it is a two-node line element and the element group has no properties. The app and every file writer use this one test. An empty element group is not a drawn line.

Parameters:

Name Type Description Default
group int

The element group's identifier.

required

Returns:

Type Description
bool
drawn_lines
drawn_lines() -> list[dict[str, Any]]

The drawn lines, in the form used by file formats that store tracelines separately from elements.

One dict {'group', 'name', 'color', 'chains'} per drawn-line element group (is_drawn_line), in element group order. The chains are the group's segments taken in element order, each a list of node ids, with a new chain wherever a segment does not start where the last one ended. An element group read from one polyline gives that polyline back, and one read from a UNV line that lifts the pen gives its runs back under the one element group. The color is that of the group's first element.

Returns:

Type Description
list of dict
group_of
group_of(elem_id: int) -> str

The name of the element group an element belongs to, or '' when that group is not declared.

Parameters:

Name Type Description Default
elem_id int

Which element.

required

Returns:

Type Description
str

The name of the element group it belongs to.

elements_in
elements_in(group: int | str) -> list[int]

The ids of the elements in an element group, given by id or name.

A name that no element group has gives an empty list; with two groups of one name, the first is used.

Parameters:

Name Type Description Default
group int or str

An element group, by identifier or by name.

required

Returns:

Type Description
list of int

The identifiers of the elements it holds.

nodes_in
nodes_in(groups: Ids) -> list[int]

The ids of the nodes used by the elements of these element groups, in ascending order. These are the nodes a merge limited to those groups may change.

Parameters:

Name Type Description Default
groups sequence of int

Element groups, by identifier.

required

Returns:

Type Description
list of int

The node identifiers.

Raises:

Type Description
ValueError

When a group is not in the geometry.

add_group
add_group(name: str = '', group_id: int | None = None, family: str = '') -> int

Declare an element group and return its id.

An empty element group is allowed: exodus files contain empty ones, and an element group has to exist before an element can be put in it. Raises ValueError if group_id is already used.

Parameters:

Name Type Description Default
name str

What to call the element group.

''
group_id int

Its identifier. One more than the highest id when omitted.

None
family str

The element family it is for, such as 'quads' (FAMILIES), kept in group_family: where an empty element group is listed.

''

Returns:

Type Description
int

The element group's identifier.

add_element
add_element(node_ids: Ids, elem_type: int | None = None, color: int = 1, group: int | None = None) -> int

Add an element and return its row index.

The element id is one more than the highest element id. Without elem_type, the type is chosen from the node count: 2 nodes a beam (21), 3 a triangle (41), 4 a quadrilateral (44); any other count needs elem_type. Raises ValueError for an unknown node or type, or for a group that holds a different element family.

Parameters:

Name Type Description Default
node_ids int or sequence of int

The nodes the element connects, in order.

required
elem_type int

The element type code. Inferred from the node count when omitted.

None
color int

Its display color index.

1
group int

The element group it belongs to, which is declared if it does not exist yet. When omitted, the first element group that holds this element's family (or is empty), otherwise a new one. An element group holds one family, so a beam added to a mesh of plates goes in an element group of its own.

None

Returns:

Type Description
int

The element's row index in the element arrays (not its id).

add_elements
add_elements(connectivity: Sequence[Ids], elem_types: Ids, groups: Ids) -> None

Add many elements at once, numbered from one more than the highest element id, with color 1.

The nodes and types are checked once for all of them, and an element group may hold only one element family, as in add_element. If any check fails, ValueError is raised and nothing is added.

Parameters:

Name Type Description Default
connectivity sequence of sequence of int

Each element's nodes, in order.

required
elem_types sequence of int

Each element's type code.

required
groups sequence of int

The element group each belongs to; an element group that does not exist yet is declared, with no name.

required

Returns:

Type Description
None
renumber_node
renumber_node(row: int, node_id: int) -> None

Give a node a new id, and update the elements that use it.

Elements refer to nodes by id, so the connectivity is updated too; otherwise every element at the node would lose it. Raises ValueError if another node already has the id.

Parameters:

Name Type Description Default
row int

Which node, by row.

required
node_id int

Its new identifier.

required

Returns:

Type Description
None
rename_group
rename_group(group_id: int, name: str) -> None

Give an element group a name.

Parameters:

Name Type Description Default
group_id int

The element group's id.

required
name str

Its new name; empty for none.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

When the geometry has no element group with that id.

move_elements
move_elements(elem_ids: Ids, group_id: int) -> int

Put elements in another element group, as dragging them onto it in the tree does.

An element group holds one element family, so elements of another family than the group holds, or than an empty group was made for (group_family), are refused, as are elements of two families at once. The groups they leave stay, empty if they held nothing else.

Parameters:

Name Type Description Default
elem_ids sequence of int

The elements, by id.

required
group_id int

The element group they go in.

required

Returns:

Type Description
int

How many elements moved: those not in the group already.

Raises:

Type Description
ValueError

When the group or an element is not in the geometry, or the families differ.

renumber_group
renumber_group(row: int, group_id: int) -> None

Give an element group a new id, and update its elements.

An element refers to its element group by id, so the elements are updated too; otherwise they would refer to an element group that no longer exists. Raises ValueError if another element group already has the id.

Parameters:

Name Type Description Default
row int

Which element group, by row.

required
group_id int

Its new identifier.

required

Returns:

Type Description
None
renumber_coordinate_system
renumber_coordinate_system(row: int, cs_id: int) -> None

Give a coordinate system a new id, and update the nodes that use it.

Both the placement and the displacement systems of the nodes are updated. Raises ValueError if another system already has the id.

Parameters:

Name Type Description Default
row int

Which system, by row.

required
cs_id int

Its new identifier.

required

Returns:

Type Description
None
delete_nodes
delete_nodes(node_ids: Ids) -> dict[str, int]

Remove nodes, and the elements that use them.

An element that uses a deleted node is deleted too. Ids that are not present are ignored.

Parameters:

Name Type Description Default
node_ids int or sequence of int

The identifiers, one or many.

required

Returns:

Type Description
dict of str to int

'nodes' and 'elements', the number of each removed.

coincident_nodes
coincident_nodes(tolerance: float, nodes: Ids | None = None) -> dict[int, int]

{node: the node it coincides with} for every node within tolerance of another.

Each node is mapped to the lowest id in its group, which is the node a merge keeps. Groups are chained: if a is within tolerance of b and b of c, all three are one point.

Parameters:

Name Type Description Default
tolerance float

How close two nodes must be to be one point, in the stored length unit: meters once units are defined.

required
nodes sequence of int

Only these nodes are considered, by id; a node outside them is not merged and nothing is merged into it, however close. Every node when omitted.

None

Returns:

Type Description
dict of int to int

Only the nodes that would be removed, each mapped to the node it becomes.

duplicate_elements
duplicate_elements(groups: Ids | None = None) -> dict[int, int]

{element id: the element it duplicates} for every solid element of the same type and on the same nodes as an earlier element, such as two bricks filling one cell.

The earlier element (in element order) is the one that stays. Only solids are checked: two beams on one line can be two members, and a plate on another plate's nodes is how a doubler or a layer is modeled, but two solids are never meant to fill one cell. Two element groups that overlap and share their nodes in the overlap (the bars of an X cross-section) put two elements in every cell there, which doubles the stiffness and mass of the region.

Parameters:

Name Type Description Default
groups sequence of int

Only the elements of these element groups, by id; every element when omitted.

None

Returns:

Type Description
dict of int to int

Each element that fills a cell another element already fills, mapped to that element.

merge_duplicate_elements
merge_duplicate_elements(groups: Ids | None = None) -> int

Remove duplicate solid elements (duplicate_elements).

The later element of each pair is removed, and the earlier one stays in its element group.

Parameters:

Name Type Description Default
groups sequence of int

Only the elements of these element groups, by id; every element when omitted.

None

Returns:

Type Description
int

How many elements were removed.

node_spacing
node_spacing(groups: Ids | None = None) -> float | None

The mesh's finest spacing: the shortest nonzero distance between two nodes of one element, such as a brick's shortest edge or half an edge of a quad8.

Merge Coincident Nodes sets its default tolerance to a quarter of this value. Nodes of parts meshed separately are usually much closer than that where the parts meet, and no two nodes of one element are.

Parameters:

Name Type Description Default
groups sequence of int

Only these element groups' elements, by id; every element when omitted.

None

Returns:

Type Description
float or None

The spacing, in the stored length unit; None when no element has two nodes at different positions.

coincident_spots
coincident_spots(tolerance: float, groups: Ids | None = None, exclude: Ids | None = None) -> list[list[int]]

The places where a merge would make one node.

Each place is a list of the node ids that coincide there, in ascending order, so the first is the node that stays. Merge Coincident Nodes marks these places in the view before anything is merged, so some of them can be left out.

Parameters:

Name Type Description Default
tolerance float

How close two nodes must be to be one, in the stored length unit: meters once units are defined.

required
groups sequence of int

Only the nodes used by these element groups' elements, by id; every node when omitted.

None
exclude sequence of int

Nodes left out, by id: they are not merged and nothing is merged into them.

None

Returns:

Type Description
list of list of int

One list per place, sorted by the node each keeps.

merge_folds
merge_folds(tolerance: float, groups: Ids | None = None, exclude: Ids | None = None) -> str | None

Why this merge would be refused, or None.

Returns the message merge_coincident_nodes raises when the tolerance would fold an element onto itself, so a panel can show it before the merge is applied.

Parameters:

Name Type Description Default
tolerance float

As merge_coincident_nodes.

required
groups sequence of int

As merge_coincident_nodes.

None
exclude sequence of int

As merge_coincident_nodes.

None

Returns:

Type Description
str or None
merge_collapses
merge_collapses(tolerance: float, groups: Ids | None = None, exclude: Ids | None = None) -> list[int]

The ids of the line elements this merge would remove.

These are the line elements (a rigid link, a spring, a beam) whose nodes would all become one node, so they no longer join anything. Merging a joint built with rigid links removes the links.

Parameters:

Name Type Description Default
tolerance float

As merge_coincident_nodes.

required
groups sequence of int

As merge_coincident_nodes.

None
exclude sequence of int

As merge_coincident_nodes.

None

Returns:

Type Description
list of int
merge_coincident_nodes
merge_coincident_nodes(tolerance: float, groups: Ids | None = None, exclude: Ids | None = None) -> dict[str, int]

Merge nodes that are at one point into one node.

Nodes within tolerance of each other (coincident_nodes) become the one with the lowest id: every element that uses one of them is changed to use that node, and the others are removed. Plates are only connected where they share nodes, so this is what connects a model built from separate planes at its edges.

The merge is refused with ValueError, naming the element, when the tolerance would fold an element onto itself (two of its own nodes within the tolerance), since that means the tolerance is larger than the mesh. A line element whose nodes would all become one, such as a rigid link across the gap the merge closes, is removed instead (merge_collapses). Solid elements the merge leaves on exactly the same nodes fill one cell twice, and the duplicates are removed (merge_duplicate_elements).

With groups, only those element groups are merged: the nodes their elements use are the candidates, so two groups picked together are joined to each other and to nothing else, and only their duplicate elements are removed. A merge over the whole geometry joins every part to every part it touches, which is usually more than intended; the app offers the merge on element groups only.

Parameters:

Name Type Description Default
tolerance float

How close two nodes must be to be one, in the stored length unit: meters once units are defined.

required
groups sequence of int

The element groups whose nodes are merged, by id. Every node of the geometry when omitted.

None
exclude sequence of int

Nodes left out of the merge, by id: they are not merged and nothing is merged into them. In the app, these are the places that were unpicked (coincident_spots).

None

Returns:

Type Description
dict of str to int

'merged', the number of nodes removed; 'into', the number of nodes they became; 'duplicates', the number of elements removed for filling a cell another already filled; and 'links', the number of line elements removed because their nodes became one.

align_reach
align_reach(groups: Ids | None = None) -> float | None

The default reach of Align Meshes: half the mesh size of the coarsest piece.

A piece is a set of elements connected by shared nodes. With this reach no node moves more than half an element of its own mesh. Parts with a gap between them need a larger reach, by the size of the gap.

Parameters:

Name Type Description Default
groups sequence of int

The element groups, by id; every element when omitted.

None

Returns:

Type Description
float or None

In the stored length unit; None when no element has a nonzero size.

align_moves
align_moves(reach: float, groups: Ids | None = None, exclude: Ids | None = None) -> list[list[int]]

The moves Align Meshes would make, each [node, onto]: a node of a coarser piece and the node of a finer piece it would move onto, so the two are at one point and can be merged with Merge Coincident Nodes.

A piece is a set of elements connected by shared nodes. Two pieces meshed at different sizes cannot be matched node for node, since their node counts differ, but each node of the coarser piece can be moved onto the nearest node of the finer one. No node moves more than reach. The rules:

  • Only nodes on the outside of the pieces move or are moved onto.
  • A node moves once, and onto a node no other node moves onto.
  • A node already at another node's position is a place to merge, not a move.
  • The nearest pairs are taken first. As a result, a washer's lower face moves onto the frame under it, and its upper face, whose nearest frame nodes are already taken, stays.
  • Of two pieces with the same mesh size, the later piece moves.
  • A move that would turn an element inside out is left out.

Parameters:

Name Type Description Default
reach float

How far a node may move, in the stored length unit.

required
groups sequence of int

The element groups whose pieces are aligned, by id; every element when omitted.

None
exclude sequence of int

Nodes left out, by id: they are not moved and nothing is moved onto them. In the app, these are the moves that were unpicked.

None

Returns:

Type Description
list of [int, int]

Sorted by the node moved.

align_folds
align_folds(moves: Sequence[Sequence[int]]) -> str | None

Why these moves would be refused, or None.

Returns the message align_meshes raises when a move would turn an element inside out (a solid's corner volume or a plate's normal changing sign), so a panel can show it before the moves are applied.

Parameters:

Name Type Description Default
moves sequence of [int, int]

As align_moves gives them.

required

Returns:

Type Description
str or None
align_meshes
align_meshes(reach: float, groups: Ids | None = None, exclude: Ids | None = None) -> dict[str, float]

Move the nodes of the coarser piece onto the nodes of the finer piece where they meet (align_moves), so Merge Coincident Nodes can join them.

This is for parts meshed separately at sizes that do not match: it makes their nodes coincide at their mating faces or where they overlap. Nothing is merged and no node is removed. A move that would turn an element inside out is left out by align_moves; the call raises ValueError, naming the element, only when the nodes left out with exclude make one of the other moves do so (align_folds).

Parameters:

Name Type Description Default
reach float

How far a node may move, in the stored length unit: meters once units are defined.

required
groups sequence of int

The element groups whose pieces are aligned, by id; every element of the geometry when omitted.

None
exclude sequence of int

Nodes left out, by id: neither moved nor moved onto.

None

Returns:

Type Description
dict

'moved', how many nodes moved; 'farthest', the longest move, in the stored length unit.

delete_coordinate_systems
delete_coordinate_systems(cs_ids: Ids) -> dict[str, int]

Remove coordinate systems, and give the nodes that used them to the first remaining system. A node placed in a removed system keeps its coordinates, now in the remaining one, so it moves.

Ids that are not present are ignored. Removing every coordinate system is refused with ValueError, since every node needs one.

Parameters:

Name Type Description Default
cs_ids int or sequence of int

The identifiers, one or many.

required

Returns:

Type Description
dict of str to int

'coordinate_systems', the number removed, and 'nodes_reassigned', the number of node placement and displacement references moved to the remaining system.

delete_groups
delete_groups(group_ids: Ids, keep: Ids = ()) -> dict[str, int]

Remove element groups with their elements, their properties, and the nodes no element outside them uses.

A node that an element of another element group also uses stays, so a neighboring part is not cut along the nodes the two share. Ids that are not present are ignored. To combine element groups instead, use merge_groups.

Parameters:

Name Type Description Default
group_ids int or sequence of int

The identifiers, one or many.

required
keep sequence of int

Nodes that stay whatever uses them (delete_elements).

()

Returns:

Type Description
dict of str to int

'groups', 'elements' and 'nodes', the number of each removed.

merge_refusal
merge_refusal(group_ids: Ids) -> str | None

Why these element groups cannot be merged, or None when they can.

There must be at least two, all in the geometry, holding the same element types and with the same properties. A merged element group has one material and one thickness or section, so merging groups that differ would change the model without saying so.

Parameters:

Name Type Description Default
group_ids sequence of int

The element groups, by identifier.

required

Returns:

Type Description
str or None
merge_groups
merge_groups(group_ids: Ids) -> dict[str, int]

Merge several element groups into the first one (Merge Element Groups).

The elements of the others are moved into the first group, and the others are removed with their properties. Raises ValueError with the reason from merge_refusal when the groups cannot be merged.

Parameters:

Name Type Description Default
group_ids sequence of int

The element groups; the first keeps its id, name and properties.

required

Returns:

Type Description
dict of str to int

'into', the id of the element group kept; 'groups', how many were merged into it; 'elements', how many elements moved.

delete_elements
delete_elements(elem_ids: Ids, nodes: bool = False, keep: Ids = ()) -> dict[str, int]

Remove elements by id. Ids that are not present are ignored.

With nodes, the nodes used only by these elements are removed too, which is what deleting an element group (delete_groups) and deleting elements in the app do. A node another element uses stays, and so does a node in keep: the project keeps the nodes its data is measured or solved at (Project.delete_elements), so redrawing a test geometry's panels leaves its measurement points. nodes is off by default because the merge removes the links it collapses and then remaps their nodes.

Parameters:

Name Type Description Default
elem_ids int or sequence of int

The identifiers, one or many.

required
nodes bool

Also remove the nodes only these elements used.

False
keep sequence of int

Nodes never removed that way.

()

Returns:

Type Description
dict of str to int

'elements', the number removed, and with nodes, 'nodes', the number of nodes removed.

save
save(path: str | PathLike) -> None

Write the geometry to a file of its own.

Parameters:

Name Type Description Default
path str or PathLike

Where to write it.

required

Returns:

Type Description
None
load classmethod
load(path: str | PathLike) -> Geometry

Read a geometry written by save.

Raises TypeError when the file holds something other than a geometry.

Psd

Psd(*args: Any, bandwidth: ArrayLike | None = None, **kwargs: Any)

Bases: _Bands, DataArray

Power spectral density. The declared unit is the engineering unit whose square per hertz the values are in (declare 'g' for g²/Hz).

The class allows complex values because a cross spectrum is complex: the phase between two channels is most of what a CPSD is for. An autospectrum is a magnitude squared and real, so an object with no imaginary content (has_phase) stores a real array, half the size.

interpolation says how values are read between the lines: 'bin' (constant across each line's bin, drawn as steps) or 'log_log' (a power law between breakpoints). area, the plots and octave banding all follow it. scale_db is the decibels added to this spectrum when it is compared against a specification, and nowhere else; None means it is detected from the data.

Parameters:

Name Type Description Default
*args Any

As for DataArray.

()
**kwargs Any

As for DataArray.

()
bandwidth array - like

The width of each line's band, for lines that are not evenly spaced (octave bands). Omitted for a narrowband spectrum.

None

Methods:

Name Description
confidence_band

The chi-square confidence band on this averaged spectrum: two

confidence_reading

The chi-square band on each record, as the reading states it:

is_autospectrum

Whether a record is an autospectrum, a channel against itself:

confidence_refusal

Why this spectrum has no chi-square band, or None when it has

principal_shapes

The dominant shape of the cross-spectral matrix at each line, as

tone_refusal

Why a tone cannot be read off record record, or None when

can_read_tone

Whether a tone can be read off record record

read_tone

Read the tone near frequency off one record of this

rms_check

Check one record of this autospectrum against the time history

area

The area under one record, over a band or over all of it.

areas

area over several bands at once, in one pass over the lines.

written

Which lines hold a value: the finite ones, in one record, or in

extent

(low, high), in hertz, of the range this spectrum is written

as_specification

This PSD as a specification: the same values, records, units and

to_octave

This spectrum integrated onto proportional (octave) bands.

coherence

The ordinary coherence of every cross term this CPSD holds:

conditioning

The singular values and condition number of this cross-spectral

realizability

Whether this cross-spectral matrix is Hermitian and positive

made_realizable

A copy with the cross-spectral matrix repaired to the nearest

units_for

The (unit, reference unit) a unit system gives for a PSD

Methods:
confidence_band
confidence_band(level: float = 0.9, dof: float | ArrayLike | None = None) -> tuple[Psd, Psd]

The chi-square confidence band on this averaged spectrum: two PSDs, the band's lower and upper edges, in this spectrum's units.

Each record's edges are its values times the factors core.averaging.chi_square_factors gives at its degrees of freedom, so the band follows the spectrum line for line, and on log axes it is the spectrum moved down and up by a fixed number of decibels. The true spectrum lies inside it at the stated confidence, line by line.

Parameters:

Name Type Description Default
level float

The confidence, a fraction: 0.90 by default, 0.95 for the stricter band.

0.9
dof float or array - like

The statistical degrees of freedom, one number for every record or one per record. Defaults to statistical_dof.

None

Returns:

Type Description
tuple of (Psd, Psd)

The lower edge and the upper edge, each with this spectrum's records, units and lines.

Raises:

Type Description
ValueError

If the spectrum carries no degrees of freedom and none are given, if it holds cross terms (whose error is not chi-square), if it is a Specification (a target, not an average: confidence_refusal), or if a count or the level is out of range.

confidence_reading
confidence_reading(level: float = 0.9, dof: float | ArrayLike | None = None) -> list[ConfidenceBand]

The chi-square band on each record, as the reading states it: one core.averaging.ConfidenceBand per record, holding the confidence, the degrees of freedom it was worked out at, the two factors and their decibels (ConfidenceBand.describe puts them in words), and the edges in this spectrum's units.

The same band confidence_band returns as two PSDs, from the same counts by the same rule, so a number read here is the edge drawn on the plot.

Parameters:

Name Type Description Default
level float

The confidence, a fraction: 0.90 by default, 0.95 for the stricter band.

0.9
dof float or array - like

The statistical degrees of freedom, one number for every record or one per record. Defaults to statistical_dof.

None

Returns:

Type Description
list of ConfidenceBand

One per record, in record order.

Raises:

Type Description
ValueError

As confidence_band raises: no degrees of freedom known or given, a cross term among the records, a specification, or a count or the level out of range.

is_autospectrum
is_autospectrum(record: int | None = None) -> bool

Whether a record is an autospectrum, a channel against itself: one DOF and one quantity on both sides. Only such a record has a chi-square band (confidence_band), a tone to read (tone_refusal) or a chance of reading outside a band (core.chance).

Parameters:

Name Type Description Default
record int

Which record; every record must be one when omitted.

None

Returns:

Type Description
bool
confidence_refusal
confidence_refusal() -> str | None

Why this spectrum has no chi-square band, or None when it has one: confidence_band and confidence_reading raise this as their ValueError, and the application offers the band only where it is None.

Two things are refused, whatever count is given. A cross term, whose magnitude has a different error law, so a band drawn on it as if chi-square would be a claim nobody computed. And a Specification, which is a target and not an average, even the spectrum of a transient specification, which is averaged from a waveform and carries the count of that averaging: the band says where the true spectrum of a measurement lies, and a requirement has no true spectrum other than itself. A missing count is not refused here, since it can be given (confidence_band's dof).

Returns:

Type Description
str or None

The reason, in words, or None.

principal_shapes
principal_shapes(quantity: str | None = None) -> tuple[list[str], ndarray, str]

The dominant shape of the cross-spectral matrix at each line, as (dofs, shapes (channels x lines), quantity).

The channels of one quantity form a square Hermitian matrix at each line. The eigenvector of its largest eigenvalue, scaled by the square root of that eigenvalue, is the principal operating deflection shape: each channel's phase relative to the others, with no reference to choose. quantity picks the channels (the most common quantity when omitted). A set with no cross records is refused, since an autospectrum set has no phase (its display is the envelope), and so is a matrix with missing terms.

Two matrices have no principal shape and are refused too. When every cross term is zero the channels share no phase, and the largest eigenvector is the loudest channel alone (or, with every level equal, whichever channel the eigensolver returns). When the largest eigenvalue is repeated at a line, any mix of its eigenvectors is as dominant as any other.

Parameters:

Name Type Description Default
quantity str

Which quantity, for a mixed object.

None

Returns:

Type Description
tuple of (list of str, numpy.ndarray, str)

The DOF labels, the dominant shape at each line, and the quantity they are in.

Raises:

Type Description
ValueError

If there are no cross records, no record names a quantity, fewer than two channels have the quantity, the matrix is incomplete, every cross term is zero, or the largest eigenvalue is repeated at a line.

tone_refusal
tone_refusal(record: int = 0) -> str | None

Why a tone cannot be read off record record, or None when it can: read_tone raises this as its ValueError, and the application offers the reading only where it is None.

A tone is read off an autospectrum (a record whose response and reference are one channel, with no phase) on evenly spaced lines; an octave-band spectrum, one written at breakpoints and a cross spectrum are refused.

Parameters:

Name Type Description Default
record int

Which record.

0

Returns:

Type Description
str or None

The reason, in words, or None.

can_read_tone
can_read_tone(record: int = 0) -> bool

Whether a tone can be read off record record (tone_refusal says why not).

Parameters:

Name Type Description Default
record int

Which record.

0

Returns:

Type Description
bool
read_tone
read_tone(frequency: float, record: int = 0, *, window: Any = 'hann', parameter: float | None = None, snap: bool = True, warn: bool = True) -> ToneReading

Read the tone near frequency off one record of this autospectrum, as an amplitude beside the spike it stands at.

The lines the tone leaks into, less the floor beside them, times the line spacing, are its mean square whatever the spacing and window; core.tone_readout.read_tone does the reading and says how, and hertzforge.drawing.plot.plot_tone_readout draws it.

Parameters:

Name Type Description Default
frequency float

A frequency at or near the tone, in Hz.

required
record int

Which record.

0
window str or Averaging

The window this spectrum was averaged with, or the Averaging itself; a project gives the one a computed PSD was made with as Project.averaging_of.

'hann'
parameter float

The Tukey window's alpha or the Kaiser window's beta, when window is a name; an Averaging carries its own.

None
snap bool

Find the tone's own spike near frequency; False reads the lines at frequency exactly, as a tone table states it.

True
warn bool

Warn a tone between lines, an uneven floor or no tone as a ToneWarning; the notes are on the reading either way.

True

Returns:

Type Description
ToneReading

The tone's amplitude in the square root of this spectrum's units (SI, as the spectrum is stored), the spike, the floor and the notes, whose densities are in SI too (ToneReading.notes_in writes them in others).

Raises:

Type Description
ValueError

For a record tone_refusal refuses: a spectrum on uneven lines (octave bands) or written at breakpoints, which has no line spacing to undo, or a cross spectrum.

rms_check
rms_check(history: TimeHistory, record: int = 0, *, averaging: Averaging | None = None, threshold_db: float | None = None) -> RmsCheck

Check one record of this autospectrum against the time history it came from: the rms from the area under it beside the record's own rms, and the gap between them in dB.

The area under a density is the mean square of its record, so a correctly scaled spectrum gives back the record's rms; core.rms_check.check_record does the check and says how, and hertzforge.drawing.plot.plot_rms_check draws it.

Parameters:

Name Type Description Default
history TimeHistory

The record this spectrum was computed from; the channel with this record's DOF and quantity is the one read, every capture of it pooled.

required
record int

Which record of this spectrum.

0
averaging Averaging

How the spectrum was averaged, which sets the span the record's rms is read over and the frames' own mean square; history's own when omitted. A project gives a computed spectrum's as Project.averaging_of.

None
threshold_db float

The gap, in dB either way, beyond which the two disagree; core.rms_check.GAP_DB when omitted.

None

Returns:

Type Description
RmsCheck

Both rms in the record's unit (SI, as stored), the gap, the frames' own rms when the averaging is known, and the verdict.

Raises:

Type Description
ValueError

For a banded spectrum, one written at breakpoints or a cross spectrum, when history holds no such channel, or when the frames do not fit in it.

area
area(record: int = 0, low: float | None = None, high: float | None = None) -> float

The area under one record, over a band or over all of it.

The record is integrated the way it is drawn, as set by interpolation: the sum of value times bin width for 'bin', the exact power-law area for 'log_log'. The area is in the ordinate's units times hertz, so for a PSD its square root is the RMS.

Parameters:

Name Type Description Default
record int

Which record.

0
low float

The band to integrate over.

None
high float

The band to integrate over.

None

Returns:

Type Description
float

The area under the curve (the mean square, whose root is the RMS); NaN when no line is written.

areas
areas(record: int, lows: ArrayLike, highs: ArrayLike) -> ndarray

area over several bands at once, in one pass over the lines.

Parameters:

Name Type Description Default
record int

Which record.

required
lows array - like

The bands' edges, paired.

required
highs array - like

The bands' edges, paired.

required

Returns:

Type Description
ndarray

One area per band; 0 for a band outside the written lines (for a breakpoint curve with fewer than two usable points, NaN).

written
written(record: int | None = None) -> ndarray

Which lines hold a value: the finite ones, in one record, or in any record when none is named. (Specification.written also requires a positive value.)

Parameters:

Name Type Description Default
record int

The record; every record when omitted.

None

Returns:

Type Description
ndarray

A boolean per line.

extent
extent(record: int | None = None) -> tuple[float, float] | None

(low, high), in hertz, of the range this spectrum is written over.

For a density per bin, the outer edges of the written bins, since a line covers its whole bin. For a curve between breakpoints, the outer ends of its compliance.coverage. Octave banding and comparisons use this range, because a controller's target is stored on every FFT line to Nyquist but is only written over part of them.

Parameters:

Name Type Description Default
record int

The record; the union over every record when omitted.

None

Returns:

Type Description
tuple of float, or None

None when nothing is written above zero hertz.

as_specification
as_specification() -> Specification

This PSD as a specification: the same values, records, units and bands, as the requirement a measurement is judged against, with no limits.

Some formats have no way to mark a PSD as a requirement (ESCDF's data types do not), so a target written by another program arrives as a PSD, and the user marks it with this. A banded PSD is read per bin, as a banded specification is; otherwise its frequencies decide whether it is read as a controller's lines or as breakpoints (Specification.reading_of). Any scale_db is dropped, since a requirement is not scaled for comparison.

Returns:

Type Description
Specification

A copy; this PSD is unchanged.

to_octave
to_octave(per_octave: int | None = None, low: float | None = None, high: float | None = None) -> Psd

This spectrum integrated onto proportional (octave) bands.

Each band takes the mean-square content that falls in it, divided by its own width, so the area under the spectrum, and so the RMS, is unchanged. Reading the narrowband curve at each band center would lose everything between the centers.

The band grid is fixed (see hertzforge.core.octave): the frequency range only chooses which bands of that grid are returned, so two runs banded the same way are on the same bands whatever their ranges. Bands are whole, so a band the data only partly covers holds that content averaged over its whole width. Cross terms stay complex, so a CPSD can be banded as well as a PSD. scale_db is kept.

Parameters:

Name Type Description Default
per_octave int

Bands per octave; octave.PER_OCTAVE when omitted.

None
low float

The frequency range to cover, in hertz. By default, the range the written bins cover (extent).

None
high float

The frequency range to cover, in hertz. By default, the range the written bins cover (extent).

None

Returns:

Type Description
Psd

The same power on proportional bands, with bandwidth set.

Raises:

Type Description
ValueError

If the spectrum has fewer than two lines above zero hertz.

coherence
coherence() -> Coherence

The ordinary coherence of every cross term this CPSD holds: |S_pq|² / (S_pp S_qq), from the cross spectrum and the two autospectra.

For an octave-banded CPSD the result is the banded quantity (each band's averaged cross spectrum against its averaged autospectra), and it keeps the bands, so it is drawn flat across each band as the CPSD is. That is not the average of a narrowband coherence over the band, which would weight a band's lines equally whatever their power. Values are limited to 0 to 1. A cross term without both of its autospectra is left out.

Returns:

Type Description
Coherence

One record per cross term, response against reference.

Raises:

Type Description
ValueError

If the object has no reference DOFs, or no cross term has both its autospectra.

conditioning
conditioning(records: Sequence[int] | None = None, *, limit: float | None = None, progress: Callable[[int, int], None] | None = None) -> Conditioning

The singular values and condition number of this cross-spectral matrix at every line (core.matrix_checks.read_conditioning).

Read of the drives' CSD, Gff, it says where the drives are nearly copies of one another, so that an FRF estimated from them inverts a matrix that is nearly singular.

Parameters:

Name Type Description Default
records sequence of int

The records that make the matrix; all of them when omitted. The channels must be of one quantity.

None
limit float

The condition number lines are flagged over; core.matrix_checks.CONDITION_LIMIT when omitted.

None
progress callable

Told (0, core.progress.BUSY) before the decomposition; the app's progress bar uses it.

None

Returns:

Type Description
Conditioning

The singular values at every line, with the condition number, the effective rank and the flagged bands.

Raises:

Type Description
ValueError

For an empty selection, no cross terms, channels of different quantities, or an incomplete matrix.

realizability
realizability(records: Sequence[int] | None = None, *, tolerance: float | None = None, keep_diagonal: bool = True, progress: Callable[[int, int], None] | None = None) -> Realizability

Whether this cross-spectral matrix is Hermitian and positive semi-definite at every line, so that some set of signals has it, and the nearest matrix that is (core.matrix_checks.read_realizability).

A specification that is not cannot be played: no drive gives the control channels those coherences and phases together.

Parameters:

Name Type Description Default
records sequence of int

The records that make the matrix; all of them when omitted.

None
tolerance float

How far below zero the smallest eigenvalue of the coherence matrix may lie, as a fraction of the largest; core.matrix_checks.REALIZABLE_TOLERANCE when omitted.

None
keep_diagonal bool

Whether the repair holds the autospectra where they are.

True
progress callable

Told (done, total) as the repair goes on; what it raises stops it. The app's progress bar uses it.

None

Returns:

Type Description
Realizability

The eigenvalues at every line, the verdict, the failing bands, and the repaired matrix.

Raises:

Type Description
ValueError

For an empty selection, no cross terms, records some declared in units and some not, one channel, or an incomplete matrix.

made_realizable
made_realizable(records: Sequence[int] | None = None, *, tolerance: float | None = None, keep_diagonal: bool = True, progress: Callable[[int, int], None] | None = None) -> Psd

A copy with the cross-spectral matrix repaired to the nearest realizable one at every line that is not (core.matrix_checks.made_realizable); the lines that are, and every record's place and units, are unchanged.

Parameters:

Name Type Description Default
records sequence of int

The records that make the matrix; all of them when omitted.

None
tolerance float

As for realizability.

None
keep_diagonal bool

Hold the autospectra where they are and move only the cross terms. Without it a specification's limits follow each autospectrum that moved.

True
progress callable

As for realizability.

None

Returns:

Type Description
Psd

The repaired copy, of this object's class. realizability on this object says what moved.

units_for classmethod
units_for(dimension: str, system: UnitSystem = SI) -> tuple[str, str | None]

The (unit, reference unit) a unit system gives for a PSD dimension: 'acceleration2/frequency' in SI is ('m/s2', None), and a cross term's 'acceleration*force/frequency' is ('m/s**2', 'N'). See DataArray.units_for.

Parameters:

Name Type Description Default
dimension str

An ordinate_dim, such as 'acceleration**2/frequency'.

required
system UnitSystem

The unit system; SI when omitted.

SI

Returns:

Type Description
tuple of (str, str or None)

The engineering unit and, for a cross term with two quantities, the second unit.

ShapeSet

ShapeSet(frequency: ArrayLike, damping: ArrayLike, coordinate: Sequence[str], shape_matrix: ArrayLike, modal_mass: ArrayLike | None = None, comment: str | Sequence[str] | None = None, mass_unit: str | None = None, description: Sequence[str] | None = None, unscaled: bool = False, modal_damping: ArrayLike | None = None, reference_only: Sequence[str] | None = None)

Mode shapes over a shared set of DOFs.

shape_matrix is (modes, dofs). coordinate lists the DOF strings that the columns correspond to ('101X+'). The modes are always stored in ascending frequency, so rigid-body modes come first.

A fitted set is also the record of the fit: reopening one in the app (Edit Fit) restores the fitting session that produced it, which is why the descriptions and the scaling flag are stored with the numbers.

Attributes: frequency: Hz per mode. A rigid-body mode is exactly 0.0, because the FRF synthesis tests for exactly 0.0 to handle its 0/0; a very small frequency is not treated the same way. damping: Fraction of critical per mode, so 2% is 0.02. coordinate: The DOF string of each column of shape_matrix. shape_matrix: (modes, dofs). Complex for complex modes; the overlay and the MAC handle either. modal_mass: Per mode. 1.0 for every mode of a mass-normalized set, which is what an eigensolution here produces. For complex shapes it is modal A, the first-order scaling, and synthesize_frf uses it that way. It is complex when an imported file had it complex; the values are kept as read and never converted to real. modal_damping: Complex modal damping per mode where a file had one (I-DEAS ADFs do), or None. It is different from damping, the viscous fraction of critical: it is the complex-mode estimate as the identification software reported it. mass_unit: The mass unit the shapes were normalized against, or None when it has not been declared. description: Free text per mode describing the shape, for example 'first torsion'. comment: One line per mode; a single string given to the constructor is used for every mode. unscaled: True when the fit had no drive point to set the mass-normalized scale. Shapes and MACs are not affected, but the modal masses are only a convention, and comparisons do not report a scale factor from them. reference_only: The DOFs a fit measured only as references, in the order of coordinate. Their values come from the references' participation: a residue is the product of a response's value and a reference's, so without a drive point to measure the split, the two parts of a shape are each on a scale of their own. The values are kept, since the synthesis and Edit Fit need them, and cross_mac leaves these DOFs out of an unscaled set.

Methods:

Name Description
set_description

Write free text against one mode, as the mode table's

auto_mac

The MAC of every mode against every other mode; the diagonal is 1.

covers

Whether the shape set has a coefficient at this DOF.

synthesize_frf

FRFs from the modal model, one row per DOF pair.

modal_frf

Each real mode's own frequency response, one row per mode:

delete_modes

Remove the given modes in place.

kept

A copy holding only modes, in the set's order and once each;

define_units

Declare the mass unit the shapes were normalized against.

undefine_units

Remove the mass unit and restore the original coefficients; returns self.

display_shapes

The coefficients in the display system's 1/sqrt(mass).

unit_label

The unit label of the coefficients, such as '1/√kg'.

mode_label

A short label for one mode, such as 'Mode 3 — 12.4 Hz, 2% damping'.

save

Write the shape set to a file of its own.

Attributes:

Name Type Description
num_shapes int

How many mode shapes the set holds.

num_dofs int

How many degrees of freedom each shape covers.

is_complex bool

Whether these are complex modes.

units_defined bool

Whether a mass unit has been declared. Without one, a modal

Attributes
num_shapes property
num_shapes: int

How many mode shapes the set holds.

num_dofs property
num_dofs: int

How many degrees of freedom each shape covers.

is_complex property
is_complex: bool

Whether these are complex modes.

Real normal modes move every DOF in or out of phase; complex modes do not, which is the result of non-proportional damping. A set is complex when its shape matrix has a complex dtype.

units_defined property
units_defined: bool

Whether a mass unit has been declared. Without one, a modal mass is a number with no unit.

Methods:
set_description
set_description(mode: int, text: str) -> None

Write free text against one mode, as the mode table's Description column takes it.

Parameters:

Name Type Description Default
mode int

The mode, from 0.

required
text str

The description; stripped, and blank clears it.

required

Returns:

Type Description
None
auto_mac
auto_mac() -> ndarray

The MAC of every mode against every other mode; the diagonal is 1.

covers
covers(dof: str) -> bool

Whether the shape set has a coefficient at this DOF.

The sign is ignored, so '101Z-' is covered when '101Z+' is.

Parameters:

Name Type Description Default
dof str

A degree of freedom, such as '101Z+'.

required

Returns:

Type Description
bool

Whether the shapes include it.

synthesize_frf
synthesize_frf(frequencies: ArrayLike, response_dof: Sequence[str], reference_dof: Sequence[str], modes: Sequence[int] | None = None, power: int = 0) -> ndarray

FRFs from the modal model, one row per DOF pair.

For real shapes, the second-order residue form

H_jk(f) = sum_r (iw)^power phi_jr phi_kr
                / (m_r (w_r^2 - w^2 + 2i z_r w_r w))

with w = 2pif. It is exact for mass-normalized shapes, and modal_mass holds any other scaling. For complex shapes, the first-order form, with a pole and its conjugate:

H_jk(f) = sum_r (iw)^power [ psi_jr psi_kr / (A_r (iw - l_r))
              + conj(psi_jr psi_kr / A_r) / (iw - conj(l_r)) ]

with the pole l_r = -z_r w_r + i w_r sqrt(1 - z_r^2) and modal_mass used as modal A, the scaling of a complex mode (1.0 when a set has none). The two forms give the same FRF for a real mode whose modal A is 2i w_d m_r, where w_d is the damped natural frequency.

The form is selected by the shapes alone: complex shapes use the first-order form and real shapes the second-order form. The second-order form cannot represent a complex mode, because it gives the conjugate pole the residue -R where the structure has conj(R), whatever modal_mass is set to. Modal A is conjugated in the second term, which only matters when modal A is complex.

power selects the response quantity: 0 displacement per force, 1 velocity, 2 acceleration. It is applied inside the sum because a real rigid-body mode's denominator is exactly -w^2: at w = 0 its accelerance reduces to the finite residue, while multiplying afterward would give 0/0. Its displacement and velocity at w = 0 are unbounded and are returned as nan.

Both forms are checked to rounding error against the direct inverse of the dynamic stiffness (proportionally damped for real shapes, non-proportionally damped for complex ones) and against the output of sdynpy's synthesis saved as test data (tests/test_frf_synthesis_exact.py, tests/test_modal_frf_oracle.py).

modes limits the sum to some modes; a synthesis from a subset of modes plotted beside the measurement shows which modes the measurement contains. Raises ValueError for a DOF the shapes do not cover, which covers can check in advance.

Parameters:

Name Type Description Default
frequencies array_like

The lines to synthesize at, in Hz.

required
response_dof sequence of str

The response degrees of freedom.

required
reference_dof sequence of str

The drive degrees of freedom.

required
modes sequence of int

Which modes to include. All of them when omitted.

None
power int

0 receptance, 1 mobility, 2 accelerance.

0

Returns:

Type Description
ndarray

The synthesized FRFs, one row per response and drive pair.

References
  1. Ewins, D. J. (2000). Modal Testing: Theory, Practice and Application, 2nd ed. Research Studies Press. The residue form for real modes, and why non-proportional damping makes the modes complex.
  2. Maia, N. M. M., & Silva, J. M. M. (1997). Theoretical and Experimental Modal Analysis. Research Studies Press. The first-order (state-space) form, its conjugate pole pairs, and modal A as the scaling that goes with them.
modal_frf
modal_frf(frequencies: ArrayLike, modes: Sequence[int] | None = None, power: int = 0) -> ndarray

Each real mode's own frequency response, one row per mode:

H_r(f) = (iw)^power / (m_r (w_r^2 - w^2 + 2i z_r w_r w))

with w = 2pif. It is the modal coordinate's response to a unit modal force, and the term synthesize_frf sums over the modes, so a physical FRF is phi_jr phi_kr H_r summed over r. power goes inside, as there: a rigid mode's accelerance at 0 Hz is 1/m_r, and its displacement and velocity there are nan.

Parameters:

Name Type Description Default
frequencies array_like

The lines, in Hz.

required
modes sequence of int

Which modes, by index from zero, in increasing order; all of them when omitted.

None
power int

0 displacement, 1 velocity, 2 acceleration per modal force.

0

Returns:

Type Description
ndarray

(modes, lines), complex.

Raises:

Type Description
ValueError

If the set is complex: a complex mode has no second-order modal coordinate.

delete_modes
delete_modes(indices: Sequence[int]) -> None

Remove the given modes in place.

Raises IndexError for an index out of range, and ValueError if every mode would be removed (delete the object instead).

Parameters:

Name Type Description Default
indices sequence of int

Which modes to remove, by zero-based index.

required

Returns:

Type Description
None
kept
kept(modes: Sequence[int] | None) -> ShapeSet

A copy holding only modes, in the set's order and once each; the set itself when modes is None. The modes picked in the tree are what an action reads.

Parameters:

Name Type Description Default
modes sequence of int or None

Which modes to keep, by zero-based index.

required

Returns:

Type Description
ShapeSet

The copy, or the set itself for None.

Raises:

Type Description
ValueError

For a mode the set does not have, or an empty modes (picked_modes).

define_units
define_units(mass_unit: str) -> ShapeSet

Declare the mass unit the shapes were normalized against.

The coefficients are converted to SI, 1/sqrt(kg). Declaring again reinterprets the original values instead of scaling twice, so a wrong unit can be corrected.

Parameters:

Name Type Description Default
mass_unit str

The mass unit of the mass matrix the shapes were normalized against, such as 'kg'.

required

Returns:

Type Description
ShapeSet

Self, converted to SI in place.

undefine_units
undefine_units() -> ShapeSet

Remove the mass unit and restore the original coefficients; returns self.

display_shapes
display_shapes(unit_system: UnitSystem) -> ndarray

The coefficients in the display system's 1/sqrt(mass).

A set without a declared mass unit is returned unchanged.

Parameters:

Name Type Description Default
unit_system UnitSystem

The units to present in.

required

Returns:

Type Description
ndarray

The shape matrix in display units.

unit_label
unit_label(unit_system: UnitSystem | None = None) -> str

The unit label of the coefficients, such as '1/√kg'.

Parameters:

Name Type Description Default
unit_system UnitSystem

The units to label in. The declared mass unit when omitted.

None

Returns:

Type Description
str

The label, or '' when no mass unit has been declared.

mode_label
mode_label(i: int) -> str

A short label for one mode, such as 'Mode 3 — 12.4 Hz, 2% damping'.

Parameters:

Name Type Description Default
i int

Which mode, by zero-based index.

required

Returns:

Type Description
str

A short label: its frequency, and its damping when known.

save
save(path: str | PathLike) -> None

Write the shape set to a file of its own.

Parameters:

Name Type Description Default
path str or PathLike

Where to write it.

required

Returns:

Type Description
None

ShockSpecification

ShockSpecification(*args: Any, warning_lower: ArrayLike | None = None, warning_upper: ArrayLike | None = None, abort_lower: ArrayLike | None = None, abort_upper: ArrayLike | None = None, **kwargs: Any)

Bases: Bounded, Srs

What a shock test was controlled to: an SRS and its limits.

It is to Srs what Specification is to Psd. A shock target is written as a required SRS with a tolerance on each side, usually +6 dB and -3 dB (a factor of 2 up and 0.707 down), and the limits are those curves.

A target is written at one Q and read at that Q: a target at Q = 10 says nothing about what the same shock does to a Q = 50 oscillator, so the Q is stored with the target as it is with a measurement.

Methods:

Name Description
from_breakpoints

A requirement written as breakpoints, read onto the points of

Methods:
from_breakpoints classmethod
from_breakpoints(frequencies: ArrayLike, levels: ArrayLike, response_dof: str | Sequence[str], *, per_octave: int | None = None, q: float | None = None, kind: str = 'maximax', ordinate_dim: str = 'acceleration', ordinate_unit: str | None = None, warning: tuple[float, float] | None = None, abort: tuple[float, float] | None = None) -> ShockSpecification

A requirement written as breakpoints, read onto the points of its spacing, with its bands as limits.

spec = ShockSpecification.from_breakpoints(
    [10.0, 100.0, 2000.0], [10.0, 100.0, 100.0], '101Z+',
    ordinate_unit='g', warning=(-1.5, 3.0), abort=(-3.0, 6.0))

A shock requirement is usually written as a few breakpoints joined by straight lines on log axes (a rising slope in dB per octave, a knee and a plateau), with its Q, its spacing and its type stated beside it. The points are the spacing's, from the first breakpoint up, per_octave to an octave, the last one at or below the last breakpoint, so every point lies on the curve the breakpoints draw (compliance.log_interpolate). That spacing is the one a tolerance is counted at, so a measured spectrum computed at the same per_octave from the same lowest frequency lands on the requirement's points. Its last point can fall past the last breakpoint, where nothing is required, and is not judged.

Each band, given as dB below and above the requirement, becomes a pair of limit curves: warning the warning limits and abort the abort limits. A tolerance written as an inner and an outer band is the two of them, inner as the warning, outer as abort.

Parameters:

Name Type Description Default
frequencies array - like

The breakpoints' frequencies in Hz, increasing.

required
levels array - like

The level at each breakpoint, one row per channel, in ordinate_unit. A single row (which may be one-dimensional) is the requirement at every channel named.

required
response_dof str or sequence of str

The DOF each row is required at.

required
per_octave int

Points to an octave; srs.PER_OCTAVE when omitted.

None
q float

The amplification the requirement is written at; srs.DEFAULT_Q when omitted.

None
kind str

The spectrum's type: 'maximax', 'positive' or 'negative'.

'maximax'
ordinate_dim str

The quantity the levels are of.

'acceleration'
ordinate_unit str

The unit the levels are written in; SI when omitted.

None
warning (float, float)

A band in dB below and above the requirement, kept as that pair of limits.

None
abort (float, float)

A band in dB below and above the requirement, kept as that pair of limits.

None

Returns:

Type Description
ShockSpecification

The requirement on its points, with the limits given.

Raises:

Type Description
ValueError

For fewer than two breakpoints, frequencies that are not positive and increasing, levels that are not positive, a number of level rows other than one or one per DOF, a spacing that is not a whole number of points to the octave, or a band whose lower edge is not below its upper.

Specification

Specification(*args: Any, warning_lower: ArrayLike | None = None, warning_upper: ArrayLike | None = None, abort_lower: ArrayLike | None = None, abort_upper: ArrayLike | None = None, **kwargs: Any)

Bases: Bounded, Psd

What a random vibration test was controlled to: a PSD and its limits.

A specification is a PSD in every respect (the same abscissa, quantity and unit conversions) with the four limit curves of Bounded, and it inherits from both. By default its points are read as breakpoints of a power law (interpolation 'log_log'); one computed from a record, or a target on a controller's lines, is read per bin.

Methods:

Name Description
reading_of

How a specification written at these frequencies is read.

written

Which lines the requirement is written on: finite and positive,

as_psd

This specification as a plain PSD; the inverse of

to_octave

This specification integrated onto proportional bands, with its

Methods:
reading_of staticmethod
reading_of(frequencies: ArrayLike) -> str

How a specification written at these frequencies is read.

'bin', a density per line, for LINES_AT_LEAST or more lines on an even grid (a controller's target on its FFT lines), and 'log_log', breakpoints of a power law, otherwise. Octave-band and narrowband specifications are drawn as steps; only a breakpoint curve is drawn as the power law between its points.

Parameters:

Name Type Description Default
frequencies array_like

The specification's frequency lines, ascending.

required

Returns:

Type Description
str

'bin' or 'log_log'.

written
written(record: int | None = None) -> ndarray

Which lines the requirement is written on: finite and positive, in one record, or in any record when none is named. A controller writes zero on the lines it did not control, and those lines are not a requirement of zero.

Parameters:

Name Type Description Default
record int

The record; every record when omitted.

None

Returns:

Type Description
ndarray

A boolean per line.

as_psd
as_psd(drop_limits: bool = False) -> Psd

This specification as a plain PSD; the inverse of Psd.as_specification, for a PSD marked as a requirement by mistake or a target to be driven as a CPSD. Its interpolation is kept.

Parameters:

Name Type Description Default
drop_limits bool

Leave out the warning and abort limits, which a PSD cannot hold. Without it a specification with limits is refused.

False

Returns:

Type Description
Psd

A copy; this specification is unchanged.

Raises:

Type Description
ValueError

If it has limits and drop_limits is not given: dropping them without being asked would lose what the file said. limit(name) returns one as a PSD of its own.

to_octave
to_octave(per_octave: int | None = None, low: float | None = None, high: float | None = None) -> Specification

This specification integrated onto proportional bands, with its warning and abort limits.

The same area rule as Psd.to_octave, applied the way the object is read. A specification on lines is a density, and each line is a bin. One written at breakpoints is a power law between them, and each band takes the exact area under that law (compliance.log_log_area) over the part of the band the specification covers, divided by the band's width. The limits go through the same rule, so a band's warning line has the same relation to its target as at the breakpoints, and a point that is not written is a gap in both. Cross terms of a breakpoint specification are not power laws (the phase is not, and a zero is a value), so they are read onto a fine log grid as compliance.record_at reads them and integrated there.

The result is a density per band (interpolation 'bin', with the bands' widths), which a banded measurement is compared against band by band. scale_db and any band constraints are kept.

Parameters:

Name Type Description Default
per_octave int

Bands per octave.

None
low float

The band to cover.

None
high float

The band to cover.

None

Returns:

Type Description
Specification

The same power and the same limits on proportional bands.

Raises:

Type Description
ValueError

If the specification is not written over a range of frequencies above zero.

Spectrum

Spectrum(abscissa: ArrayLike, ordinate: ArrayLike, response_dof: str | Sequence[str], reference_dof: str | Sequence[str] | None = None, ordinate_dim: str | Sequence[str] | None = None, comment: str | Sequence[str] | None = None, ordinate_unit: str | Sequence[str | None] | None = None, reference_unit: str | Sequence[str | None] | None = None, dimension_hint: str | Sequence[str | None] | None = None, block: str | Sequence[str] | None = None)

Bases: DataArray

A linear spectrum: amplitude and phase at each frequency line.

It is the complex average of a record's frames, not a power average, so content whose phase is random from frame to frame averages toward zero. That makes it suited to a deterministic signal and not to burst random. A Psd is the power average and does not have that property.

Methods:

Name Description
half_power

Read Q from the half-power width of the peak nearest near

Methods:
half_power
half_power(near: float, record: int = 0, *, within: tuple[float, float] | None = None, warn: bool = True) -> HalfPower

Read Q from the half-power width of the peak nearest near on one record's magnitude.

core.half_power.read_half_power does the reading and says how; hertzforge.drawing.plot.plot_half_power draws it on the record.

Parameters:

Name Type Description Default
near float

A frequency on the peak to read, in Hz.

required
record int

Which record.

0
within tuple of float

A (low, high) band in Hz whose tallest line is the peak.

None
warn bool

Warn a missing crossing or too few lines across the peak as a HalfPowerWarning; the notes are on the reading either way.

True

Returns:

Type Description
HalfPower

The peak's frequency and height (in SI, as the record is stored), its half-power crossings, Q and damping ratio.

Srs

Srs(*args: Any, q: float | None = None, kind: str = 'maximax', **kwargs: Any)

Bases: DataArray

A shock response spectrum: the peak response of an oscillator at each natural frequency.

It is not a spectrum of the shock. Every point is the largest response that a single-degree-of-freedom oscillator of that natural frequency reached while its base was driven by the measured transient: one number from the whole response of one filter. Two shocks with the same SRS can look very different, and an SRS cannot be turned back into a time history, because the phase that produced each peak is not kept.

The abscissa is the oscillator's natural frequency, not a frequency in the shock, and is drawn on a log axis (log_abscissa): an SRS is specified at octave-spaced natural frequencies, and on a linear axis the lowest five octaves would be squeezed against the left edge. The ordinate is in the quantity the base was measured in, so an acceleration transient gives an acceleration SRS.

q and kind change what the curve means, so they are stored on the object: an SRS at Q = 10 and the same shock at Q = 50 are different curves, and a maximax SRS is not a positive one. See hertzforge.core.srs.

Parameters:

Name Type Description Default
*args Any

As for DataArray.

()
**kwargs Any

As for DataArray.

()
q float

The amplification factor; srs.DEFAULT_Q when omitted.

None
kind str

Which peak each point is: 'maximax', 'positive' or 'negative'.

'maximax'

Attributes:

Name Type Description
damping float

The damping ratio for the amplification factor, 1/(2Q).

Attributes
damping property
damping: float

The damping ratio for the amplification factor, 1/(2Q).

TimeHistory

TimeHistory(abscissa: ArrayLike, ordinate: ArrayLike, response_dof: str | Sequence[str], reference_dof: str | Sequence[str] | None = None, ordinate_dim: str | Sequence[str] | None = None, comment: str | Sequence[str] | None = None, ordinate_unit: str | Sequence[str | None] | None = None, reference_unit: str | Sequence[str | None] | None = None, dimension_hint: str | Sequence[str | None] | None = None, block: str | Sequence[str] | None = None)

Bases: DataArray

A measurement against time, as it was acquired.

Everything else in a random or shock test is computed from a time history, and the methods that compute it are here: spectra, PSDs, the full CPSD matrix, FRFs, multiple coherence and shock response spectra. Settings that say how to process the record are stored on it, not passed to each call: averaging (the frames a spectrum is averaged over), shocks (the events an SRS is computed from), truncation, filtering, sine_extraction and roles. A PSD and the coherence computed beside it therefore describe the same frames.

Methods:

Name Description
compute_spectra

The averaged spectrum of every channel.

amplitude_spectrum

Every channel's amplitude spectrum: each line scaled so a sine

channel_key

What makes record i the same channel as another.

suggest_averaging

Averaging parameters worked out from the record itself.

default_averaging

The averaging a view of this record opens with.

capture_indices

Which capture each record is: 0 for a channel's first record,

suggest_truncation

A truncation that spans the whole record.

truncate

This record cut to a span (core.truncate.truncate), using the

suggest_sine_extraction

The sine extraction setting a record starts from: automatic

suggest_filtering

A starting low-pass filter at a tenth of the sample rate,

filter

This record filtered (core.filters.filtered): low-pass,

resample

This record at the lower sample rate rate

integrate

One integration: acceleration to velocity, velocity to

differentiate

One differentiation: displacement to velocity, velocity to

rescale

This record with records (all of them when omitted)

time_statistics

Read one channel's statistics in the time domain: the

overload_check

Read each channel against its range: the samples on the

srs_windows

The windows an SRS of this record would be computed over.

srs_band

(low, high) in Hz: the band the SRS windows can support.

compute_srs

A shock response spectrum for every channel of every shock.

compute_srs_polarities

The positive, negative and maximax spectra together, from one

compute_psds

One-sided auto-power spectral density per channel, averaged

psd_type

The class of a PSD computed from this history.

srs_type

The class of an SRS computed from this history: Srs, or

compute_cpsds

The full cross-spectral density matrix, averaged across the

drive_dofs

The DOFs this history appears to have been driven at: those

default_role

The role a channel measuring quantity has when nothing

channel_identities

Every channel as (DOF, quantity), in order of first record.

channel_roles

Every channel's role, {(DOF, quantity): role}.

reference_channels

The channels an FRF or a coherence takes as references, as

response_channels

The channels an FRF or a coherence explains, as (DOF, quantity)

compute_frfs

The frequency response functions, one per response and reference

compute_multiple_coherence

How much of each response the references together account for.

read_partial_coherence

Which reference explains each response, and whether the

read_transmissibility

The ASD-ratio transmissibility of one response over one

to_sep005

This record as SEP 005 timeseries, the sdypy interchange format

Attributes:

Name Type Description
sample_rate float

Samples per second, from the abscissa. Raises a ValueError if

records_per_channel dict[tuple[str, str, str | None], int]

{channel key: number of records with that key}.

split_into_frames bool

Whether the records are already the averages.

average_counts tuple[int, int]

(fewest, most) frames any one channel will be averaged over.

Attributes
sample_rate property
sample_rate: float

Samples per second, from the abscissa. Raises a ValueError if the samples are not evenly spaced and in order.

records_per_channel property
records_per_channel: dict[tuple[str, str, str | None], int]

{channel key: number of records with that key}.

Usually one. A capture that a controller saved frame by frame has one record per average.

split_into_frames property
split_into_frames: bool

Whether the records are already the averages.

A controller that saves its spectral captures writes each frame as its own record. True when the averaging takes each record whole as one frame and some channel has more than one record. Then the frame length and count are fixed by the file, and only the window is left to choose.

average_counts property
average_counts: tuple[int, int]

(fewest, most) frames any one channel will be averaged over.

The two are equal for anything a controller wrote, since it saves every channel the same number of times. They differ only for a history put together by hand from unequal captures, and the table then shows both instead of a number true of only some channels.

Methods:
compute_spectra
compute_spectra() -> Spectrum

The averaged spectrum of every channel.

Each of a channel's records (one per average) is transformed with a one-sided FFT, a rectangular window and no amplitude scaling (numpy's rfft with norm='backward', so a sine of amplitude A on a bin reads A*N/2), and the transforms are averaged as a complex mean. This is the same convention as sdynpy's TimeHistoryArray.fft. Phase is kept, so content whose phase is random from frame to frame, such as the response to burst random excitation, averages toward zero. For lines scaled so a sine reads its amplitude under a chosen window, with the frames' magnitudes averaged, see amplitude_spectrum.

Returns:

Type Description
Spectrum

One record per channel, with the channel's quantity and units.

Raises:

Type Description
ValueError

If the time samples are not evenly spaced and in order.

amplitude_spectrum
amplitude_spectrum(averaging: Averaging | None = None, *, window: str = 'hann', parameter: float | None = None) -> AmplitudeSpectrum

Every channel's amplitude spectrum: each line scaled so a sine of amplitude A on it reads A, in peak units, under window, the frames' magnitudes averaged.

Beside compute_spectra, which is left as it is: that one is unscaled, rectangular and a complex mean. Here the window's amplitude correction, N/Σw (×2.000 for Hann), is applied and stated on the result, and a tone keeps its amplitude in the average whatever its phase in each frame. core.amplitude_spectrum.amplitude_spectrum does the reading and says how; hertzforge.drawing.plot.plot_amplitude_spectrum draws it.

Parameters:

Name Type Description Default
averaging Averaging

How to cut the record into frames: the record's own averaging by default, or one whole frame per record. Its window is not used.

None
window str

The window, by any name core.averaging.normalize_window takes: 'hann' for a general reading, 'flattop' for a tone's amplitude wherever it falls between lines.

'hann'
parameter float

The Tukey window's alpha or the Kaiser window's beta.

None

Returns:

Type Description
AmplitudeSpectrum

One row per channel, in SI peak units as the record is stored, with the window, its coherent gain and correction, the line spacing and the frames averaged.

Raises:

Type Description
ValueError

If the samples are not evenly spaced, or the frames do not fit in the record.

channel_key
channel_key(i: int) -> tuple[str, str, str | None]

What makes record i the same channel as another.

The DOF and what is measured there, never the DOF alone: a drive point has a force record and an acceleration record at the same DOF, and those two are not averages of each other. Spectra, PSDs and the channel counts all group records by this key.

Parameters:

Name Type Description Default
i int

Which record.

required

Returns:

Type Description
tuple of (str, str, str or None)

The response DOF, the dimension and the dimension hint. Records with the same key are the same channel.

suggest_averaging
suggest_averaging(**kwargs: Any) -> Averaging

Averaging parameters worked out from the record itself.

A run holds more than the test (the shaker coming up, a reduced-level check, whatever was still recording afterward), and this finds the steady stretch to average and as many frames as fit in it. See hertzforge.core.detect.

A record that already has an averaging, from an import or set by hand, keeps its frame length, window, overlap and detrend; only the start and the number of frames are worked out. A record with none gets the detector's own settings.

Parameters:

Name Type Description Default
**kwargs Any

Overrides for individual parameters, such as window.

{}

Returns:

Type Description
Averaging

The suggested averaging.

Raises:

Type Description
ValueError

If the detector cannot frame the record.

default_averaging
default_averaging() -> Averaging

The averaging a view of this record opens with.

The record's own averaging when its start was set (by an import, a drag or a typed value). Otherwise the result of suggest_averaging, unless that has fewer frames than the record's own averaging asks for, in which case the record's own is used. A record with no averaging that the detector cannot frame gets each record as one frame.

Returns:

Type Description
Averaging

The averaging to show.

capture_indices
capture_indices() -> list[int]

Which capture each record is: 0 for a channel's first record, 1 for its second, and so on.

A channel is a channel_key group. The numbering is the order in which the PSD and CPSD computations combine the records, so the capture the averaging view shows is one of those averaged.

Returns:

Type Description
list of int

One capture number per record.

suggest_truncation
suggest_truncation() -> Any

A truncation that spans the whole record.

This is the starting position of the truncate view's handles, not a default that truncate uses: keeping everything changes nothing, so Truncate Data is refused until a span is set.

Returns:

Type Description
Truncation

From the first sample's time to the last's.

truncate
truncate(truncation: Any = None) -> TimeHistory

This record cut to a span (core.truncate.truncate), using the history's own truncation unless one is passed.

Parameters:

Name Type Description Default
truncation Truncation

The start and stop, in seconds on the record's own clock. Defaults to the record's own truncation.

None

Returns:

Type Description
TimeHistory

The samples inside the span, every channel, with their original times.

Raises:

Type Description
ValueError

If no truncation is passed or set.

suggest_sine_extraction
suggest_sine_extraction(specification: Any = None) -> Any

The sine extraction setting a record starts from: automatic smoothing, chosen from the recording and the specification when the levels are read, with the clock refinement on.

Parameters:

Name Type Description Default
specification SineSweepSpecification

The sweep the levels would be read against. When given, the smoothing the automatic setting would choose is worked out now and stored in the setting as chosen, so the sine view can show it before anything is extracted.

None

Returns:

Type Description
SineExtraction

The default setting.

suggest_filtering
suggest_filtering() -> Any

A starting low-pass filter at a tenth of the sample rate, order 4.

A low-pass, because removing noise above the content is the most common case; the filter view also offers high-pass and band-pass. The corner is a choice, not a detection, since nothing in the record says where its content stops being signal. At a tenth of the sample rate the integrate and differentiate round trip was measured at about 2 % RMS error (core.filters), and the corner is below the mounted-resonance range of a shock accelerometer. Check it in the filter view before using it.

Returns:

Type Description
Filtering

The suggested filter.

filter
filter(filtering: Any = None) -> TimeHistory

This record filtered (core.filters.filtered): low-pass, high-pass or band-pass, as the filtering describes, using the history's own filtering unless one is passed.

Parameters:

Name Type Description Default
filtering Filtering

The pass-band edges and order. Defaults to the record's own filtering.

None

Returns:

Type Description
TimeHistory

Every channel filtered, with zero phase shift.

Raises:

Type Description
ValueError

If no filtering is passed or set.

resample
resample(rate: float, *, anti_alias: bool = True, order: int | None = None) -> TimeHistory

This record at the lower sample rate rate (core.resample.resample): every channel through a zero-phase low-pass at the new rate over 2.56, then every q-th sample kept.

core.resample.read_resample reads what the resampling does on a channel's spectrum, and hertzforge.drawing.plot.plot_resample draws it.

Parameters:

Name Type Description Default
rate float

The new sample rate, in Hz, a whole division of this record's.

required
anti_alias bool

Filter before decimating. Without the filter, anything the record holds above the new Nyquist frequency folds into the new band, and an core.resample.AliasWarning says so.

True
order int

The anti-alias filter's design order, core.resample.ORDER when omitted.

None

Returns:

Type Description
TimeHistory

The record at rate.

Raises:

Type Description
ValueError

If the record is not evenly sampled, or rate is not a whole division of its sample rate.

integrate
integrate(drift_corner: Any = ...) -> TimeHistory

One integration: acceleration to velocity, velocity to displacement (core.filters.integrate).

Parameters:

Name Type Description Default
drift_corner float or None

High-pass corner in Hz applied after integrating, so a sensor bias does not become a ramp. Omitted (...), the default corner is used; None integrates with no high-pass.

...

Returns:

Type Description
TimeHistory

Acceleration becomes velocity, velocity becomes displacement. Other quantities are left out.

differentiate
differentiate() -> TimeHistory

One differentiation: displacement to velocity, velocity to acceleration (core.filters.differentiate).

Returns:

Type Description
TimeHistory

The differentiated channels.

rescale
rescale(factor: float, records: Any = None) -> TimeHistory

This record with records (all of them when omitted) multiplied by factor, the rest unchanged (core.rescale.rescaled): the correction for a channel recorded with the wrong sensitivity, whose factor core.rescale.sensitivity_factor gives.

Parameters:

Name Type Description Default
factor float

Finite and not zero; negative flips the sign.

required
records sequence of int

Which records, counting from zero.

None

Returns:

Type Description
TimeHistory

The rescaled record, with this one's clock, channels and settings.

time_statistics
time_statistics(record: int = 0, **options: Any) -> TimeStatistics

Read one channel's statistics in the time domain: the moments, the crest factor and its peak, the excursions at the peak, the samples on the rail and those not finite, the tails beyond 3, 4 and 5 sigma against the Gaussian's, the crossing rate counted and from the spectrum, the expected largest peak and the kurtosis frame by frame, each judged against its band.

core.time_statistics.record_statistics does the reading, over the span the kurtosis bars read, and says how; hertzforge.drawing.plot.plot_time_statistics draws it.

Parameters:

Name Type Description Default
record int

Which channel.

0
**options Any

full_scale (the channel's range, in SI), margin, frame, duration and the bands, as core.time_statistics.time_statistics takes them.

{}

Returns:

Type Description
TimeStatistics

Every number, in SI as the record is stored, the bands and the flags.

overload_check
overload_check(ranges: ChannelTable | ArrayLike | float, **options: Any) -> OverloadCheck

Read each channel against its range: the samples on the rail (a count, a share and a rate), the crest factor, the headroom of the range over the largest peak in dB, and that peak scaled to the next level, each channel judged for the rail, the next level and samples beyond the range.

core.overload.overload_check does the reading, over the span the kurtosis bars read, and says how; hertzforge.drawing.plot.plot_overload draws it.

Parameters:

Name Type Description Default
ranges (ChannelTable, array_like or float)

The channel table describing this record (the level each channel clips at, ChannelTable.clip_ranges, over its Sensitivity), or the ranges in SI, one per channel or one for all.

required
**options Any

records, step_db, margin and rail_samples, as core.overload.overload_check takes them.

{}

Returns:

Type Description
OverloadCheck

Every channel's numbers, in SI as the record is stored, its flags and the judgment.

srs_windows
srs_windows(shocks: Sequence[Any] | None = None) -> list[Any]

The windows an SRS of this record would be computed over.

The record's shocks; if it has none, its averaging frames; if it has neither, the whole record as one window. Every window is clipped to the record. compute_srs and the shock panel both use this.

Parameters:

Name Type Description Default
shocks sequence of Shock

Override windows; the record's own when omitted.

None

Returns:

Type Description
list of Shock

The settled windows, clipped to the record.

srs_band
srs_band(shocks: Sequence[Any] | None = None) -> tuple[float, float]

(low, high) in Hz: the band the SRS windows can support.

The low end is the frequency whose period is the shortest window (at least 1 Hz), since every curve uses one frequency grid and the shortest window has to hold a cycle of the lowest frequency. The high end is a fifth of the sample rate; above it the ramp-invariant filter would be asked about frequencies the record cannot resolve. compute_srs uses this band when none is given, and the shock panel shows it.

Parameters:

Name Type Description Default
shocks sequence of Shock

Override windows; the record's own when omitted.

None

Returns:

Type Description
tuple of float

(low, high) in Hz.

compute_srs
compute_srs(shocks: Sequence[int] | None = None, low: float | None = None, high: float | None = None, per_octave: int | None = None, q: float | None = None, kind: str = 'maximax') -> Srs

A shock response spectrum for every channel of every shock.

The windows are stored on the history, as the averaging is: pass shocks to override them. Otherwise the record's shocks are used, or its averaging frames when it has no shocks, or the whole record as one window when it has neither (srs_windows). A specification has neither, and is one window.

There is one curve per channel per event, never an average across events, because a shock test is judged on the worst shock and the mean of four shocks describes none of them. The event a curve came from is in its block label ('shock 2').

The band defaults to srs_band: from the lowest frequency the shortest window holds a cycle of, up to a fifth of the sample rate.

Parameters:

Name Type Description Default
shocks sequence of Shock

The windows to use in place of the record's own.

None
low float

The natural-frequency band, in Hz.

None
high float

The natural-frequency band, in Hz.

None
per_octave int

Frequency lines per octave.

None
q float

The oscillator amplification; srs.DEFAULT_Q when omitted.

None
kind str

Which peak to keep: 'maximax' (largest magnitude of either sign), 'positive' or 'negative' (reported as a positive magnitude).

'maximax'

Returns:

Type Description
Srs

One curve per channel per shock (a ShockSpecification for a target, see srs_type).

Raises:

Type Description
ValueError

If kind is not one of srs.KINDS.

compute_srs_polarities
compute_srs_polarities(shocks: Sequence[Any] | None = None, low: float | None = None, high: float | None = None, per_octave: int | None = None, q: float | None = None) -> dict[str, Srs]

The positive, negative and maximax spectra together, from one pass of the filter.

The windows, the band and the curves are those of compute_srs, which is this call keeping one of the three. Each oscillator's highest and lowest response come out of the same pass (srs.peaks), so the three spectra cost what one does, and they are worth reading together: a shock whose response is nearly all in one direction shows it as a gap between the positive and the negative spectrum that the maximax alone hides. The negative spectrum is reported as a positive magnitude, so the two are drawn on one log axis.

Parameters:

Name Type Description Default
shocks sequence of Shock

The windows to use in place of the record's own.

None
low float

The natural-frequency band, in Hz; srs_band when omitted.

None
high float

The natural-frequency band, in Hz; srs_band when omitted.

None
per_octave int

Frequency lines per octave; srs.PER_OCTAVE (12) when omitted.

None
q float

The oscillator amplification; srs.DEFAULT_Q when omitted.

None

Returns:

Type Description
dict of str to Srs

'positive', 'negative' and 'maximax', in that order, each one curve per channel per shock and each carrying its own kind.

compute_psds
compute_psds(averaging: Averaging | None = None) -> Psd

One-sided auto-power spectral density per channel, averaged across the frames.

Welch's method: each frame is windowed and transformed, and Gxx = 2|X|²/(fs·S) with S the sum of the window's squares (N for a rectangular window). DC and Nyquist have no mirror image to fold in and are |X|²/(fs·S), as scipy's welch computes them, so the spectrum sums to the record's mean square. The frames' powers are averaged. Power does not depend on phase, so the random phase of burst random excitation does not affect the result. Values are in (SI unit)²/Hz with dimensions such as 'acceleration**2/frequency'; a channel with undefined units stays undefined, with its hint squared the same way.

Each channel's statistical degrees of freedom, discounted for overlap (Averaging.statistical_dof), are stored on the result as Psd.statistical_dof, so the PSD can say what its average is worth (Psd.confidence_band) without the history beside it, and how the window ties neighboring lines together (Averaging.line_correlation) as Psd.line_correlation, so a sum of adjacent lines can say what it is worth too.

Parameters:

Name Type Description Default
averaging Averaging

How to cut the record into frames. Defaults to the record's own averaging, or one frame per record.

None

Returns:

Type Description
Psd

One auto-power spectral density per channel (a Specification for a target, see psd_type).

Raises:

Type Description
ValueError

If the samples are not evenly spaced, or the frames do not fit in the record.

psd_type
psd_type() -> type[Psd]

The class of a PSD computed from this history.

Psd for an ordinary record. A target's PSD is still a target: the PSD of a waveform the test article was required to see is the spectrum it was required to see, so TransientSpecification overrides this to return Specification. Otherwise a requirement and a measurement would be two objects of the same class, told apart only by name.

Returns:

Type Description
type

A Psd subclass.

srs_type
srs_type() -> type[Srs]

The class of an SRS computed from this history: Srs, or ShockSpecification for a target (see psd_type).

Returns:

Type Description
type

An Srs subclass.

compute_cpsds
compute_cpsds(averaging: Averaging | None = None) -> Psd

The full cross-spectral density matrix, averaged across the frames: every channel against every channel.

Gxy = 2·conj(X)·Y/(fs·S), not doubled at DC and Nyquist, which equals compute_psds on the diagonal, where conj(X)·X is |X|². The cross terms describe how two channels move together, which a PSD does not.

The records are laid out as an imported matrix is: one record per (response, reference) pair, row by row, so an n-channel history gives n² records shown as a grid. A cross term's dimension is the product of the two, a*b/frequency, and a diagonal term's is a**2/frequency. Each record's statistical degrees of freedom, the lesser of its two channels' as compute_psds counts them, are stored as Psd.statistical_dof.

Parameters:

Name Type Description Default
averaging Averaging

How to cut the record into frames. Defaults to the record's own averaging, or one frame per record.

None

Returns:

Type Description
Psd

The full cross-spectral matrix, complex, with reference DOFs.

Raises:

Type Description
ValueError

If the samples are not evenly spaced, or the frames do not fit in the record.

drive_dofs
drive_dofs() -> list[str]

The DOFs this history appears to have been driven at: those with a force or voltage record (EXCITATION_DIMS).

This is a guess from the quantities alone and only a default. What makes a channel a drive is that the controller had a feedback device on it, which the channel table records and a time history does not.

Returns:

Type Description
list of str

The DOFs, each once, in record order.

default_role classmethod
default_role(quantity: str) -> str

The role a channel measuring quantity has when nothing has said otherwise.

Parameters:

Name Type Description Default
quantity str

What the channel measures, as ordinate_dim names it.

required

Returns:

Type Description
str

'reference', 'response' or 'monitor'.

channel_identities
channel_identities() -> list[tuple[str, str]]

Every channel as (DOF, quantity), in order of first record. roles names channels by this pair.

Returns:

Type Description
list of (str, str)

One entry per channel.

channel_roles
channel_roles(stated: bool = True) -> dict[tuple[str, str], str]

Every channel's role, {(DOF, quantity): role}.

The role roles gives, or for a channel it does not name, the default for the quantity (default_role): a force is a reference, a motion a response, anything else a monitor. FRFs, multiple coherence and the grid's Role column all read this.

Parameters:

Name Type Description Default
stated bool

False gives the defaults alone, ignoring roles. The provenance fingerprint compares against these, so stating the roles the defaults would give does not mark derived objects out of date.

True

Returns:

Type Description
dict of (str, str) to str

Every channel's role, in first-record order.

reference_channels
reference_channels(references: Sequence[Any] | None = None) -> list[tuple[str, str]]

The channels an FRF or a coherence takes as references, as (DOF, quantity) pairs.

When references is omitted, the channels whose role is 'reference' (channel_roles). A call may name them instead, as (DOF, quantity) pairs or by DOF alone. A DOF alone picks the excitation channel (force or voltage) at that point, the force at a drive point and not the accelerometer beside it, which is what a controller computes against; if the point has no excitation channel, its first channel is used.

Parameters:

Name Type Description Default
references sequence of str or (str, str)

References to use in place of the roles.

None

Returns:

Type Description
list of (str, str)

The reference channels, each once; a name that matches no channel is left out, and the caller says so.

response_channels
response_channels(references: Sequence[Any] | None = None) -> list[tuple[str, str]]

The channels an FRF or a coherence explains, as (DOF, quantity) pairs: every channel that is neither a reference nor a monitor.

With references named by the call, a channel whose role is 'reference' but that the call left out is a response, so a script asking for one drive of two gets the other as a response. A monitor is left out either way.

Parameters:

Name Type Description Default
references sequence of str or (str, str)

As reference_channels takes them.

None

Returns:

Type Description
list of (str, str)

The response channels, in order of first record.

compute_frfs
compute_frfs(references: Sequence[str] | None = None, averaging: Averaging | None = None, method: str = 'Hv') -> Frf

The frequency response functions, one per response and reference pair.

The three estimators differ in one assumption, where the noise is, and agree wherever there is little noise. They differ most where a measurement is worst, so the estimator is a choice.

H1 assumes the noise is on the response. It is biased low at resonance, where the response is large and the force small, and it is what a controller computes and a modal fit expects.

Gfx = Gff H,   so   H = Gff^-1 Gfx

With one reference that is Gfx / Gff. With several it is the MIMO estimate, and the matrix inverse is required: two shakers driving one test article are correlated, and dividing each response by each drive separately would credit both with the same motion. A pseudoinverse is used instead of a solve, because two shakers can be very nearly the same drive and Gff is then close to singular; the pseudoinverse gives the least-squares answer.

H2 assumes the noise is on the reference, and is biased high at anti-resonance for the same reason. With one reference it is Gxx / Gxf, one response at a time. With several references it needs as many equations as unknowns, which holds only when the system is square (as many responses as references). It is then the coupled form Gxx * Gfx^-1 (Rocklin, Crowley and Vold, 1985), computed the same way as sdynpy computes it. Because every response enters one matrix inverse, a channel's H2 depends on which other channels are in the set (measured at about 0.2 % on test signals with 5 % noise, more with more noise); H1 and Hv rows do not. A multi-reference set that is not square is refused; Hv answers the same question per response for any shape.

Hv, the default, assumes noise on both. It is the total least squares fit: the null direction of

[[Gff, Gfx], [Gxf, Gxx]]

taken as the eigenvector of its smallest eigenvalue, per response and per line. It falls between H1 and H2 (strictly between wherever the coherence is less than one) and needs no claim about which instrument is better. It is the default because a test can rarely make that claim: an accelerometer on a structure and a force cell in the load path both have errors, in different places. A total least squares fit weighs a unit of error on the force against a unit of error on the acceleration, which are not the same thing; that is part of the standard formulation, and it is why Hv is a middle estimate and not a better one.

The FRFs use the same frames compute_psds averages and the same references compute_multiple_coherence uses, so the coherence beside an FRF is that FRF's coherence.

Parameters:

Name Type Description Default
references sequence of str or (str, str)

The reference channels, by DOF or as (DOF, quantity) pairs (see reference_channels). When omitted, the channels whose role is 'reference'.

None
averaging Averaging

How to cut the record into frames. Defaults to the record's own averaging, or one frame per record.

None
method str

The estimator: 'Hv', 'H1' or 'H2'.

'Hv'

Returns:

Type Description
Frf

One record per response and reference pair, every reference for one response before the next response.

Raises:

Type Description
ValueError

If method is unknown, there are no reference or no response channels, there are no more averages than references, a channel holds a sample that is not a finite number in the frames read, or H2 is asked of a multi-reference set that is not square.

References

The coupled multi-reference H2 form is Rocklin, Crowley and Vold's; the rest set out the three estimators and their errors.

  1. Rocklin, G. T., Crowley, J., & Vold, H. (1985). "A comparison of H1, H2 and Hv frequency response functions." Proceedings of the International Modal Analysis Conference (IMAC).
  2. Ewins, D. J. (2000). Modal Testing: Theory, Practice and Application, 2nd ed. Research Studies Press. Which estimator biases which way, and why the bias is worst exactly where the measurement matters.
  3. Bendat, J. S., & Piersol, A. G. (2010). Random Data: Analysis and Measurement Procedures, 4th ed. Wiley. The single- and multiple-input frequency response estimates and their errors.
  4. Van Huffel, S., & Vandewalle, J. (1991). The Total Least Squares Problem: Computational Aspects and Analysis. SIAM. The fit Hv performs, and what it means to weigh error in one measured quantity against error in another.
compute_multiple_coherence
compute_multiple_coherence(references: Sequence[str] | None = None, averaging: Averaging | None = None) -> MultipleCoherence

How much of each response the references together account for.

Ordinary coherence measures what one reference explains; multiple coherence measures what the whole set of references explains at once. In a MIMO test this is the useful measure: two shakers driving one test article are correlated with each other, so a response can have poor coherence with either one alone and still be fully accounted for by the pair.

For a response x and references r,

gamma^2 = (Grx^H Grr^-1 Grx) / Gxx

the power of the best linear prediction of x from all the references at once, divided by the measured power. With one reference it reduces to the ordinary coherence. Values are limited to 0 to 1.

The coherence uses the same frames compute_psds averages, so it covers the stretch of record the averaging view has set, and the same references and framing as compute_frfs, so the coherence beside an FRF is that FRF's coherence. A pseudoinverse is used instead of a solve, because two shakers can be very nearly the same drive and the reference matrix is then close to singular.

Parameters:

Name Type Description Default
references sequence of str or (str, str)

The reference channels, by DOF or as (DOF, quantity) pairs (see reference_channels). When omitted, the channels whose role is 'reference'.

None
averaging Averaging

How to cut the record into frames. Defaults to the record's own averaging, or one frame per record.

None

Returns:

Type Description
MultipleCoherence

One curve per response channel.

Raises:

Type Description
ValueError

If there are no reference or no response channels, or no more averages than references.

References

The multiple coherence function is standard; these are where it and the bias of an estimate of it are set out.

  1. Bendat, J. S., & Piersol, A. G. (2010). Random Data: Analysis and Measurement Procedures, 4th ed. Wiley. Multiple-input systems: the multiple coherence function, read as the fraction of a response's power the whole set of references accounts for.
  2. Carter, G. C., Knapp, C. H., & Nuttall, A. H. (1973). "Estimation of the magnitude-squared coherence function via overlapped fast Fourier transform processing." IEEE Transactions on Audio and Electroacoustics, 21(4), 337-344. doi:10.1109/TAU.1973.1162496 The bias of a coherence estimate against the number of averages, which is why a coherence from too few frames reads high.
read_partial_coherence
read_partial_coherence(references: Sequence[str] | None = None, averaging: Averaging | None = None) -> PartialCoherence

Which reference explains each response, and whether the references were independent: the partial, reference and virtual coherence (core.partial_coherence).

Read from the frames compute_multiple_coherence and compute_frfs use, against the same references, so the multiple coherence in the reading is that method's, and the partial coherences are of the FRFs computed beside it.

Parameters:

Name Type Description Default
references sequence of str or (str, str)

The reference channels, as for compute_multiple_coherence. When omitted, the channels whose role is 'reference'.

None
averaging Averaging

How to cut the record into frames. Defaults to the record's own averaging, or one frame per record.

None

Returns:

Type Description
PartialCoherence

Every response against every reference, at every line.

Raises:

Type Description
ValueError

If there are no reference or no response channels, no more averages than references, or a channel holds a sample that is not a finite number in the frames read.

read_transmissibility
read_transmissibility(response: Any, reference: Any = None, averaging: Averaging | None = None) -> TransmissibilityReading

The ASD-ratio transmissibility of one response over one reference, beside H1, with H1's coherence and random error.

The ratio is the root of the response's autospectrum over the reference's; H1 is their cross-spectrum over the reference's autospectrum. The two are tied by the coherence: the ratio is |H1| over the root of the coherence at every line, so it never reads under H1, and the gap between them says the coherence is under one without saying why. Noise on the response lifts the ratio and leaves H1; noise on the reference pulls H1 down by the coherence and the ratio by its root, so there the ratio is the nearer of the two. The error of |H1| follows from the coherence and the averages (core.transmissibility sets out both). The three spectra come from the frames compute_psds averages and compute_frfs estimates from, so this H1 is compute_frfs(method='H1')'s for the pair and this coherence the ordinary one compute_multiple_coherence gives against the one reference.

The error is read at the averages the frames are worth, the equivalent count discounted for overlap that the PSD's confidence band uses (Averaging.statistical_dof, half its equivalent degrees of freedom), not the frames cut; the reading carries both.

Parameters:

Name Type Description Default
response str or (str, str)

The response channel, by DOF or as a (DOF, quantity) pair.

required
reference str or (str, str)

The input channel, the same way (a DOF alone picks the excitation channel there, as reference_channels does). When omitted, the one channel whose role is 'reference'.

None
averaging Averaging

How to cut the record into frames. Defaults to the record's own averaging, or one frame per record.

None

Returns:

Type Description
TransmissibilityReading

H1, the ASD ratio and the coherence at every line, in SI as the record is stored, with the frames and the averages.

Raises:

Type Description
ValueError

If there is not exactly one reference, the response is not a response channel of this history, a DOF given alone holds more than one quantity, there are fewer than two averages, or either channel holds a sample that is not a finite number in the frames read.

to_sep005
to_sep005(name: str | None = None) -> list[dict[str, Any]]

This record as SEP 005 timeseries, the sdypy interchange format (io.sep005 reads them back).

timeseries = history.to_sep005('run 4')

Returns the standard's list form: usually one dict, and one per unit and quantity where the channels mix. The sdypy validator requires a series' unit_str to be a single string, so accelerometers and a force gauge cannot be one valid series; the standard's list of series is for that case. A split series has its unit in its name, so the series can be told apart.

Values are written as they are held: SI where units are defined, with unit_str naming the SI unit, and the file's raw numbers where they are not, with unit_str empty (the standard allows an empty unit). fs gives the sample rate when the samples are evenly spaced; otherwise the time vector is written, which the standard also accepts. quantity is set where the standard has a letter for what a series measures.

Parameters:

Name Type Description Default
name str

A name for the series. Defaults to the first non-empty comment, or 'time history', since a SEP 005 series must be named.

None

Returns:

Type Description
list of dict

One SEP 005 timeseries mapping per unit and quantity, each holding every channel of that unit.

TransientSpecification

TransientSpecification(abscissa: ArrayLike, ordinate: ArrayLike, response_dof: str | Sequence[str], reference_dof: str | Sequence[str] | None = None, ordinate_dim: str | Sequence[str] | None = None, comment: str | Sequence[str] | None = None, ordinate_unit: str | Sequence[str | None] | None = None, reference_unit: str | Sequence[str | None] | None = None, dimension_hint: str | Sequence[str | None] | None = None, block: str | Sequence[str] | None = None)

Bases: TimeHistory

What a transient test was controlled to: a target time history.

This is different from a ShockSpecification, although the two are often called by each other's names. A shock specification is an SRS, a required response spectrum, and a controller meets it with any transient whose SRS falls inside the limits. A transient specification is a waveform, this acceleration sample by sample, and the controller inverts the structure's transfer function to reproduce it.

It is a time history that is a target, and it is compared against another time history (what the test article did), not against limits. It has no limits, since there is no settled convention for a tolerance on a waveform as there is for one on a spectrum.

Its computed spectra are targets too. Its PSD is a Specification and its SRS a ShockSpecification, both without limits, because the spectrum of a waveform the test article was required to see is the spectrum it was required to see. As plain objects they could not be told from the response's own spectra except by name, and the comparison would have to be set up by hand instead of by type.

Methods:

Name Description
psd_type

The class of a PSD of this record: Specification, since the

srs_type

The class of an SRS of this record: ShockSpecification, for

Methods:
psd_type
psd_type() -> type[Psd]

The class of a PSD of this record: Specification, since the spectrum of a required waveform is itself a requirement.

Returns:

Type Description
type

Specification.

srs_type
srs_type() -> type[Srs]

The class of an SRS of this record: ShockSpecification, for the same reason psd_type gives.

Returns:

Type Description
type

ShockSpecification.

View

View(eye: ArrayLike = (1.0, 1.0, 1.0), up: ArrayLike = (0.0, 0.0, 1.0))

The direction a geometry is viewed from in 3-D: where the eye is, seen from the model's center, and which way is up on screen.

A view is only a direction. Every view is fitted to what it shows, so there is no distance or zoom to store. Set on a geometry, it is the view the app opens the geometry and everything drawn on it in, the view Reset View returns to, and the view of the report's scenes and exported figures. A model built with Y up then opens upright without its nodes being rotated. Raises ValueError for a zero or non-finite direction, or an up along the line of sight.

Parameters:

Name Type Description Default
eye sequence of 3 floats

The direction from the model toward the eye, in the global frame; any length.

(1, 1, 1)
up sequence of 3 floats

Which way is up on screen. Only its part across the line of sight counts, so it need not be exactly perpendicular to eye.

(0, 0, 1)

Examples:

A model built with Y up, seen from the front, above and to the right:

>>> geometry.view = View(eye=(1, 1, -1), up=(0, 1, 0))

Methods:

Name Description
basis

(right, up) on screen, as unit vectors in the global frame.

Methods:
basis
basis() -> tuple[tuple[float, ...], tuple[float, ...]]

(right, up) on screen, as unit vectors in the global frame.

Right is the line of sight crossed with up, and up is up made perpendicular to the line of sight.

Project

Project(name: str = 'Project', objects: dict[str, Any] | None = None, active_geometry: str | None = None, project_type: str | None = None, object_groups: Iterable[ObjectGroup] | None = None, provenance: dict[str, dict[str, Any]] | None = None, data_index: DataIndex | Iterable[Mapping[str, Any]] | None = None, projections: Iterable[Mapping[str, Any]] | None = None)

Bases: dict

Every object in one test, by name, and how the objects are grouped.

A Project is a dict from name to object, so project['FRF'], list(project) and project.items() give what the tree shows.

The desktop app holds one of these: the window's objects, project_type and active_geometry are properties over it, and its buttons call the verbs below. A project built in the app and one built in a script are the same object, and each opens in the other.

Objects are usually reached by type rather than by name, as in project.geometry, project.basis.frf or project.other.shapes. The singular gives the one object of that kind and raises an error when several qualify; the plural is always a list.

Attributes: object_groups: The groups objects have been linked into, each {'members': [...], 'role': 'Basis' | None} with an optional 'name'. Objects are grouped only by link, never by matching their names. project_type: The kind of test: 'Modal Test', 'Random Vibration', 'Transient', 'Shock', 'Sine Sweep', 'Random and Sine' or 'System ID'. It sets the report template and the empty slots the tree shows. active_geometry: The name of the geometry data is drawn on when nothing else is named. name: The project's name, used as the title of a saved .hforge and of a rendered report.

Methods:

Name Description
element_shapes

Read a solved model's modes as strain and stress at each solid

grouped_names

[(group or None, [names])] in the order the tree shows them.

ordered_names

Every name, flat, in the order the tree shows them.

add

Add an object under a unique name and return the name used.

duplicate

Copy objects and add the copies beside them, as Copy and Paste

import_file

Import a file into this project and return the names added.

remove

Delete objects and take them out of every object group.

rename

Rename an object and change every reference to it.

hold_by_reference

Hold the object name by reference to the file it was read

rename_dof

Correct a channel's coordinate on an object and on every object

link

Link objects into one group, merging any groups they are

unlink

Take objects out of their object groups. A group left with one

name_object_group

Name the object group an object belongs to, or remove its name.

object_group_of

The members linked with name, or None.

role_of

'Basis' for an object in the Basis group, otherwise None.

placed

{role: [members]}: the objects in each group that has a role.

sides

{side: [object names]} for the project type's slots.

missing

The project type's empty slots, the ones the tree shows gray.

object_group_with_role

The object group carrying a role, or None.

place

Put one object into the Basis or the other group, creating the

set_channel_role

Give one channel the role reference, response or monitor, on a

transformed_rows

Which of a data object's response DOFs are rows of a response

set_role

Set the role of the group an object is in. The Basis is

set_basis

Set the Basis for comparisons, the group the other objects are

modal_basis

The shape set an object's modal records are coordinates of,

geometry_for

(name, geometry) for the geometry an object is drawn on and

sensors

The sensors a channel table places on its geometry, and notes on

fit_sensors

The accelerometers a geometry's measured points locate

set_sensor

Choose what a measured accelerometer is made as: its node, its

set_scan_set

Say which sensor a set of measured points belongs to, or which

create_sensors

Make a geometry and a channel table of the accelerometers a

channel_table_for

(name, table) for the channel table linked with an object:

verbs

The processing verbs that apply to an object, each with its

selection_verbs

The processing verbs a selection can act on, each with its

compute_spectra

Compute the raw spectra of a time history (Compute Spectra):

compute_psds

Compute PSDs from a time history's averages (Compute PSDs). A

transform_responses

The rows a control loop's response transformation made of a

transformed_from

The recording a history of transformed responses

recording_for

The history a specification is read against, among a

follow_averaging

Give a recording's averaging to every history of transformed

averaging_of

The Averaging a computed spectrum was made with, from its

rms_source

The name of the time history a computed autospectrum was made

rms_check

Check one record of an autospectrum against the time history

caption_of

The caption a report plot of a measured record carries, read

field_limit

The statistical limit over a set of measured PSDs or SRSs and

derive_specification

Write the specification a set of measured PSDs or SRSs gives

compute_octave

Integrate a spectrum onto proportional octave bands (Compute

make_realizable

Repair a cross-spectral matrix to the nearest realizable one

compute_frfs

Compute frequency response functions from a time history

reprocess_modal_test

Estimate a Modal Test measurement's FRFs and coherence again from

read_transmissibility

The ASD-ratio transmissibility behind one record of an FRF,

read_partial_coherence

Which drive explains each response, and whether the drives

compute_multiple_coherence

Compute the multiple coherence from a time history (Compute

compute_srs

Compute shock response spectra from a time history's shocks

srs_ceiling

The highest natural frequency a record's SRS can be read to,

detect_shocks

Find the events in a time history and mark them on it (Detect

filter_data

Filter a time history with its own filter settings (Apply

resample

Take a time history to a lower sample rate (Apply Resample in

rescale

Multiply some or all of a time history's records by a factor

filter_histories

Filter several time histories the same way (Apply Filter with

rescale_histories

Rescale several time histories by one factor (Apply in Rescale

time_history_sets

Time histories picked together, split into the two sets a time

compare_time_histories

Pair two sets of time responses station by station on one

set_time_comparison_pairs

Pair a time comparison's records anew (Edit Pairs), from the same

set_time_comparison_window

Keep a new scoring window on a time comparison (Save TRAC

truncate_data

Cut a time history to its truncation span (Apply Truncation in

integrate

Integrate a time history once (Integrate): acceleration

differentiate

Differentiate a time history once (Differentiate):

compute_cpsds

Compute the full cross-spectral matrix from a time history's

transform

Transform a record's channels through a shape set to modal

expand

Expand modal responses through a shape set back to physical

channel_frfs

The physical FRFs expand makes from modal FRFs at a channel

channel_shapes

A shape set at a channel table's DOFs, for the FRFs between

gauge_strains

The strain each strain channel of a channel table reads in each

drive_points

The DOFs a channel table says a force is applied at: its

driven_modes

Each modal coordinate's response to a unit force at one DOF,

author_specification

Write a specification from a sheet (Make Specification in the

generate_rigid_body_modes

Generate the six rigid-body mode shapes of a geometry (Generate

generate_signal

Generate a reference signal from a spectrum, a sine

compute_modal_responses

Compute how each mode of a shape set answers the forces in a

synthesize_modal_frfs

Synthesize each mode's own FRF from a shape set (Synthesize

merge_coincident_nodes

Merge each set of a geometry's coincident nodes into one node

align_meshes

Move the coarser mesh's nodes onto the finer mesh's nodes where

new_geometry

Add an empty geometry to build a model in (the project's +

new_channel_table

Add an empty channel table to fill in by hand (the project's

add_channels

Add blank channels to a channel table, numbered on from its

set_view

Set the view a geometry opens on in 3-D, in the app, the report

tie_elements

Tie a patch of a geometry's elements rigidly to the part under

merge_groups

Merge a geometry's element groups into one (Merge Element

add_solid_block

Add a block to a geometry's solids (core.solids). A solid is

add_solid_cylinder

Add a cylinder to a geometry's solids (core.solids), of

add_solid_cone

Add a cone to a geometry's solids (core.solids.add_cone): a

add_solid_sphere

Add a sphere to a geometry's solids (core.solids.add_sphere),

add_solid_plate

Add a plate to a geometry's solids (core.solids.add_plate): a

add_solid_disk

Add a disk to a geometry's solids (core.solids.add_disk): a

add_solid_section

Add a structural section to a geometry's solids

add_solid_hole

Add a hole to a geometry's solids (core.solids.add_hole), to

delete_elements

Delete a geometry's elements and the nodes only they used,

delete_element_groups

Delete a geometry's element groups with their elements and the

edit_solid

Change a solid after it is made (core.solids.edit). Anything

move_solids

Move whole solids (core.solids.move): a part and every solid

combine_solids

Add a boolean of a geometry's solids: 'union', 'subtract' (the

reorder_solids

Put a geometry's solids in a new order (a drag in the tree):

copy_solids

Copy a geometry's solids, recipe and all, into the same

pattern_solids

Pattern a geometry's solids in rows, columns and layers

mesh_solids

Mesh a geometry's solids into bricks, tetrahedra or shells

detect_mated_surfaces

The patches where element groups' surfaces mate

add_mated_surfaces

Join two element groups where their surfaces mate (Mate

mate_surfaces

Join every patch where the element groups' surfaces mate, as

edit_mated_surfaces

Change a set of mated surfaces: its name, nodes_a,

delete_mated_surfaces

Delete sets of mated surfaces, by id; returns how many went.

delete_solids

Delete a geometry's solids, each with every solid it is made

separate_solids

Take a geometry's booleans and patterns apart (Take Apart).

solve_modes

Solve the normal modes of a geometry whose element groups have

plan_instrumentation

Plan a test's accelerometers from finite element modes, by

convert_to_specification

Convert a PSD or CPSD to a specification, the requirement

convert_to_psd

Convert a specification to a plain PSD or CPSD, under its own

remembered_spacing

The frequency spacing the specification's sheet remembers, in

scale_family

The measured PSDs that share one comparison scale: the object

comparison_scale

The decibels a measured PSD is scaled by when it is compared

set_comparison_scale

Hold a comparison scale on a measured PSD and its whole family

fit_coherence

The coherence the fitting screen weights a fit of source by,

fit_modes

Fit a modal model to an FRF set, as the fitting screen does.

fit_replay_line

The journal line that replays a fit made by hand and published

project_onto_basis

Sample a shape set at the Basis shape set's DOFs, at a

projected

The shape set project_onto_basis would add, without adding it:

match_modes

Save matched mode pairs as an object (the comparison screen's +

comparison_mac

The MAC between two shape sets, as the comparison screen shows

compared_sets

Two shape sets as they are compared: on DOFs they share.

set_projection

Set how the DOFs of two shape sets on two geometries are mapped

projection_of

How two shape sets are projected when compared (compared_sets):

projection_records

The pairs' DOF mappings as the project file holds them: one

expanded

The shape set expand_modes would add, without adding it: source

expand_modes

Expand a test's shape set to a model's DOFs through the model's

match_distance

How far a node may be from the nearest node of source's

merge

Combine compatible objects into one (Merge). The merged object

export

Write an object to another file format, chosen by the file's

export_state_space

Write a shape set at a channel table's channels as a modal

generate_report

Build a report from a starter template, bound by type to this

report_features

Turn a report's optional features on or off (the report

report_section

Write one skeleton section of a report (the report editor's

report_check_block

Give a report a check of its own, with what it reads and its

report_check

What a report still owes before it is issued, one line per

report_flash

Type the parts of a flash report only the author can write.

report_finding

Enter, change or remove a finding in a report's findings

draft_finding_fact

Offer a finding a draft of its fact, read off a comparison the

draft_finding_from_requirement

Offer a finding a draft of its fact, read off a row of a

draft_findings_from_run_log

Offer a report the deviations and anomalies a run log extract

accept_logged_finding

Accept, or discard, a finding a run log offered a report

report_test_date

Set the dates of the test a report covers, which its sensors'

report_calibration

Each sensor of a report's channel table against its test

report_calibration_text

The equipment list with each sensor's calibration status on

predict

Enter one response channel's predicted response, the

report_prediction

Add a block reading measured against predictions at the

report_requirement

Bind a test requirement to a run in the report name, and

index_file

Add a file to the project's data index (the report editor's

index_run_log_files

Add the files a run log extract names to the project's data

unindex_file

Take a file out of the data index (the report editor's

verify_data_index

Hash every file in the data index again and record whether

attach_run_log

Bring one test of a run log into the project, frozen at a stated

detach_run_log

Take a run log extract out of the project, and return it.

refresh_run_log

Take a run log extract again from its log, to its newest entry

report_identity

Enter a report's identification (the report editor's Identity

amend_report

Make an issued report an amendment, to be issued in its turn

run_identity

Which run of the test a time history is, as a report reads it.

set_run_identity

Enter which run of the test a time history is.

report_chronology

Draft the chronology of the project's runs and offer it to a

accept_chronology

Accept the drafted chronology as a report's Chronology section,

report_runs

Repeat a report's Results for every run (the editor's Results

work_up

Compute every missing object a kind of test expects from what

export_report

Write a report as one self-contained HTML file (Export).

table

(headers, rows) for an object that can be shown as a table.

transformation_of

A rigid set's transformation at a choice of DOFs, as an object

read_transformation

What a rigid-body transformation leaves unexplained of the

name_of

The name an object is stored under; a string is returned as

extract_sine

Read each specification tone's level out of a recording

stale

{derived name: reason} for every derived object whose source's

refresh

Recompute a derived object in place, under its own name.

refresh_stale

Refresh every stale object, sources before the objects derived

save

Write the whole project to one file: .hforge, .mat for the

open

Read a project from a .hforge, an older .vdyn, a

journal_as

Record a stretch of front-end work as the one line that

record_setting

Journal a settings write the way a script would make it.

record_call

Journal a method call on an object the way a script would make

session_script

This session's changes to the project as a runnable Python

Attributes:

Name Type Description
basis Selection

The Basis group, reached by type, as in project.basis.frf.

object_group_selections list[Selection]

Every object group, the Basis first, each reached by type.

other Selection

The one object group that is not the Basis, usually the model

names list[str]

Every object's name, in the order the tree shows them.

Attributes
basis property
basis: Selection

The Basis group, reached by type, as in project.basis.frf.

It is empty, and false, when no group is the Basis, so if project.basis: works as it reads. Its member names are project.basis.names.

object_group_selections property
object_group_selections: list[Selection]

Every object group, the Basis first, each reached by type.

other property
other: Selection

The one object group that is not the Basis, usually the model side of a correlation.

Empty when there is none. Raises AttributeError when there are several; use object_group_selections then.

names property
names: list[str]

Every object's name, in the order the tree shows them.

Methods:
element_shapes
element_shapes(shapes: Any, *, groups: Sequence[Any] | None = None, modes: Sequence[int] | None = None, name: str | None = None) -> str

Read a solved model's modes as strain and stress at each solid element's centroid and rule points (Strain and Stress), as an element shape set beside the shape set.

The model is the geometry in the shape set's group, its element groups carrying their materials. Each element is read through its own strain matrix and elasticity (core.element_shapes): the six strain and six stress components, global axes, SI, per unit modal coordinate. Only solids are read: bricks, wedges and tetrahedra.

Parameters:

Name Type Description Default
shapes str or object

The solved shape set, by name or as the object itself.

required
groups sequence of int or str

The element groups to read, by id or name. Every group of solids when omitted.

None
modes sequence of int

Which modes, by index from zero; all of them when omitted.

None
name str

What to call the result. Defaults to the set's name followed by 'Strain and Stress'.

None

Returns:

Type Description
str

The name the result was added under, unique within the project.

Raises:

Type Description
TypeError

If shapes is not a shape set.

ValueError

When the set has no geometry, or as core.element_shapes.element_shapes: a group that holds anything but solids, a set that does not reach the model's nodes, a mode not in the set, or a set too large to hold.

grouped_names
grouped_names() -> list[tuple[ObjectGroup | None, list[str]]]

[(group or None, [names])] in the order the tree shows them.

The Basis group comes first, then the other object groups, then the unlinked objects under None. Within each, objects are in the tree's type order, and objects of one type are in the order they were added.

ordered_names
ordered_names() -> list[str]

Every name, flat, in the order the tree shows them.

add
add(name: str, obj: Any) -> str

Add an object under a unique name and return the name used.

A name that is already taken gets a numbered suffix, the same as importing a file twice in the app; nothing is overwritten. The first geometry added becomes the active geometry.

Parameters:

Name Type Description Default
name str

What to call the object.

required
obj object

Any object the project can hold.

required

Returns:

Type Description
str

The name the object was added under, unique within the project.

duplicate
duplicate(*names: Any) -> list[str]

Copy objects and add the copies beside them, as Copy and Paste do in the tree. Returns the names added.

Each copy is named ' copy', with a number added when that name is taken. A copy's arrays are its own, so editing one leaves the other unchanged. Links and provenance stay with the originals: a copy is in no object group and has no record of how it was computed.

Parameters:

Name Type Description Default
*names str or object

The objects to copy, by name or as the objects.

()

Returns:

Type Description
list of str

The names the copies were added under, in order.

import_file
import_file(path: str | PathLike, *, received: bool = False, **options: Any) -> list[str]

Import a file into this project and return the names added.

The file can be anything hertzforge reads: a geometry, a Rattlesnake run, a saved project, or a control run's folder, imported as the project file it converts to. A saved project brings its object groups, which follow the objects even when a name clash renamed them, and when this project is empty it also brings its name, type and active geometry. When a reader returns several objects, each is named by its type the way the tree shows it (a reader's key such as 'Modal_frf' becomes 'FRF'), and if one of them is a channel table they are all linked into one group named for the file ('run3.mat').

A file that records what kind of test it was sets the project type. A controller's save records which environment ran, and importing it here sets the type the same way importing it in the app does.

options are passed to the format's reader, for example an Exodus file's steps='time' and nodes=[...] or a geometry's length_unit='m', so a script can give what the app asks for.

Parameters:

Name Type Description Default
path str or PathLike

The file to read. The importer is chosen by content and extension.

required
received bool

The file is a copy whose original's location is not known, such as a file a browser sent by its contents: the data index records it by its name, size and SHA-256 with no location, and no object is held by reference to it.

False
**options Any

Passed through to the importer.

{}

Returns:

Type Description
list of str

The names of every object added, in the order added.

remove
remove(*names: str) -> None

Delete objects and take them out of every object group.

A name not in the project is ignored. When the active geometry is removed, the first remaining geometry becomes the active one.

Parameters:

Name Type Description Default
*names str

The objects to act on, by name.

()

Returns:

Type Description
None
rename
rename(old: str, new: str) -> str

Rename an object and change every reference to it.

Object groups, matched-mode sets, report blocks, provenance records and the active geometry all refer to objects by name, and each is updated so that no report figure is left pointing at the old name. An unknown old raises KeyError; a new that is empty or already in use raises ValueError.

Parameters:

Name Type Description Default
old str

The current name.

required
new str

The name to give it.

required

Returns:

Type Description
str

The new name.

hold_by_reference
hold_by_reference(name: str, reference: Reference) -> None

Hold the object name by reference to the file it was read from, so a save writes the reference rather than a copy.

The object as it is now is what the file holds. Edited later, it is saved whole instead, since a reference would lose the edit.

Parameters:

Name Type Description Default
name str

The object, by its name in this project.

required
reference Reference

The file it is in and its name there.

required

Returns:

Type Description
None

Raises:

Type Description
KeyError

When the project has no object named name.

rename_dof
rename_dof(source: Any, old: str, new: str, quantity: str | None = None) -> list[str]

Correct a channel's coordinate on an object and on every object derived from it. In the app, double-click a row or reference column of the grid and type.

Only the channel changes, not the point: correcting a force labeled at the wrong node leaves the accelerometer at that node where it is. Spectra computed from a time history carry its channels, so the correction is also applied to every object derived from the source, through any number of steps, instead of leaving each one to be fixed by hand or recomputed. A derived object that does not carry the channel is left alone. An object with no coordinates raises TypeError.

Parameters:

Name Type Description Default
source str or object

The object whose grid row or column was edited.

required
old str

The coordinate as it is, for example '101Z+'.

required
new str

The coordinate to give it, normalized the same way as every coordinate.

required
quantity str

Which channel at old, for example 'acceleration' or 'force'. Every channel at the coordinate when omitted.

None

Returns:

Type Description
list of str

The names of the objects changed, the source first.

link(*names: str, role: str | None = None, name: str | None = None) -> list[str]

Link objects into one group, merging any groups they are already in. Returns the group's members.

A group holds at most one geometry, and its members are checked against it. A member that names nodes the geometry does not have is still linked, and the app marks its row red so the mismatch can be seen; a test often has drive points, control coordinates or virtual channels the model does not draw. A modal object with no shape set to be drawn against is refused with ValueError, as are fewer than two names and a second geometry.

Parameters:

Name Type Description Default
*names str

The objects to link, by name.

()
role str

The role to give the group: 'Basis', or None. Left out, a group being merged into keeps the role it had.

None
name str

What to call the group. A named group is exported to the Engineering Sciences Common Data Format as an activity with that name. Left out, a group being merged into keeps the name it had.

None

Returns:

Type Description
list of str

The group's members after linking.

unlink(*names: str) -> None

Take objects out of their object groups. A group left with one member is dissolved unless it has a role.

Parameters:

Name Type Description Default
*names str

The objects to act on, by name.

()

Returns:

Type Description
None
name_object_group
name_object_group(member: str, name: str | None) -> list[str]

Name the object group an object belongs to, or remove its name.

An object in no group raises KeyError.

Parameters:

Name Type Description Default
member str

Any member of the group, by name.

required
name str or None

The group's new name; None removes it.

required

Returns:

Type Description
list of str

The group's members.

object_group_of
object_group_of(name: Any) -> list[str] | None

The members linked with name, or None.

Parameters:

Name Type Description Default
name str or object

The object to look up.

required

Returns:

Type Description
list of str, or None

The names sharing its object group, or None when it is in no group.

role_of
role_of(name: Any) -> str | None

'Basis' for an object in the Basis group, otherwise None.

Parameters:

Name Type Description Default
name str or object

The object to look up.

required

Returns:

Type Description
str or None

Its object group's role, or None if it has none.

placed
placed() -> dict[str, list[str]]

{role: [members]}: the objects in each group that has a role.

Nothing is inferred here. An object that has not been placed is in no group with a role, and that is what makes the tree's gray slots meaningful: a slot is filled only by an object in its own group, so a modal test whose only geometry is the model's still shows a slot for the measured one.

sides
sides() -> dict[str, list[str]]

{side: [object names]} for the project type's slots.

The Basis is listed under its role. Every member of every other group is listed under OTHER_SIDE, because that side has no role of its own and is read from the groups instead. The tree's gray slots and missing are computed from this.

Returns:

Type Description
dict of str to list of str
missing
missing() -> list[tuple[str, type, str, int, bool, str | None]]

The project type's empty slots, the ones the tree shows gray.

Each is a tuple (label, class, icon key, ordinal, optional, side), as project_expectations gives them. A project with no type expects nothing. Until a Basis is set, every object counts toward every slot: the app places objects as they arrive, a script may never place them, and a script's project with everything in it and no groups should not show every slot empty.

Returns:

Type Description
list of tuple
object_group_with_role
object_group_with_role(role: str) -> ObjectGroup | None

The object group carrying a role, or None.

Parameters:

Name Type Description Default
role str

Which group to fetch. 'Basis' is the only role.

required

Returns:

Type Description
ObjectGroup or None

That group, or None when no group has the role.

place
place(name: Any, role: str) -> list[str]

Put one object into the Basis or the other group, creating the group if needed. Returns the group's members.

Unlike link, this takes a single object. If a group needed two members before it could exist, a pair sorted into the wrong group could not be moved across one object at a time. A move that is refused leaves the groups as they were.

Parameters:

Name Type Description Default
name str or object

The object being placed.

required
role str or None

'Basis', or None for the other group: the one group that is not the Basis, created if there is none yet. When there are several groups besides the Basis there is no single other group, and this raises ValueError; use unlink, then link onto a member of the group meant.

required

Returns:

Type Description
list of str

The group's members.

set_channel_role
set_channel_role(source: Any, dof: str, quantity: str, role: str) -> list[str]

Give one channel the role reference, response or monitor, on a time history or a channel table and on whatever is linked with it.

The time history's roles are the ones FRFs and multiple coherence use. A channel table linked with a history whose channels it describes shows the history's roles, so a change made on either is made on both. A channel table with no such history keeps its own roles. An unknown role or channel raises ValueError, and an object that is neither raises TypeError.

Parameters:

Name Type Description Default
source str or object

The time history or channel table, by name or as the object.

required
dof str

The channel's degree of freedom, for example '101Z+'.

required
quantity str

What it measures, as a history's ordinate_dim or a table's channel type names it ('acceleration', 'force', or 'length' for a displacement).

required
role str

'reference', 'response' or 'monitor'.

required

Returns:

Type Description
list of str

The objects whose roles changed.

transformed_rows
transformed_rows(name: Any) -> list[tuple[str, str, list[str]]]

Which of a data object's response DOFs are rows of a response transformation in its channel table.

A transformed environment's specification and spectra are over the matrix's rows, which the controller's file names only by number, so they import as '1', '2', ... (io.rattlesnake). This ties such a row back to the matrix: the window's note on the object, and a script's.

Parameters:

Name Type Description Default
name str or object

The data object.

required

Returns:

Type Description
list of (str, str, list of str)

(table name, environment, rows) for each environment of the linked channel table (channel_table_for) whose response transformation has a row among the object's response DOFs, in the table's order. Empty when none has.

set_role
set_role(name: str, role: str | None) -> None

Set the role of the group an object is in. The Basis is unique, so giving it to one group takes it from any other.

An object in no group raises ValueError.

Parameters:

Name Type Description Default
name str

The object whose group is being labeled.

required
role str or None

The role, or None to clear it.

required

Returns:

Type Description
None
set_basis
set_basis(*names: Any) -> list[str]

Set the Basis for comparisons, the group the other objects are compared against.

Comparisons are made in the Basis group's DOFs, its modes are the rows of the MAC, and its frequencies are the baseline for frequency error. One name marks that object's group as the Basis; several names are linked first.

Parameters:

Name Type Description Default
*names str or object

The objects that form the basis set.

()

Returns:

Type Description
list of str

The basis group's members.

modal_basis
modal_basis(name: Any, records: Sequence[int] | None = None) -> str | None

The shape set an object's modal records are coordinates of, by name: the set whose shapes turn them into motion.

Read from where the records came from. Modal responses computed from forces (compute_modal_responses) name their set in each comment; a transform's result names it in its provenance; an object derived from either (filtered, decimated, cropped) keeps its source's set. None when nothing says, when the records named come from two sets, or when the set is gone or has fewer modes than the records.

Parameters:

Name Type Description Default
name str or object

The object, by name or as the object itself.

required
records sequence of int

Read only these records; every record at a modal DOF when omitted.

None

Returns:

Type Description
str or None

The shape set's name.

geometry_for
geometry_for(name: Any) -> tuple[str, Geometry] | None

(name, geometry) for the geometry an object is drawn on and checked against: the one in its group, otherwise the active one.

Parameters:

Name Type Description Default
name str or object

The object whose geometry is wanted.

required

Returns:

Type Description
tuple of (str, Geometry), or None

The geometry's name and the geometry itself, or None when there is no geometry in the object's group and no active geometry.

sensors
sensors(name: Any) -> tuple[list, list[str]]

The sensors a channel table places on its geometry, and notes on what could not be placed (core.sensors.place): the bodies the 3-D view draws when Sensors is on.

Parameters:

Name Type Description Default
name str or object

The channel table.

required

Returns:

Name Type Description
sensors list of Sensor

One per physical sensor: its node, model, catalog entry, center and frame.

notes list of str

Rows left out and why, models drawn as generic bodies, and triax legs the table gets wrong.

Raises:

Type Description
TypeError

If the object is not a channel table.

ValueError

If there is no geometry to place them on.

fit_sensors
fit_sensors(name: Any) -> tuple[list, list[str]]

The accelerometers a geometry's measured points locate (core.scan_fit.fit_sensors): a plane fitted to each face probed with a measuring arm, a cylinder to each round side, and from them each accelerometer's axes, where it is and how good the fit is. Nothing is changed.

The features are the geometry's element groups of measured points (io.point_files), named <sensor>_<label>. Renaming a group changes what its surface is taken for, and deleting a sensor's groups leaves it out.

Parameters:

Name Type Description Default
name str or object

The geometry holding the measured points.

required

Returns:

Name Type Description
fits list of SensorFit

One per sensor, in the order the sensors first appear, with its frame, its anchor, the fitted surfaces and its flags. Lengths are in meters when the geometry's units are declared, and in its own numbers when they are not.

notes list of str

The features left out and why, and that roughness was not judged when the geometry has no length unit.

Raises:

Type Description
TypeError

If the object is not a geometry.

ValueError

If the geometry holds no measured points.

set_sensor
set_sensor(source: Any, sensor: Any, **chosen: Any) -> dict[str, Any]

Choose what a measured accelerometer is made as: its node, its model, and its length and diameter. The choice is kept on the geometry holding the measured points and is what create_sensors makes it from.

Parameters:

Name Type Description Default
source str or object

The geometry holding the measured points.

required
sensor str or int

The sensor's name, the part of its features' names before the last underscore.

required
**chosen Any

Any of node (a whole number above 0), model (a catalog model, a size written as one such as 'Block 17.5 mm', or any name), length (a cube's side, or a round body's length) and diameter (a round body's diameter), the last two in meters once the geometry's unit is declared and in its own numbers before. None takes a choice back, leaving it to the fit and the catalog. Naming a model takes back a length and a diameter typed before it, so the model's own are used.

{}

Returns:

Type Description
dict

What is now chosen for the sensor, named as it is typed.

Raises:

Type Description
TypeError

If the source is not a geometry.

ValueError

If the geometry holds no measured points, the sensor is not among them, a choice is not one of the four, a diameter is given for a cube, or a value is not one its choice can hold.

set_scan_set
set_scan_set(source: Any, scan_set: str, sensor: Any = None, surface: str | None = None) -> str

Say which sensor a set of measured points belongs to, or which of its surfaces it is, where the name it was measured under is wrong. The set is renamed <sensor>_<label>, which is all that says what it is.

When the sensor already has a set for that surface, the two exchange: the other takes the sensor and surface this one had. That is the whole correction for two sets measured under each other's names.

Parameters:

Name Type Description Default
source str or object

The geometry holding the measured points.

required
scan_set str

The set's name, an element group of measured points.

required
sensor str or int

The sensor it belongs to; unchanged when omitted. A set not yet named for a sensor, given one and no surface, takes the first surface that sensor lacks: the top beside a cylinder with no flat face, else X+, Y+ or Z+.

None
surface str

What it is: 'X+', 'X-', 'Y+', 'Y-', 'Z+', 'Z-', 'Cylinder', 'Uni-axial Top' or 'Uni-axial Bottom', or the label itself ('1', '-2', 'c', 'p', 'b'). Unchanged when omitted.

None

Returns:

Type Description
str

The set's new name.

Raises:

Type Description
TypeError

If the source is not a geometry.

ValueError

If the geometry has no such set of measured points, the surface is not one, a set not yet named for a sensor is given a surface and no sensor, or the set to exchange with has no sensor and surface to hand back.

create_sensors
create_sensors(source: Any, name: str | None = None) -> dict[str, Any]

Make a geometry and a channel table of the accelerometers a geometry's measured points locate (fit_sensors, core.scan_sensors.assemble).

Each accelerometer is one node at the center of its body, with a coordinate system of its own whose axes are the accelerometer's. A tri-axial accelerometer gives channels X+, Y+ and Z+ whatever faces were measured; a uni-axial one gives the one axis its top was labelled with. The two objects are linked into one group. The measured points are left as they are, and the result is not made again when they change: call this again.

The center is half the body's size back from each measured face. The node, model and size of each sensor are what set_sensor chose for it; where nothing was chosen the size is that of the smallest tri-axial catalog model the points fit in, else the measured one, which the notes say.

Parameters:

Name Type Description Default
source str or object

The geometry holding the measured points. Its length unit must be declared.

required
name str

What the results are named after; the source's name when omitted.

None

Returns:

Type Description
dict

The names added, under 'geometry' and 'channels', and under 'notes' the sensors left out and the sizes that were assumed.

Raises:

Type Description
TypeError

If the source is not a geometry.

ValueError

If it holds no measured points or has no length unit, or no accelerometer can be placed.

channel_table_for
channel_table_for(name: Any) -> tuple[str, ChannelTable] | None

(name, table) for the channel table linked with an object: the one lookup the overload check and the shape values share.

For a time history, the first table in its group with a row naming one of its channels: a table in the group that names none of them describes some other recording and is passed over, as the role pairing passes it over. For anything else (a shape set, whose values are read at a table's channels), the first table in its group. A table has none of its own.

Parameters:

Name Type Description Default
name str or object

The object.

required

Returns:

Type Description
tuple of (str, ChannelTable), or None

The table's name and the table, or None when no linked table fits.

verbs
verbs(source: Any = None) -> list[tuple[str, str]]

The processing verbs that apply to an object, each with its one-line summary, so a script can find what can be done with it.

The table of which verb applies to what is the same one the app's bar reads, so the two always agree. Each summary is the first paragraph of the verb's own docstring, so it also matches the API reference.

Parameters:

Name Type Description Default
source str or object

The object to ask about. A name is looked up in the project; an object is checked as it is, whether or not it has been added, so a result can be asked about before it is kept. Omitted, every processing verb is listed.

None

Returns:

Type Description
list of (str, str)

(verb, summary) pairs, in the order the verbs are declared. Call a verb as getattr(project, verb).

selection_verbs
selection_verbs(*names: Any) -> list[tuple[str, str]]

The processing verbs a selection can act on, each with its one-line summary. The action table reads it for a pair.

For one object, these are its own verbs less the ones that need a second object (transform needs a shape set beside the record). For several objects, these are the verbs that apply to exactly that combination: a record and a shape set can be transformed or expanded, two shape sets on two geometries can be projected, and objects of one type can be merged. Verbs that apply to only one of the objects are not listed. The table is the same one verbs reads, so the bar and the API agree.

Parameters:

Name Type Description Default
*names str or object

The selection, by name or as the objects themselves.

()

Returns:

Type Description
list of (str, str)

(verb, summary) pairs, in the order the verbs are declared.

compute_spectra
compute_spectra(source: Any, *, records: Sequence[int] | None = None) -> str

Compute the raw spectra of a time history (Compute Spectra): each capture whole, unwindowed and unscaled (a sine of amplitude A on a line reads A*N/2), averaged as a complex mean (TimeHistory.compute_spectra). The history's averaging is not read.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

compute_psds
compute_psds(source: Any, *, records: Sequence[int] | None = None) -> str

Compute PSDs from a time history's averages (Compute PSDs). A history of one capture with no averaging set has its frames detected and stored on it (_framed).

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

transform_responses
transform_responses(source: Any, environment: str, table: Any = None) -> str

The rows a control loop's response transformation made of a recording, as a time history of their own (ChannelTable.transformed_responses).

A Rattlesnake run that controlled a virtual response has its specification and spectra over the matrix's rows, numbered from 1, and the import adds these rows for each such environment, so each specification is compared with the history that holds its own rows. They are kept apart from the hardware channels, and from another environment's rows, which are numbered from 1 too. The new history takes its source's averaging and keeps taking it (follow_averaging); an averaging set on it alone is refused, so its rows are framed as the channels they come from.

Parameters:

Name Type Description Default
source str or object

The recording, holding every control channel of the loop.

required
environment str

The loop, by the name the controller gave it.

required
table str or object

The channel table holding the loop; by default the one linked with the recording (channel_table_for).

None

Returns:

Type Description
str

The name the history was added under: ' Transformed', or ' Transformed ()' when the table holds more than one loop with a response transformation.

Raises:

Type Description
ValueError

If there is no channel table, the loop holds no response transformation, or the recording lacks a control channel.

transformed_from
transformed_from(name: Any) -> str | None

The recording a history of transformed responses (transform_responses) was made from.

Parameters:

Name Type Description Default
name str or object

The object.

required

Returns:

Type Description
str or None

The recording's name, or None for any other object.

recording_for
recording_for(specification: Any, source: Any) -> str

The history a specification is read against, among a recording and the histories of transformed responses made from it: the recording when it holds every channel the specification names, else the one transformed history that holds them all (a loop that controlled its transformation's rows).

Parameters:

Name Type Description Default
specification str or object

The specification.

required
source str or object

The recording.

required

Returns:

Type Description
str

The history's name.

Raises:

Type Description
ValueError

If neither the recording nor exactly one of its transformed histories holds every channel the specification names.

follow_averaging
follow_averaging(source: Any) -> list[str]

Give a recording's averaging to every history of transformed responses made from it (transform_responses), so they are framed as the channels they come from. The app does this after every averaging it stores on a recording. An averaging assigned by a script marks those histories stale until this is called or they are refreshed (refresh), which gives it to them too.

Parameters:

Name Type Description Default
source str or object

The recording.

required

Returns:

Type Description
list of str

The histories given it.

averaging_of
averaging_of(name: Any) -> Any

The Averaging a computed spectrum was made with, from its provenance, or None when it records none (an imported spectrum). A spectrum computed from a record with no averaging set was each record whole under a rectangle, and that is what is returned. Compute Spectra reads no averaging, so its spectra record none.

A spectrum does not carry its window, and a tone read off it needs one (Psd.read_tone): the window sets how far the tone leaks and how tall its spike stands. The provenance holds the averaging as it was when the spectrum was computed, which is the one that made it even if the record's own has moved since. An FRF and a coherence are read the same way: the transmissibility behind an FRF (read_transmissibility) is read from the frames the FRF was.

Parameters:

Name Type Description Default
name str or object

The spectrum, by name or as the object itself.

required

Returns:

Type Description
Averaging or None
rms_source
rms_source(name: Any) -> str | None

The name of the time history a computed autospectrum was made from, from its provenance, or None when it records none (an imported spectrum) or that record is no longer in the project.

Parameters:

Name Type Description Default
name str or object

The spectrum, by name or as the object itself.

required

Returns:

Type Description
str or None
rms_check
rms_check(spectrum: Any, record: int = 0, *, history: Any = None, threshold_db: float | None = None) -> Any

Check one record of an autospectrum against the time history it came from (the rms check): the rms from the area under the spectrum beside the record's own rms, the gap in dB, and the verdict.

A computed spectrum is checked against the record its provenance names, over the frames it was averaged with (averaging_of), so a record whose averaging has moved since is still read as the spectrum saw it. An imported spectrum, or one checked against another record, takes history and that record's own averaging. Psd.rms_check does the reading.

Parameters:

Name Type Description Default
spectrum str or object

The autospectrum, by name or as the object itself.

required
record int

Which record of the spectrum.

0
history str or object

The time history to check against; the one the spectrum was computed from when omitted.

None
threshold_db float

The gap, in dB either way, beyond which the two disagree; core.rms_check.GAP_DB when omitted.

None

Returns:

Type Description
RmsCheck

Raises:

Type Description
ValueError

When no time history is given and the spectrum records none, or when Psd.rms_check refuses.

caption_of
caption_of(name: Any, records: int | Sequence[int] = 0, *, specification: Any = None, per_octave: int | None = None, unit_system: Any = None, tone: str | None = None) -> Any

The caption a report plot of a measured record carries, read off the record and the project around it (core.report_caption): a spectrum's, a shock response spectrum's, a sine level's or a time history's (report_caption.caption_kind).

print(project.caption_of('Time History PSDs', 2).text())

A shock response spectrum's run is the time history it was computed from, with that run's sample rate and the filters applied in the project on the way to it; against a requirement each record is judged by the points rule in the polarity drawn and in each other polarity the project holds of the same events at the same Q and spacing. A sine level's run is the recording it was extracted from, its sweep is the tone as the requirement specifies it, and its distortion is the check the report's check blocks have already made of the tone (check_blocks.kept); the check rebuilds every tone and is not made for a caption. A time history is its own run.

Every row comes from the project, none is typed. The run is the time history the spectrum was computed from, and the stretch of it averaged; the window, overlap and frames are the averaging the spectrum was made with (averaging_of). A banded spectrum reads these, and its line spacing and degrees of freedom, from the narrowband spectrum it was banded from. The channel number and comment come from a channel table that names the channel, the one linked with the spectrum or its run first, and the global axis from the geometry linked with them, or the Basis geometry. An imported spectrum has no run and no averaging the project knows of, so its run, window and frames read "not recorded" (a block label, where its records carry one, is the run): the name an import gave the object is not a run.

per_octave is for a narrowband spectrum drawn on bands without being stored banded, as a report block that bands its data draws it: the caption is then of the spectrum on those bands, compared with the specification on the same bands, and the comparison's scale is resolved on the narrowband spectrum, as the report resolves it.

Parameters:

Name Type Description Default
name str or object

The spectrum, by name or as the object itself.

required
records int or sequence of int

The records the plot draws.

0
specification str or object

The requirement drawn with the spectrum, by name or as the object itself.

None
per_octave int

Bands per octave the spectrum is drawn on, for one banded only for the plot.

None
unit_system UnitSystem

The display units the rms values and ranges are written in.

None
tone str

For a sine level set, the tone drawn; its first when omitted.

None

Returns:

Type Description
(RecordCaption, SrsCaption, SineCaption or TimeCaption)

Raises:

Type Description
TypeError

If the object is not a measured record a caption reads.

field_limit
field_limit(sources: Any, records: Sequence[int] | None = None, *, statistic: str = 'tolerance', coverage: float = COVERAGE, confidence: float = CONFIDENCE, k: float | None = None, sigma_db: float | None = None, band: tuple[float, float] | None = None, max_overshoot_db: float = OVERSHOOT_DB, rms: str = 'exceed', max_breakpoints: int | None = MAX_BREAKPOINTS, progress: Any = None) -> Any

The statistical limit over a set of measured PSDs or SRSs and the straight-line envelope over it (core.field_limit.derive), without adding anything to the project.

Parameters:

Name Type Description Default
sources str, object, or list

One PSD or SRS by name or as the object (its records are the set), a list of them (every record of each), or a list of (name, record) pairs.

required
records sequence of int

With one source, the records that make the set.

None
statistic str

As core.field_limit.derive takes them, with its defaults.

'tolerance'
coverage str

As core.field_limit.derive takes them, with its defaults.

'tolerance'
confidence str

As core.field_limit.derive takes them, with its defaults.

'tolerance'
k str

As core.field_limit.derive takes them, with its defaults.

'tolerance'
sigma_db str

As core.field_limit.derive takes them, with its defaults.

'tolerance'
band str

As core.field_limit.derive takes them, with its defaults.

'tolerance'
max_overshoot_db float

As core.field_limit.fit_envelope takes them, with its defaults; max_breakpoints None for no limit.

OVERSHOOT_DB
rms float

As core.field_limit.fit_envelope takes them, with its defaults; max_breakpoints None for no limit.

OVERSHOOT_DB
max_breakpoints float

As core.field_limit.fit_envelope takes them, with its defaults; max_breakpoints None for no limit.

OVERSHOOT_DB
progress callable

Called with (done, total).

None

Returns:

Type Description
EnvelopeFit

The envelope, its limit the limit and limit.fieldset the set.

derive_specification
derive_specification(sources: Any, records: Sequence[int] | None = None, *, statistic: str = 'tolerance', coverage: float = COVERAGE, confidence: float = CONFIDENCE, k: float | None = None, sigma_db: float | None = None, band: tuple[float, float] | None = None, max_overshoot_db: float = OVERSHOOT_DB, rms: str = 'exceed', max_breakpoints: int | None = MAX_BREAKPOINTS, margin_db: float = 0.0, dof: str | None = None, name: str | None = None, progress: Any = None) -> str

Write the specification a set of measured PSDs or SRSs gives (Derive Specification): the limit over the set, the straight-line envelope over the limit, and margin_db added, as a Specification at the breakpoints for PSDs or a ShockSpecification for SRSs (EnvelopeFit.specification).

Parameters:

Name Type Description Default
sources Any
required
records Any
required
statistic Any
required
coverage Any
required
confidence Any
required
k Any
required
sigma_db Any
required
band tuple[float, float] | None

As field_limit takes them.

None
max_overshoot_db tuple[float, float] | None

As field_limit takes them.

None
rms tuple[float, float] | None

As field_limit takes them.

None
max_breakpoints tuple[float, float] | None

As field_limit takes them.

None
margin_db float

Decibels added to every breakpoint, on the set's convention (10 log10 for a PSD, 20 log10 for an SRS).

0
dof str

The DOF the specification is written at; the set's own when it has one.

None
name str

What to call it; the first source's name followed by 'Derived Specification' when omitted.

None
progress callable

Called with (done, total).

None

Returns:

Type Description
str

The name it was added under, unique within the project (a name already taken gets a numbered suffix).

compute_octave
compute_octave(source: Any, per_octave: int | None = None, *, records: Sequence[int] | None = None) -> str

Integrate a spectrum onto proportional octave bands (Compute Octave Bands). A specification's warning and abort limits are banded the same way.

The total power is unchanged; it is only arranged in bands, the way such a spectrum is usually read.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
per_octave int

Bands per octave. Defaults to core.octave.PER_OCTAVE, 6.

None
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

make_realizable
make_realizable(source: Any, *, name: str | None = None, tolerance: float | None = None, keep_diagonal: bool = True, records: Sequence[int] | None = None, progress: Any = None) -> str

Repair a cross-spectral matrix to the nearest realizable one (Make Realizable in the Realizability reading), and add the result beside it.

At every line where the matrix is not Hermitian and positive semi-definite, so that no set of signals has it, the nearest matrix that is replaces it (Psd.made_realizable); the lines that pass are unchanged. Holding the diagonal, the default, the autospectra stay exactly as written and only the cross terms move. Psd.realizability on the source says what moved and by how much.

Parameters:

Name Type Description Default
source str or object

The CSD or specification, by name or as the object itself.

required
name str

What to call the result. Defaults to the source's name followed by 'Realizable'.

None
tolerance float

How far below zero the smallest eigenvalue of the coherence matrix may lie, as a fraction of the largest; core.matrix_checks.REALIZABLE_TOLERANCE when omitted.

None
keep_diagonal bool

Hold the autospectra where they are.

True
progress callable

Called with (done, total) as the repair goes on. The app's progress bar uses it; a script can print it.

None
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

Raises:

Type Description
ValueError

If the object has no cross terms or its matrix is incomplete, if no line could be judged, or if it is realizable already, in which case there is nothing to repair.

compute_frfs
compute_frfs(source: Any, method: str = 'Hv', *, records: Sequence[int] | None = None) -> str

Compute frequency response functions from a time history (Compute FRFs), one for each response and drive, over the frames a PSD uses.

The three estimators differ only in where the noise is assumed to be. The method is put in the result's name, since two FRF sets from one history differ in nothing else a reader can see.

If the history has no averaging set, the frames are detected the same way the coherence detects them, so the FRFs and the coherence come from the same frames. The detected averaging is stored on the history.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
method str

Which estimator: 'Hv', 'H1' or 'H2'.

'Hv'
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

reprocess_modal_test
reprocess_modal_test(source: Any, method: str = 'H1', *, force: float | None = None, exponential: float | None = None, block: int | None = None, captures: Sequence[int] | None = None, shaker_window: str | None = None, name: str | None = None) -> tuple[str, str]

Estimate a Modal Test measurement's FRFs and coherence again from its frames, with the estimator, windows, block and frames chosen (core.modal_test.reprocess), into two new objects beside the frames; the run's own FRFs are left as they are.

Parameters:

Name Type Description Default
source str or object

A measurement's frames (a converted Modal Test run's 'Measurement k frames').

required
method str

'H1', 'H2' or 'Hv'.

'H1'
force float

The force window's width as a fraction of the block, on the references.

None
exponential float

The exponential window's end value, on every channel.

None
block int

Samples of each frame to use, from its first.

None
captures sequence of int

Which frames, by capture number from 0; every frame when omitted.

None
shaker_window str

A window on every channel instead of the transient ones.

None
name str

What to call the FRFs; the coherence takes the same name with 'coherence' in place of 'FRFs'. Defaults to the source's name followed by the estimator.

None

Returns:

Type Description
(str, str)

The names the FRFs and the coherence were added under.

Raises:

Type Description
ValueError

In the core's words, for what core.modal_test.reprocess refuses.

read_transmissibility
read_transmissibility(name: Any, record: int = 0) -> Any

The ASD-ratio transmissibility behind one record of an FRF, beside its H1, with H1's coherence and random error.

The FRF must have been computed in this project from a time history (Compute FRFs), against one reference. The reading is made from that history, for the record's response and reference, with the averaging the FRF was computed with (averaging_of), so it is of the frames the FRF was. Its H1 is the H1 of that pair whichever estimator the FRF used; the ratio, the coherence and the error are what TimeHistory.read_transmissibility says.

Parameters:

Name Type Description Default
name str or object

The FRF, by name or as the object itself.

required
record int

Which record of the FRF.

0

Returns:

Type Description
TransmissibilityReading

H1, the ASD ratio and the coherence at every line, in SI, with the frames and the averages.

Raises:

Type Description
ValueError

If the object is not an FRF computed from a time history in this project, or it was computed against more than one reference, where a ratio of two autospectra would credit one input with what several caused.

read_partial_coherence
read_partial_coherence(name: Any, *, progress: Any = None) -> Any

Which drive explains each response, and whether the drives were independent: the partial, reference and virtual coherence (core.partial_coherence).

name is a time history, read against its reference channels with its own averaging, or a multiple coherence computed in this project (Compute Multiple Coherence), read from its history with the averaging it was computed with (averaging_of), so the reading's multiple coherence is that object's.

Parameters:

Name Type Description Default
name str or object

The time history or the multiple coherence, by name or as the object itself.

required
progress callable

Called with (0, core.progress.BUSY) as the work starts, which cannot count its own stages; the app's progress bar uses it.

None

Returns:

Type Description
PartialCoherence

Every response against every reference, at every line.

Raises:

Type Description
ValueError

If the object is neither, or the history has no reference or no response channels, or no more averages than references.

compute_multiple_coherence
compute_multiple_coherence(source: Any, *, records: Sequence[int] | None = None) -> str

Compute the multiple coherence from a time history (Compute Multiple Coherence): how much of each response the drives account for.

It is averaged over frames. If the history has no averaging set, the frames are detected and stored on the history. Computed from the whole record as one frame, the drives would fit every response exactly and the coherence would be 1.0 at every line, which says nothing about the measurement.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

compute_srs
compute_srs(source: Any, *, per_octave: int | None = None, q: float | None = None, kind: str = 'maximax', low: float | None = None, high: float | None = None, records: Sequence[int] | None = None) -> str

Compute shock response spectra from a time history's shocks (Compute SRS), one curve per channel per event.

The events are the ones marked on the history. They are detected, and marked on the history, only when it has no shocks marked and no averaging set and is not a transient specification. A record read as frames already says where its events are (in a transient run each playing is one frame), and a specification is one playing by definition. A record filtered in this project takes its events from the recording it was filtered from, which is where they are detected (detect_shocks), and its spectrum stops at the low-pass corner it came through (srs_ceiling).

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
per_octave int

Natural-frequency lines per octave. Defaults to 12.

None
q float

The oscillator amplification, Q = 1/(2ζ). Defaults to 10 (5% damping), the usual value for shock tests.

None
kind str

Which peak each oscillator reports: 'maximax' (largest magnitude of either sign), 'positive' or 'negative'.

'maximax'
low float

The natural-frequency band, in Hz, to reach a requirement's own. Default to the record's (TimeHistory.srs_band) and srs_ceiling.

None
high float

The natural-frequency band, in Hz, to reach a requirement's own. Default to the record's (TimeHistory.srs_band) and srs_ceiling.

None
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

Raises:

Type Description
ValueError

For a low under a quarter cycle of the shortest window, a high above the Nyquist frequency, or a high above a low-pass the record came through.

srs_ceiling
srs_ceiling(name: Any) -> float | None

The highest natural frequency a record's SRS can be read to, in Hz, when a low-pass on its way sets it: the lowest corner of the filters applied in this project on the way to the record, as recorded when each was applied (_filters_on_the_way reads the same record). None when no low-pass did, or when the corner is above the top of the record's own band (TimeHistory.srs_band).

The filter is zero phase, so it takes 6 dB at its corner, and a response above it is gone: a 1500 Hz ring read 22 dB low on a record low-passed at 1024 Hz, with no sign of it on the curve.

Parameters:

Name Type Description Default
name str or object

The record.

required

Returns:

Type Description
float or None
detect_shocks
detect_shocks(source: Any, *, records: Sequence[int] | None = None) -> int

Find the events in a time history and mark them on it (Detect in the shock view). Returns how many were found.

Any events already marked are replaced. Mark the events on the recording before filtering it: every object derived from the recording then carries them, because core.filters copies the marks onto what it makes. compute_srs detects events only when a record has none, so if the filtered record were the first to be detected, the recording itself would be left unmarked.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
int

How many events were found and marked on the record.

filter_data
filter_data(source: Any, *, records: Sequence[int] | None = None) -> str

Filter a time history with its own filter settings (Apply Filter in the filter view), every channel at zero phase so the peaks stay where they are.

The settings are the history's filtering, set in the filter view as a low-, high- or band-pass. When none is set, the suggested low-pass (a tenth of the sample rate, order 4) is stored on the history and used, the way compute_frfs uses a suggested averaging, so this works before the filter view has been opened.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

resample
resample(source: Any, rate: float, *, anti_alias: bool = True, order: int | None = None, records: Sequence[int] | None = None) -> str

Take a time history to a lower sample rate (Apply Resample in the resample view) and add the result beside it.

Every channel goes through the zero-phase anti-alias low-pass and then every q-th sample is kept (TimeHistory.resample, which says what the filter is). The resample view shows what the resampling does to a channel's spectrum before it is made.

Parameters:

Name Type Description Default
source str or object

The time history, by name or as the object itself.

required
rate float

The new sample rate, in Hz, a whole division of the record's.

required
anti_alias bool

Filter before decimating.

True
order int

The anti-alias filter's design order, core.resample.ORDER when omitted.

None
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

rescale
rescale(source: Any, factor: float | None = None, *, recorded_sensitivity: float | None = None, correct_sensitivity: float | None = None, records: Sequence[int] | None = None) -> str

Multiply some or all of a time history's records by a factor (Apply in Rescale) and add the result beside it.

The factor is given outright, or as the sensitivity the data was recorded with and the correct one, in the same units, for a record taken with the wrong sensitivity: the factor is then recorded over correct (core.rescale.sensitivity_factor). The records not picked are copied unchanged, and the result keeps the source's clock, channels, averaging and shock windows, so it stands in for the source in whatever was computed from it. The channel table is not changed; a sensitivity wrong there as well is corrected in the table.

Parameters:

Name Type Description Default
source str or object

The time history, by name or as the object itself.

required
factor float

What the records are multiplied by; negative flips their sign.

None
recorded_sensitivity float

The sensitivity the data was recorded with and the correct one, given together in place of factor.

None
correct_sensitivity float

The sensitivity the data was recorded with and the correct one, given together in place of factor.

None
records sequence of int

Which records, counting from zero; every record when omitted.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

Raises:

Type Description
ValueError

When neither or both of a factor and the two sensitivities are given, a sensitivity is not above zero, the factor is zero or not finite, or a record is not in the history.

TypeError

When the source is not a time history.

filter_histories
filter_histories(*sources: Any, filtering: Any = None) -> list[str]

Filter several time histories the same way (Apply Filter with several picked), each copy added as filter_data adds one, and the copies put in an object group of their own.

Every history is filtered before any copy is added, so one that cannot be filtered (an edge above its Nyquist frequency, a sample that is not a number) adds nothing, and names the history. The sources' values are left as they were; the filter is stored on each as its filtering, which is what its copy refreshes from.

The group is named for the sources' group with " Filtered" added (an imported file's histories share a group named for the file), or "Filtered" and a number when they share no named group. A filtered test set and a filtered model set are then two groups, which time_history_sets splits for a time comparison.

Parameters:

Name Type Description Default
*sources str or object

Two or more time histories. Every record of each is filtered.

()
filtering Filtering

The filter, as TimeHistory.filtering holds it. The first history's own when omitted, or the suggested low-pass when it has none.

None

Returns:

Type Description
list of str

The copies' names, in the order of the sources.

Raises:

Type Description
ValueError

When fewer than two histories are given, one is not a time history, or one cannot be filtered.

rescale_histories
rescale_histories(*sources: Any, factor: float | None = None, recorded_sensitivity: float | None = None, correct_sensitivity: float | None = None, records: Mapping[str, Sequence[int]] | None = None) -> list[str]

Rescale several time histories by one factor (Apply in Rescale with several picked), each copy added as rescale adds one, and the copies put in an object group of their own.

Every history is rescaled before any copy is added, so one that cannot be (a record it does not have) adds nothing, and names the history. The sources are left as they were. The group is named as filter_histories names its own, with " Rescaled".

Parameters:

Name Type Description Default
*sources str or object

Two or more time histories.

()
factor float

What the records are multiplied by; negative flips their sign.

None
recorded_sensitivity float

The sensitivity the data was recorded with and the correct one, given together in place of factor.

None
correct_sensitivity float

The sensitivity the data was recorded with and the correct one, given together in place of factor.

None
records mapping of str to sequence of int

The records of each history to rescale, by name, counting from zero, such as the ones picked in the tree. A history not named, or every history when omitted, has all its records rescaled.

None

Returns:

Type Description
list of str

The copies' names, in the order of the sources.

Raises:

Type Description
ValueError

When fewer than two histories are given, one is not a time history, records are given for a history not among them, or the factor or a record is refused as rescale refuses it.

time_history_sets
time_history_sets(*names: Any) -> tuple[list[str], list[str]]

Time histories picked together, split into the two sets a time comparison compares: the histories of one object group against those of another, in the order of the groups' first members in the project, or two histories one against the other.

An imported file's histories share a group named for the file, so the histories of two files picked together are two sets.

Parameters:

Name Type Description Default
*names str or object

The histories picked: two, or every history of two groups.

()

Returns:

Type Description
(list of str, list of str)

The first set's names and the second's, each in project order.

Raises:

Type Description
ValueError

When fewer than two are given, one is not a time history, or more than two are given and they are not every one of two groups' histories.

compare_time_histories
compare_time_histories(*sources: Any, pairs: Sequence[Sequence[Any]] | None = None, records: Mapping[str, Sequence[int]] | None = None, start: float | None = None, stop: float | None = None, name: str | None = None) -> str

Pair two sets of time responses station by station on one clock, and add the result to be scored (TRAC / Overlay).

The records are paired by DOF and quantity, or by hand, and put on the coarsest of their clocks with nothing fitted or filtered (core.time_compare.compare). The result is a TimeComparison derived from its sources: it is marked out of date when one of them changes, refreshes from the same pairs, and follows a source that is renamed.

Parameters:

Name Type Description Default
*sources str or object

The time histories holding both sets, the test's first: its records are the first of each pair.

()
pairs sequence of [str, int, str, int]

Pairs made by hand, [first name, record, second name, record], counting records from zero.

None
records mapping of str to sequence of int

The records of each source to pair, by source name, such as the ones picked in the tree; each source's response records when omitted.

None
start float

The scoring window, in seconds; the whole shared clock when omitted.

None
stop float

The scoring window, in seconds; the whole shared clock when omitted.

None
name str

What to call it; 'Time Response Comparison' when omitted.

None

Returns:

Type Description
str

The name it was added under, unique within the project.

Raises:

Type Description
ValueError

When the records cannot be paired one way, share no stretch of time, or the window does not fit (core.time_compare.match_records, compare).

set_time_comparison_pairs
set_time_comparison_pairs(comparison: Any, pairs: Sequence[Sequence[Any]]) -> None

Pair a time comparison's records anew (Edit Pairs), from the same sources, as [first name, record, second name, record] with records counted from zero. The scoring window is kept when it still lies inside the new shared clock, and is the whole clock otherwise. A refresh keeps the new pairs.

Parameters:

Name Type Description Default
comparison str or object

The time comparison, by name or as the object itself.

required
pairs sequence of [str, int, str, int]

The pairs, each naming two of its sources' records.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

When a pair names a source the comparison does not have, or cannot be read one way (core.time_compare.match_records).

TypeError

When the object is not a time comparison.

set_time_comparison_window
set_time_comparison_window(comparison: Any, start: float, stop: float) -> None

Keep a new scoring window on a time comparison (Save TRAC window), in seconds inside its shared clock. A refresh keeps it.

Parameters:

Name Type Description Default
comparison str or object

The time comparison, by name or as the object itself.

required
start float

The window, in seconds.

required
stop float

The window, in seconds.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

When the window ends before it starts, reaches outside the shared clock or holds fewer than two samples.

TypeError

When the object is not a time comparison.

truncate_data
truncate_data(source: Any, *, records: Sequence[int] | None = None) -> str

Cut a time history to its truncation span (Apply Truncation in the truncate view): every channel between start and stop, on the record's original clock.

The span is the history's truncation, set in the truncate view. Unlike filter_data, there is no suggested value to fall back on, because the only neutral span is the whole record and keeping all of it changes nothing. With no span set this raises ValueError.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

integrate
integrate(source: Any, drift_corner: Any = ..., *, records: Sequence[int] | None = None) -> str

Integrate a time history once (Integrate): acceleration channels become velocity, and velocity channels become displacement.

The whole record is integrated, never the shock windows alone; core.filters gives the reasons. The drift corner is stored in the result's provenance, so a refresh uses the same one.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
drift_corner float or None

High-pass corner in Hz applied after integration, so that a sensor bias does not become a ramp. ..., the default, uses core.filters.DRIFT_CORNER (2 Hz). None applies no high-pass, so any drift is kept.

...
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

differentiate
differentiate(source: Any, *, records: Sequence[int] | None = None) -> str

Differentiate a time history once (Differentiate): displacement channels become velocity, and velocity channels become acceleration.

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

compute_cpsds
compute_cpsds(source: Any, *, records: Sequence[int] | None = None) -> str

Compute the full cross-spectral matrix from a time history's averages (Compute CPSDs), every channel against every channel. A history of one capture with no averaging set has its frames detected and stored on it (_framed).

Parameters:

Name Type Description Default
source str or object

The object to read, by name or as the object itself.

required
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

transform
transform(source: Any, shapes: Any, *, records: Sequence[int] | None = None, modes: Sequence[int] | None = None, name: str | None = None) -> str

Transform a record's channels through a shape set to modal coordinates (Transform to Modal Coordinates), one record per mode and quantity at M1 … Mn.

The motions are transformed as q = Φ⁺u and the forces as Φᵀf. It is a change of coordinates only: the set's frequencies, damping and masses are not used (for the response a mode makes to forces, see compute_modal_responses). Any shape set can be used; with the six rigid-body shapes of a geometry this is the virtual point transformation. The result is linked into the record's group when a shape set there has every mode it names, and is otherwise in no group. Its provenance names both the record and the shape set, and its transform_report says what was shared, what was dropped and what was left unexplained. A source that is not a data object, or shapes that is not a shape set, raises TypeError.

Parameters:

Name Type Description Default
source str or object

The time history, by name or as the object itself.

required
shapes str or object

The shape set to transform through, by name or as the object.

required
records sequence of int

Which of the record's channels to use, the ones picked in the tree. All of them when omitted.

None
modes sequence of int

Which of the set's modes to transform to, by index from zero, the ones picked in the tree. Every mode when omitted.

None
name str

What to call the result. Defaults to the record's name followed by 'Modal Coordinates'.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

expand
expand(source: Any, shapes: Any, *, records: Sequence[int] | None = None, tolerance: float = 0.02, distance: float | None = None, name: str | None = None) -> str

Expand modal responses through a shape set back to physical responses (Expand to Physical Responses): u = Φq at every DOF the shape set covers.

Modal FRFs with a channel table in place of the set give the physical FRFs between the table's channels instead: each response and monitor channel against each reference channel, through the set the modal FRFs are of (modal_basis). Each row answers in what its channel measures, turned from the modal FRFs' quantity by (iω)^p; a strain channel is a gauge on the model the set was solved on (gauge_strains), its strain per force turned as a displacement is. When the set and the table are each linked to a geometry and the geometries differ, the shapes are taken at the channels as Project onto Basis DOFs takes them, nearest node within tolerance; otherwise the set's own DOFs are read. A channel the shapes do not reach is dropped, and the result's transform_report names it. The result is linked into the table's group.

The result is linked into the shape set's group, so it animates on that group's geometry. Expanding some of the modes gives their contribution alone, and the result's name lists them.

Parameters:

Name Type Description Default
source str or object

The modal time history, by name or as the object itself.

required
shapes str or object

The shape set it was transformed through, by name or as the object.

required
records sequence of int

Which modal records to expand, the modes picked in the tree. All of them when omitted.

None
tolerance float

With a channel table on another geometry, how far the nearest node may be, as a fraction of the table's geometry's extent (as project_onto_basis).

0.02
distance float

The same as a distance (project_onto_basis); it takes the place of tolerance when given.

None
name str

What to call the result. Defaults to the record's name with 'Modal Coordinates' replaced by 'Physical Responses', and the modes listed in parentheses when not all of them are used; at a channel table, the record's name and '@' the table's.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

channel_frfs
channel_frfs(source: Any, table: Any, *, records: Sequence[int] | None = None, tolerance: float = 0.02, distance: float | None = None) -> Frf

The physical FRFs expand makes from modal FRFs at a channel table's channels, without adding them to the project: what Expand to Physical Responses previews.

Parameters:

Name Type Description Default
source str or object

The modal FRFs, by name or as the object itself.

required
table str or object

The channel table.

required
records sequence of int

Which modal records; all of them when omitted.

None
tolerance float

As expand.

0.02
distance float

As expand.

None

Returns:

Type Description
Frf

The FRFs, their transform_report saying what was used, dropped and skipped, the set they came through and, when the shapes were projected, the projection's report.

Raises:

Type Description
(TypeError, ValueError)

As expand with a channel table.

channel_shapes
channel_shapes(shapes: Any, table: Any, *, tolerance: float = 0.02, distance: float | None = None) -> tuple[ShapeSet, dict]

A shape set at a channel table's DOFs, for the FRFs between its channels (expand with a table).

When the set and the table are each linked to a geometry and the two differ, the shapes are projected onto the channels' DOFs, nearest node within tolerance (core.correlate.project_shapes, as project_onto_basis). Otherwise the set is returned as it is, to be read at its own DOFs.

Parameters:

Name Type Description Default
shapes str or object

The shape set.

required
table str or object

The channel table.

required
tolerance float

How far the nearest node may be, as a fraction of the table's geometry's extent.

0.02
distance float

The same as a distance (project_onto_basis); it takes the place of tolerance when given.

None

Returns:

Type Description
tuple of (ShapeSet, dict)

The set to read, and the projection's report ('matched', 'total', 'worst', 'limit', 'dropped', 'pairs', 'unmatched'), empty when the set's own DOFs are read.

gauge_strains
gauge_strains(shapes: Any, table: Any, *, channels: Iterable[int] | None = None, modes: Sequence[int] | None = None, tolerance: float = 0.02, distance: float | None = None) -> tuple[ndarray, list[str], dict]

The strain each strain channel of a channel table reads in each mode of a shape set solved on a model of solids: a gauge at the channel's node, along its direction in the node's displacement frame (core.element_shapes.gauge_strains).

When the set and the table are each linked to a geometry and the two differ, each channel's node is matched to the model's nearest node within tolerance, as Project onto Basis DOFs matches it (core.correlate.project_shapes), and the channel's direction is taken on the table's geometry. A channel with no node in reach is dropped and named in the report.

Parameters:

Name Type Description Default
shapes str or object

The solved shape set, linked with its model.

required
table str or object

The channel table; its channels of type strain are read.

required
channels iterable of int

Rows of the table (0-based) to read, of those measuring strain. Every strain channel when omitted.

None
modes sequence of int

The set's modes, by index from 0. Every mode when omitted.

None
tolerance float

How far the nearest node may be, as a fraction of the table's geometry's extent (as project_onto_basis).

0.02
distance float

The same as a distance; it takes the place of tolerance.

None

Returns:

Type Description
tuple of (numpy.ndarray, list of str, dict)

The strains (modes, channels read), per unit modal coordinate; each read channel's DOF; and a report: 'nodes', each read channel's model node, and 'dropped', the strain channels with no node in reach.

drive_points
drive_points(table: Any) -> list[str]

The DOFs a channel table says a force is applied at: its reference channels that measure force, in the table's order, each DOF once.

Parameters:

Name Type Description Default
table str or object

The channel table.

required

Returns:

Type Description
list of str

The DOFs, such as '101Z+'.

driven_modes
driven_modes(source: Any, drive: str | None = None, *, table: Any = None, records: Sequence[int] | None = None, tolerance: float = 0.02, distance: float | None = None) -> tuple[str, Any]

Each modal coordinate's response to a unit force at one DOF, from modal FRFs and the shape set they are of (modal_basis): what the operating deflection shape of modal FRFs is made from (deform.modal_ods_deflection).

Parameters:

Name Type Description Default
source str or object

The modal FRFs.

required
drive str

The DOF the force is at. Left out, the one force reference of table.

None
table str or object

A channel table. Its force reference is the drive when drive is left out, and when the table and the shape set are linked to different geometries the set is read at the drive as channel_shapes reads it, at the nearest node.

None
records sequence of int

Which modal records; all of them when omitted. Leaving the rigid-body modes' records out gives the elastic response.

None
tolerance float

As channel_shapes.

0.02
distance float

As channel_shapes.

None

Returns:

Type Description
tuple of (str, DrivenModes)

The shape set's name, and the modal coordinates per unit force (core.modal_frf.DrivenModes).

Raises:

Type Description
(TypeError, ValueError)

If the source is not modal FRFs with a shape set behind them, neither a drive nor a table is given, the table has no force reference or more than one and no drive is named, or the set does not cover the drive.

author_specification
author_specification(source: Any, draft: Any, *, name: str | None = None, replace: bool = False) -> str

Write a specification from a sheet (Make Specification in the Specification reading) and add it beside the object the sheet was opened on.

The sheet gives autospectra at breakpoints, each cross term as a coherence and phase, and the limit bands in decibels. It can be opened on a shape set (the specification is then at the set's modal coordinates, ready to expand through it), on a channel table (at its control channels) or on a specification. A pair the sheet does not state is left out of the result; nothing is assumed for it.

With replace, the sheet is written into the specification it was opened from, under that specification's name, so its links and report slots still hold. A sheet that spans several specifications is written into each of them. A sheet holding every channel of a specification replaces it in the sheet's form, with the sheet's breakpoints or lines. A sheet holding some of the channels is merged back at the specification's own lines, and the other channels are unchanged. Replacing an object that is not a specification raises TypeError.

Parameters:

Name Type Description Default
source str, object, or list of str

The object the sheet was opened on, by name or as the object, or the specifications' names when the sheet spans several.

required
draft SpecificationDraft or dict

What the author stated (core.author), or its dict form.

required
name str

What to call the result. Defaults to the source's name followed by 'Specification'.

None
replace bool

Write the sheet into source (a specification, or several) in place.

False

Returns:

Type Description
str

The name the result was added under, unique within the project (a name already taken gets a numbered suffix). With replace, the source's own name, or the first of them when there are several.

generate_rigid_body_modes
generate_rigid_body_modes(source: Any, *, point: Sequence[float] | None = None, mass: float | None = None, inertia: Sequence[float] | None = None, name: str | None = None) -> str

Generate the six rigid-body mode shapes of a geometry (Generate Rigid Body Mode Shapes): three translations and three rotations about its reference point, as a shape set in the geometry's group.

The reference point, and the mass and inertia that mass-normalize the shapes, are the geometry's mass_properties, set in the rigid-body view. When none are set, unit shapes about the centroid are used, which is the case the virtual point transformation needs most often. Those properties are then stored on the geometry, so the result's provenance records what was used. An object that is not a geometry raises TypeError.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
point sequence of float

The reference point in meters, which replaces the geometry's mass_properties. Without it they stay as they are.

None
mass float

The mass in kg about point; with inertia, for mass-normalized shapes.

None
inertia sequence of float

The tensor's six terms about point in kg m^2 (core.rigid.INERTIA_TERMS).

None
name str

What to call the result. Defaults to the geometry's name followed by 'Rigid Body Modes'.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

generate_signal
generate_signal(source: Any, kind: str = 'random', *, name: str | None = None, progress: Any = None, **settings: Any) -> str

Generate a reference signal from a spectrum, a sine specification, a shock specification or a channel table (Generate Signal), as a time history in the source's group.

A spectrum gives random, burst random or periodic random at its DOFs, drawn to it; a sine specification gives its tone; a shock specification gives a shock synthesized to its spectrum and checked against the shaker's shock ratings given (core.shock_synthesis); a channel table gives the random kinds at its reference channels, to a typed flat band and level, or an impulse or a classical pulse (core.signals). The settings are recorded with the result, and the random seed with them (one is drawn when none is given), so Recompute makes the same record again.

project.generate_signal('Requirement', 'srs',
                        sample_rate=20480.0, stroke=0.0508,
                        velocity=1.78)

Parameters:

Name Type Description Default
source str or object

The spectrum, sine specification, shock specification or channel table, by name or as the object itself.

required
kind str

One of core.signals.KINDS: 'random', 'burst', 'periodic', 'impulse', 'pulse', 'sine' or 'srs'.

'random'
name str

What to call the result. Defaults to the source's name and the kind.

None
progress callable

Called with (done, total) as an SRS synthesis iterates; the app's progress bar uses it.

None
**settings Any

The fields of core.signals.SignalSettings: duration, sample_rate, frame_length, seed, correlated, dofs, bursts, burst, taper, periods, repeats, at, area, shape, peak, pulse_duration, edge, band, level, tone, and for an SRS synthesis half_cycles and the shaker's stroke, velocity, force, moving_mass and body_mass in SI.

{}

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

Raises:

Type Description
TypeError

If a setting is not one SignalSettings has.

ValueError

If the kind is not one the source makes, or as the signal's generator refuses (a band at or above the Nyquist frequency, units not declared, no reference channel, a shock spectrum no synthesis meets or no synthesis the shaker can hold).

compute_modal_responses
compute_modal_responses(source: Any, shapes: Any, *, quantity: str = 'acceleration', modes: Sequence[int] | None = None, records: Sequence[int] | None = None, name: str | None = None) -> str

Compute how each mode of a shape set answers the forces in a time history or a force CPSD, as a new object (Compute Modal Responses).

The history's force channels are made modal through the set (pᵣ = Σ φₖᵣ fₖ; channels already holding the set's modal forces are used as they are), and each mode's equation is solved exactly for a force linear between samples, from rest (core.modal_response). The result holds one record per mode, M1 … Mn, each comment naming the set, on the history's time axis with its averaging and shock windows. It is linked into the history's group, and the history itself is not changed; merge puts the forces and the responses back in one object.

A force CPSD is made modal the same way, S_pp = Φᵀ S_ff Φ, and each mode answers it through its own frequency response, giving the modal response CPSD with every picked mode against every other (core.modal_response.modal_response_density). The CPSD needs every cross term between the drives, as Transform does; terms stored as zero, drives that are uncorrelated, are terms. expand takes the result to the set's DOFs, where it is the response density the synthesized FRFs give.

Parameters:

Name Type Description Default
source str or object

The time history or force CPSD, by name or as the object itself.

required
shapes str or object

The shape set: real modes with frequency, damping and modal mass, by name or as the object itself.

required
quantity str

'displacement', 'velocity' or 'acceleration' of each modal coordinate.

'acceleration'
modes sequence of int

Which modes, by index in the set from zero; all of them when omitted.

None
records sequence of int

Which of the source's records are the forces; every force record when omitted.

None
name str

What to call the result. Defaults to the source's name followed by 'Modal Responses'.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

Raises:

Type Description
TypeError

If source is neither a time history nor a CPSD, or shapes not a shape set.

ValueError

As core.modal_response.modal_responses: no force on a DOF the set covers, a complex set, a mode not in the set, uneven sampling, or a quantity it does not know; for a CPSD, also a missing cross term between the drives or a density on proportional bands.

synthesize_modal_frfs
synthesize_modal_frfs(shapes: Any, *, sample_rate: float, frame_length: int, quantity: str = 'acceleration', modes: Sequence[int] | None = None, name: str | None = None) -> str

Synthesize each mode's own FRF from a shape set (Synthesize Modal FRFs), as a new object beside the set.

Each record is one mode's modal coordinate per unit modal force, at M1 ... Mn against itself, from the mode's frequency, damping and modal mass (core.modal_frf). The lines are those of a test's frame: every sample_rate / frame_length Hz from 0 Hz to the Nyquist frequency. Modes above the Nyquist frequency are kept. Expand to Physical Responses takes the result back to physical FRFs through the set, or at a channel table's channels.

Parameters:

Name Type Description Default
shapes str or object

The shape set, by name or as the object itself.

required
sample_rate float

The sample rate the lines follow from, in Hz.

required
frame_length int

Samples in a frame.

required
quantity str

The response per modal force: 'displacement', 'velocity' or 'acceleration'.

'acceleration'
modes sequence of int

Which modes, by index in the set from zero; all of them when omitted.

None
name str

What to call the result. Defaults to the set's name followed by 'Modal FRFs'.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

Raises:

Type Description
TypeError

If shapes is not a shape set.

ValueError

As core.modal_frf.synthesize_modal_frfs: a complex set, a mode not in the set, a quantity it does not know, or a sample rate or frame length that gives no lines.

merge_coincident_nodes
merge_coincident_nodes(source: Any, tolerance: float | None = None, groups: Sequence[int] | None = None, exclude: Sequence[int] | None = None) -> dict

Merge each set of a geometry's coincident nodes into one node (Merge Coincident Nodes). Elements are reconnected to the lowest node id at each point, and the other nodes are removed.

Plates are connected only where they share nodes, so this is what ties together planes meshed separately, along the lines where they meet.

With groups, only the nodes used by those element groups' elements are merged. The app offers the merge only on element groups picked in the tree, never on the whole geometry, because merging every coincident node in a model ties together parts that were meant to stay separate. With groups left out, the whole geometry is merged.

While an object linked with the geometry names a node the merge would remove, the merge raises ValueError, since that object's data would refer to a node that no longer exists. Merge first, then measure or solve. An object that is not a geometry raises TypeError.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
tolerance float

How close two nodes must be to be merged, in meters (the geometry holds its coordinates in meters). Defaults to a millionth of the diagonal of the geometry's extent.

None
groups sequence of int

The element groups whose nodes are merged, by id. Every node of the geometry when omitted.

None
exclude sequence of int

Nodes left out of the merge, by id: the places deselected in the app's pane before Merge was pressed.

None

Returns:

Type Description
dict

'merged', the nodes removed, 'into', the nodes they became, 'duplicates', the elements removed for filling a cell another already filled, and 'links', the line elements removed for joining nodes that became one (Geometry.merge_collapses).

align_meshes
align_meshes(source: Any, reach: float | None = None, groups: Sequence[int] | None = None, exclude: Sequence[int] | None = None) -> dict

Move the coarser mesh's nodes onto the finer mesh's nodes where parts meshed separately meet or overlap (Align Meshes), so Merge Coincident Nodes can join them next.

Each node of the coarser piece within reach of the finer piece's surface is moved onto its nearest node there (Geometry.align_moves). The app offers this on element groups picked in the tree, as it does the merge. While an object linked with the geometry names a node that would move, this raises ValueError, since that object's data was measured or solved where the node was.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
reach float

How far a node may move, in meters (the geometry holds its coordinates in meters). Defaults to half the coarsest piece's spacing (Geometry.align_reach).

None
groups sequence of int

The element groups whose pieces are aligned, by id. Every element of the geometry when omitted.

None
exclude sequence of int

Nodes left out, by id: the moves deselected in the app's pane before Align was pressed, both nodes of each.

None

Returns:

Type Description
dict

'moved', how many nodes moved; 'farthest', the longest move, in meters.

new_geometry
new_geometry(name: str = 'Geometry', *, unit: str = 'm') -> str

Add an empty geometry to build a model in (the project's + button). Its parts are added as solids (add_solid_plate, add_solid_block and the rest) and meshed with mesh_solids, and links in the app's add mode.

Parameters:

Name Type Description Default
name str

What to call it.

'Geometry'
unit str

Its length unit. Coordinates are held in SI either way; the geometry records this as the unit it was built in.

'm'

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

new_channel_table
new_channel_table(name: str = 'Channel Table') -> str

Add an empty channel table to fill in by hand (the project's New Channel Table). Channels are added with add_channels, and their cells are typed in the app or set with set_cell.

Parameters:

Name Type Description Default
name str

What to call it.

'Channel Table'

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

add_channels
add_channels(source: Any, count: int = 1) -> list[int]

Add blank channels to a channel table, numbered on from its highest channel.

Parameters:

Name Type Description Default
source str or ChannelTable

The channel table, by name or as the object itself.

required
count int

How many channels to add.

1

Returns:

Type Description
list of int

The new channels' numbers.

Raises:

Type Description
TypeError

If the object is not a channel table.

set_view
set_view(source: Any, view: View | None = None) -> None

Set the view a geometry opens on in 3-D, in the app, the report and every exported figure.

In the app, Set Default View captures the view on screen; from a script the view is given, for example a model built Y-up seen from the front and above. Everything drawn on the geometry (its shapes, an ODS, the DOF arrows) opens on this view too, and Reset View returns to it. The nodes are not rotated; only the viewing direction changes. An object that is not a geometry, or a view that is not a View, raises TypeError.

Parameters:

Name Type Description Default
source str or Geometry

The geometry, by name or as the object itself.

required
view View

Where the eye is, seen from the model's center, and which way is up. None returns to the default isometric view (from +X+Y+Z, Z up).

None

Returns:

Type Description
None

Examples:

>>> from hertzforge import View
>>> project.set_view('BARC', View(eye=(1, 1, -1), up=(0, 1, 0)))
tie_elements
tie_elements(source: Any, elements: Any, to: Any, group: str | None = None) -> dict

Tie a patch of a geometry's elements rigidly to the part under it (Tie), as for a bolted joint modeled from the elements its washer covers.

Each node of the patch is joined by a rigid, massless link to the nearest node of to (mesh.tie).

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
elements sequence of int

The patch, by element id.

required
to str, int or sequence of int

An element group, by name or id, or a second patch, by element ids.

required
group str

The element group the links go into, made rigid if new. Defaults to the geometry's first rigid element group, or a new one named 'ties'.

None

Returns:

Type Description
dict

'links', how many were added; 'shared', patch nodes the target already holds; 'group', where the links went.

merge_groups
merge_groups(source: Any, groups: Any) -> dict

Merge a geometry's element groups into one (Merge Element Groups). The first group keeps its id, name and properties, and the other groups' elements move into it.

The merge is refused unless the groups hold the same element types and have the same material and thickness or section (Geometry.merge_refusal).

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
groups sequence of int

The element groups, by id; the first is the one kept.

required

Returns:

Type Description
dict

'into', the element group kept; 'groups', how many merged into it; 'elements', how many elements moved.

add_solid_block
add_solid_block(source: Any, center: Any, widths: Any, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, corner: float = 0.0, unit: str = 'm') -> int

Add a block to a geometry's solids (core.solids). A solid is a shape to build a part from and mesh later; it adds no elements.

The block is widths across along its own axes, centered at center and rotated by angles.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Three numbers each, in unit.

required
widths array_like

Three numbers each, in unit.

required
angles array_like

Degrees about the geometry's X, then Y, then Z axes.

(0, 0, 0)
name str

What to call it.

''
corner float

The radius its four edges along its own Z are rounded to, in unit. A window cut with a rounded block leaves fillets.

0
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_cylinder
add_solid_cylinder(source: Any, center: Any, radius: float, length: float, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, unit: str = 'm') -> int

Add a cylinder to a geometry's solids (core.solids), of radius about its own axis and length along it, centered at center.

With no angles its axis is the geometry's Z. A cylinder subtracted from a part (combine_solids) makes a hole.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Three numbers, in unit.

required
radius float

In unit.

required
length float

In unit.

required
angles array_like

Degrees about the geometry's X, then Y, then Z axes.

(0, 0, 0)
name str

What to call it.

''
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_cone
add_solid_cone(source: Any, center: Any, base_radius: float, top_radius: float, height: float, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, unit: str = 'm') -> int

Add a cone to a geometry's solids (core.solids.add_cone): a frustum height along its own axis, base_radius at its base and top_radius at its top, either zero for a point, centered at center.

With no angles its axis is the geometry's Z, its base below. Bricks are fitted to it, since no sweep makes a cone.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Three numbers, in unit.

required
base_radius float

In unit.

required
top_radius float

In unit.

required
height float

In unit.

required
angles array_like

Degrees about the geometry's X, then Y, then Z axes.

(0, 0, 0)
name str

What to call it.

''
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_sphere
add_solid_sphere(source: Any, center: Any, radius: float, name: str = '', *, unit: str = 'm') -> int

Add a sphere to a geometry's solids (core.solids.add_sphere), radius about center. Bricks are fitted to it.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Three numbers, in unit.

required
radius float

In unit.

required
name str

What to call it.

''
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_plate
add_solid_plate(source: Any, center: Any, widths: Any, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, unit: str = 'm') -> int

Add a plate to a geometry's solids (core.solids.add_plate): a flat rectangle widths across along its own X and Y, centered at center.

With no angles it lies in the geometry's XY plane. A plate has no thickness of its own: it is meshed into plates (mesh_solids with shells), and their element group takes the thickness. A cylinder subtracted from it (combine_solids) makes a hole.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Three numbers, in unit.

required
widths array_like

Two numbers, in unit: along its own X, then Y.

required
angles array_like

Degrees about the geometry's X, then Y, then Z axes.

(0, 0, 0)
name str

What to call it.

''
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_disk
add_solid_disk(source: Any, center: Any, radius: float, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, unit: str = 'm') -> int

Add a disk to a geometry's solids (core.solids.add_disk): a flat circle of radius in its own XY plane, centered at center.

With no angles it lies in the geometry's XY plane. As a plate's, its thickness is set on the element group it is meshed into (mesh_solids with shells).

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Three numbers, in unit.

required
radius float

In unit.

required
angles array_like

Degrees about the geometry's X, then Y, then Z axes.

(0, 0, 0)
name str

What to call it.

''
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_section
add_solid_section(source: Any, shape: str, center: Any, dimensions: Any, length: float, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, unit: str = 'm') -> int

Add a structural section to a geometry's solids (core.solids.add_section): an I-beam, channel, tee, angle, rectangular tube or round tube, length along its own axis.

It is sized by its own dimensions, which edit_solid can change later.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
shape str

One of core.solids.SECTIONS: 'I-beam', 'channel', 'tee', 'angle', 'rectangular tube' or 'round tube'.

required
center array_like

Three numbers, in unit: the center of the box it fills.

required
dimensions sequence of float

In unit, in the order SECTIONS[shape] names them. For an I-beam these are the depth, flange width, flange thickness and web thickness, the same as the beam element's section.

required
length float

In unit.

required
angles array_like

Degrees about the geometry's X, then Y, then Z axes. With none it runs along Z.

(0, 0, 0)
name str

What to call it.

''
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

add_solid_hole
add_solid_hole(source: Any, center: Any, diameter: float, depth: float | None = None, angles: Any = (0.0, 0.0, 0.0), name: str = '', *, counterbore: Any = None, unit: str = 'm') -> int

Add a hole to a geometry's solids (core.solids.add_hole), to be subtracted from a part with combine_solids.

The hole enters at center and runs depth along its own -Z, or through the part it is cut from when depth is None. A counterbore makes it wider at the entry.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
center array_like

Where it enters, three numbers in unit.

required
diameter float

In unit.

required
depth float

In unit. None for a through hole.

None
angles array_like

Degrees about the geometry's X, then Y, then Z axes. With none it runs down Z.

(0, 0, 0)
name str

What to call it.

''
counterbore (float, float)

Its diameter and depth, in unit.

None
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
int

The solid's id.

delete_elements
delete_elements(source: Any, ids: Any) -> dict

Delete a geometry's elements and the nodes only they used, except nodes where data in the project is measured or solved (Geometry.delete_elements).

Deleting a meshed part's bricks removes its nodes, while deleting a test geometry's panels leaves its measurement points.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The elements, by id.

required

Returns:

Type Description
dict

'elements' and 'nodes', how many were deleted.

delete_element_groups
delete_element_groups(source: Any, ids: Any) -> dict

Delete a geometry's element groups with their elements and the nodes only they used, except nodes where data in the project is measured or solved (Geometry.delete_groups).

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The element groups, by id.

required

Returns:

Type Description
dict

'groups', 'elements' and 'nodes', how many were deleted.

edit_solid
edit_solid(source: Any, solid_id: int, *, center: Any = None, widths: Any = None, angles: Any = None, radius: Any = None, length: Any = None, corner: Any = None, counts: Any = None, spacing: Any = None, dimensions: Any = None, name: Any = None, top_radius: Any = None, unit: str = 'm') -> None

Change a solid after it is made (core.solids.edit). Anything not given is kept.

The values that can be changed are a block's center, widths, angles and corner; a cylinder's center, radius, length and angles; a cone's center, radius (at its base), top radius, length (its height) and angles; a sphere's center and radius; a plate's center, widths and angles; a disk's center, radius and angles; a section's center, dimensions, length and angles; a hole's center, dimensions and angles; a pattern's counts and spacing; and any solid's name. A boolean the solid is part of changes with it. A mesh made from it does not, until Mesh Solids meshes it again.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
solid_id int

Which solid.

required
center optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
widths optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
angles optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
radius optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
length optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
corner optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
name optional

As add_solid_block and add_solid_cylinder take them, lengths in unit.

None
counts optional

As pattern_solids takes them.

None
spacing optional

As pattern_solids takes them.

None
top_radius float

A cone's, in unit.

None
dimensions sequence of float

A section's, as add_solid_section takes them, or a hole's: its diameter, its depth (zero for a through hole) and its counterbore's diameter and depth (zeros for none), in unit.

None
unit str

The unit the lengths are in. A geometry whose units are not defined takes them as given.

'm'

Returns:

Type Description
None
move_solids
move_solids(source: Any, ids: Any, offset: Any = (0.0, 0.0, 0.0), turn: Any = (0.0, 0.0, 0.0), *, unit: str = 'm') -> int

Move whole solids (core.solids.move): a part and every solid it is made of, rotated by turn about the center of their extent and then translated by offset.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The solids, by id.

required
offset array_like

The translation, in unit.

(0, 0, 0)
turn array_like

Degrees about the geometry's X, then Y, then Z axes.

(0, 0, 0)
unit str

The unit the offset is in. A geometry whose units are not defined takes it as given.

'm'

Returns:

Type Description
int

How many primitive solids moved (blocks, cylinders, sections and holes).

combine_solids
combine_solids(source: Any, operation: str, ids: Any, name: str = '') -> int

Add a boolean of a geometry's solids: 'union', 'subtract' (the others subtracted from the first) or 'intersect'.

The solids combined become part of the new solid, and only the new solid is listed as a part. A solid already part of another boolean is refused.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
operation str

'union', 'subtract' or 'intersect'.

required
ids sequence of int

Two or more solids, by id, in order.

required
name str

What to call it. Defaults to the first solid's name.

''

Returns:

Type Description
int

The new solid's id.

reorder_solids
reorder_solids(source: Any, ids: Any, *, within: int | None = None) -> None

Put a geometry's solids in a new order (a drag in the tree): its parts, or with within one boolean's own solids. A subtraction cuts every solid after its first from the first, so the order decides what is cut (core.solids.reorder).

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

Every one of the solids being ordered, in the new order.

required
within int

The boolean or pattern whose solids these are; the parts when omitted.

None

Returns:

Type Description
None

The geometry is changed in place.

copy_solids
copy_solids(source: Any, ids: Any, *, into: Any = None) -> list[int]

Copy a geometry's solids, recipe and all, into the same geometry or another (Copy and Paste on solid rows). Returns the new top-level ids.

A boolean or a pattern is copied with every solid it is made of (core.solids.copy), so the copy is edited on its own. A named solid's copy is ' copy'.

Parameters:

Name Type Description Default
source str or object

The geometry the solids are in, by name or as the object.

required
ids sequence of int

The solids, by id.

required
into str or object

The geometry the copies go into; the same one when omitted. Both geometries hold their coordinates the same way, with units defined or not, or the copy is refused.

None

Returns:

Type Description
list of int

The new solids' ids, in the order of ids.

pattern_solids
pattern_solids(source: Any, ids: Any, counts: Any, spacing: Any, *, unit: str = 'm') -> int

Pattern a geometry's solids in rows, columns and layers (Pattern): counts along X, Y and Z, the originals included, spacing apart.

The pattern is one solid made from the originals (core.solids.pattern), so changing an original changes every copy. Its counts and spacing are changed with edit_solid.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The solids to copy, by id.

required
counts sequence of int

How many along X, Y and Z.

required
spacing sequence of float

How far apart along X, Y and Z, in unit.

required
unit str

The unit the spacing is in. A geometry whose units are not defined takes it as given.

'm'

Returns:

Type Description
int

The pattern's id.

mesh_solids
mesh_solids(source: Any, ids: Any, size: float | None = None, *, unit: str = 'm', apart: bool = False, parts_apart: bool = False, elements: str = 'hexes', progress: Any = None, sizes: Any = None) -> dict

Mesh a geometry's solids into bricks, tetrahedra or shells (Mesh Solids). Each part becomes an element group named for it.

With elements 'hexes', parts that are an extrusion along X, Y or Z are meshed on one grid cut at every flat face, with their holes rounded (core.solids.extrusion_mesh); a union that is no extrusion in pieces, each operand swept where it is one and fitted where it is not, at its own size, joined where the grids meet and tied at the seams where they do not; and any other shape on a grid fitted to it (core.hexmesh.overlay_mesh); core.solids.brick_mesh picks. With 'tetras', the parts are meshed into ten-node tetrahedra from their recipe's signed distance (core.tetmesh.tet_mesh). With 'quads' or 'triangles' they are meshed into shells (core.shells.shell_mesh): a plate or a disk, with what is cut from it, on its plane, and a solid with a volume on its outer surface, the surface of its bricks for quads and of its tetrahedra for triangles; the thickness is set on the element group. A plate or a disk is meshed into shells only. Parts meshed together share nodes where they touch. The solids are kept so they can be meshed again, and a part meshed again replaces its earlier mesh: the elements of the element group it was meshed into (Geometry.group_solids) are deleted, and the group, its name and its material are kept.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The parts, by id: solids no other solid uses.

required
size float

The target element size, in unit. Defaults to half the thinnest feature (core.solids.mesh_size; a plate's or a disk's measured across its plane, core.shells.mesh_size).

None
unit str

The unit the size is in. A geometry whose units are not defined takes it as given.

'm'
apart bool

Join the bricks only to nodes of their own element groups (mesh.join), so a part meshed beside an existing one keeps nodes of its own where they touch.

False
parts_apart bool

Give each part meshed here its own nodes where the parts touch each other. They are still on one grid, so their nodes coincide and can be merged later where bolts go. Bricks only.

False
elements ('hexes', 'tetras', 'quads', 'triangles')

The element type, as the tree names the families; 'bricks' and 'tets' are taken to mean the same. 'quads' and 'triangles' are shells.

'hexes'
progress callable

Called with (done, total) as the mesh goes (core.solids.extrusion_mesh, core.tetmesh.tet_mesh). The app's progress bar uses it; a script can print it.

None
sizes mapping of int to float

A size per piece of a union meshed in pieces, by solid id, in unit; a piece without one takes size. Bricks only.

None

Returns:

Type Description
dict

For bricks, what brick_mesh gives, 'method' included (in pieces, 'pieces' lists each piece's readings, 'seam_shared' the nodes shared at the seams, 'ties' the nodes joined there by rigid links and 'seams' the mated surfaces that join them); for tetrahedra, 'tets', 'nodes', 'steps', 'quality', 'poor', 'slivers' and 'shortest' as tet_mesh gives them; for shells, what shell_mesh gives; and every way 'added', 'shared' and 'groups' as mesh.join gives them, 'replaced', how many elements of the parts' earlier mesh were replaced, 'mates_dropped', how many mated surfaces on that mesh went with it, and 'cleared', {group name: what was taken off it} for each group the solids went into that carried a section, a thickness or an orientation (solids take a material alone, which is kept).

detect_mated_surfaces
detect_mated_surfaces(source: Any, groups: Any = None, tolerance: float | None = None, *, unit: str = 'm') -> list[dict]

The patches where element groups' surfaces mate (core.mates.detect): the nodes on one group's outer faces that lie on another's, within tolerance, one patch per connected piece. The finer side is the first, and follows.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
groups sequence of int or str

The element groups, by id or name; every group of plates or solids when omitted.

None
tolerance float

How far a node may be from the other's faces, in unit; a millionth of the geometry's size when omitted.

None
unit str

The unit the tolerance is in.

'm'

Returns:

Type Description
list of dict

Each patch's 'groups' (first side's and second side's ids), 'nodes_a' and 'nodes_b'.

add_mated_surfaces
add_mated_surfaces(source: Any, groups: Any, nodes_a: Any, nodes_b: Any, *, normal_mode: str = 'rigid', shear_mode: str = 'rigid', normal_stiffness: float = 0.0, shear_stiffness: float = 0.0, name: str | None = None) -> int

Join two element groups where their surfaces mate (Mate Surfaces): when a model is built, each of nodes_a is tied to the nearest of nodes_b, along the normal of the surface it lies on and in that surface's plane, each held rigidly, by a stiffness or not at all (fem.Model.add_tie). The set is kept on the geometry (geometry.mates), to be edited or deleted later.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
groups (int or str, int or str)

The first side's element group and the second's, by id or name.

required
nodes_a sequence of int

The first side's nodes, which follow, and the second's.

required
nodes_b sequence of int

The first side's nodes, which follow, and the second's.

required
normal_mode ('rigid', 'stiffness', 'free')

How the normal and the plane are held.

'rigid'
shear_mode ('rigid', 'stiffness', 'free')

How the normal and the plane are held.

'rigid'
normal_stiffness float

Each node's stiffness along the normal and in the plane, in N/m, where its mode is 'stiffness'.

0.0
shear_stiffness float

Each node's stiffness along the normal and in the plane, in N/m, where its mode is 'stiffness'.

0.0
name str

What to call the set; "first on second" when omitted.

None

Returns:

Type Description
int

The set's id.

mate_surfaces
mate_surfaces(source: Any, groups: Any = None, tolerance: float | None = None, *, unit: str = 'm', normal_mode: str = 'rigid', shear_mode: str = 'rigid', normal_stiffness: float = 0.0, shear_stiffness: float = 0.0) -> list[int]

Join every patch where the element groups' surfaces mate, as found (detect_mated_surfaces), one set each (add_mated_surfaces).

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
groups sequence of int or str

The element groups; every group of plates or solids when omitted.

None
tolerance float

As detect_mated_surfaces takes it, in unit.

None
unit str

The unit the tolerance is in.

'm'
normal_mode str

As add_mated_surfaces takes them.

'rigid'
shear_mode str

As add_mated_surfaces takes them.

'rigid'
normal_stiffness str

As add_mated_surfaces takes them.

'rigid'
shear_stiffness str

As add_mated_surfaces takes them.

'rigid'

Returns:

Type Description
list of int

The sets' ids. None found raises ValueError.

edit_mated_surfaces
edit_mated_surfaces(source: Any, mate_id: int, **fields: Any) -> None

Change a set of mated surfaces: its name, nodes_a, nodes_b, normal_mode, shear_mode, normal_stiffness or shear_stiffness (core.mates.change), refused as add_mated_surfaces refuses.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
mate_id int

The set.

required
**fields Any

The fields to change, stiffnesses in N/m.

{}

Returns:

Type Description
None
delete_mated_surfaces
delete_mated_surfaces(source: Any, ids: Any) -> int

Delete sets of mated surfaces, by id; returns how many went.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The sets.

required

Returns:

Type Description
int
delete_solids
delete_solids(source: Any, ids: Any) -> int

Delete a geometry's solids, each with every solid it is made of (core.solids.delete).

A solid that a boolean still uses is refused unless the boolean is deleted with it.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The solids, by id.

required

Returns:

Type Description
int

How many solids were deleted, the ones inside included.

separate_solids
separate_solids(source: Any, ids: Any) -> int

Take a geometry's booleans and patterns apart (Take Apart). Each one is removed, and its operands are parts again (core.solids.separate).

A primitive solid, or one that is still part of another, is refused.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
ids sequence of int

The booleans or patterns, by id.

required

Returns:

Type Description
int

How many solids are parts again.

solve_modes
solve_modes(source: Any, *, maximum_frequency: float | None = None, num_modes: int | None = None, damping: float = 0.0, name: str | None = None, progress: Any = None) -> str

Solve the normal modes of a geometry whose element groups have properties (Solve Modes). The shapes are added in the geometry's group.

The finite element model is built from the geometry (fem.Model.from_geometry). Each element group has a material and a thickness or a section (fem.GroupProperties, set in the Element Groups table or on geometry.group_properties); each quad becomes a plate element, each triangle a triangular plate element and each two-node line a beam. Unless a group of points is ground, the model is solved free-free, so the six rigid-body modes come back at 0 Hz, followed by the elastic modes. A geometry with no element group properties raises ValueError.

Parameters:

Name Type Description Default
source str or object

The geometry, by name or as the object itself.

required
maximum_frequency float

Solve for every mode up to this frequency, in Hz.

None
num_modes int

Solve for this many modes instead, rigid-body modes included.

None
damping float

The fraction of critical damping given to every mode. A finite element model has no damping of its own.

0.0
name str

What to call the result. Defaults to the geometry's name with ' Modes' after it.

None
progress callable

Called with (done, total) as the solve advances, and with a total of core.progress.BUSY while a stage runs that cannot count itself. The app's progress bar uses it; a script can print it.

None

Returns:

Type Description
str

The name the shape set was added under.

plan_instrumentation
plan_instrumentation(source: Any, triaxial: int, uniaxial: int = 0, *, modes: Any = None, groups: Any = None, surfaces: Any = None, edge_angle: float | None = None, axes: Any = (2,), name: str | None = None, progress: Any = None, edge_distance: float | None = None, unit: str = 'm') -> dict[str, str]

Plan a test's accelerometers from finite element modes, by Effective Independence.

The model's outer surface is split into surfaces at its sharp edges (core.instrumentation.skin), and every place on the surfaces kept a sensor can sit is a candidate, measured in its own system with +Z out of the surface and +X in the plane of a system axis (core.instrumentation.plan). Tri-axial accelerometers are placed first, then uni-axial ones along the surface normal. Three objects are added and linked: the experimental geometry of the chosen places, the channel table, and the modes at exactly those channels.

Parameters:

Name Type Description Default
source str or object

The shape set, by name or as the object itself. It is read on the geometry in its object group, or the active one.

required
triaxial int

How many tri-axial accelerometers.

required
uniaxial int

How many uni-axial accelerometers.

0
modes sequence of int

The modes to measure, by index. Every mode above 0 Hz when omitted.

None
groups sequence of int or str

The element groups sensors may go on, by id or name. All when omitted.

None
surfaces sequence of int

The surfaces sensors may go on, by their number in core.instrumentation.skin. When omitted, every surface of groups of at least 1 % of the outside's area (core.instrumentation.default_surfaces).

None
edge_angle float

Degrees between two neighboring faces' normals beyond which they are on separate surfaces; core.instrumentation.EDGE_ANGLE when omitted. A coarse curved mesh may need more.

None
axes sequence of int

The directions a uni-axial accelerometer may measure, 0, 1, 2 for X, Y, Z of its place: Z, the surface normal, by default.

(2,)
name str

The start of the three names. The shape set's name with ' Plan' after it when omitted.

None
progress callable

Called with (0, core.progress.BUSY) as the work starts, which cannot count its own stages; the app's progress bar uses it.

None
edge_distance float

How near a sensor may be to the edge of its surface, in unit: a sharp edge, a free edge, a hole or where parts touch. A quarter of an inch when omitted (core.instrumentation.EDGE_DISTANCE), and 0 for a geometry whose units are not defined; 0 allows a sensor on the edge.

None
unit str

The unit edge_distance is in. A geometry whose units are not defined takes it as given.

'm'

Returns:

Type Description
dict

The names added, under 'geometry', 'channels' and 'shapes'.

Raises:

Type Description
TypeError

When source is not a shape set.

ValueError

When it has no geometry to plan on, or the plan cannot be made (no sensors, fewer places than sensors, no mode chosen).

Warns:

Type Description
FewerDirectionsWarning

When the sensors measure fewer directions than there are modes: the plan is made for the lowest modes that many, and the shapes kept still hold every mode asked for, so their auto-MAC shows which the sensors cannot tell apart.

convert_to_specification
convert_to_specification(name: Any) -> str

Convert a PSD or CPSD to a specification, the requirement measurements are judged against, keeping its name, object group and every reference to it.

Some formats have no way to mark a requirement (the ESCDF data types do not), so a file can only suggest one by its name, and a name is not evidence. The person who knows marks it here instead. An object that is not a PSD, or is already a specification, raises TypeError.

Parameters:

Name Type Description Default
name str or Psd

The PSD.

required

Returns:

Type Description
str

Its name.

convert_to_psd
convert_to_psd(name: Any, spacing: float | None = None) -> str

Convert a specification to a plain PSD or CPSD, under its own name. This undoes convert_to_specification, and makes a target written on the Specification sheet a CPSD to drive or predict with.

A specification on lines converts as it is. One written at breakpoints is read onto evenly spaced lines at spacing, the sheet's own reading (core.author.read_onto_lines), since a density to drive or predict with is read line by line: one value at each breakpoint would miss everything between them.

A PSD cannot hold warning and abort limits, so a specification's limits are left out; asking for the conversion is asking for that (Specification.limit takes one out as a PSD of its own first). An object that is not a specification raises TypeError.

Parameters:

Name Type Description Default
name str or Specification

The specification.

required
spacing float

The line spacing in Hz, for a specification at breakpoints. Defaults to the spacing its sheet remembers (remembered_spacing); with neither, ValueError is raised, since the spacing is not guessed. Given for a specification already on lines, ValueError is raised.

None

Returns:

Type Description
str

Its name.

remembered_spacing
remembered_spacing(name: Any) -> float | None

The frequency spacing the specification's sheet remembers, in Hz: the spacing of its lines form, or of the lines it was opened from. None when it has none, such as a specification imported at breakpoints.

Parameters:

Name Type Description Default
name str or Specification

The specification.

required

Returns:

Type Description
float or None

The spacing.

scale_family
scale_family(measured: Any) -> list[str]

The measured PSDs that share one comparison scale: the object and every PSD in its object group that is not a specification, such as its source or the octave bands made from it.

The family has one scale because an octave-band PSD is the same measurement on another frequency grid, and two scales for one run would contradict each other.

Parameters:

Name Type Description Default
measured str or Psd

A measured PSD.

required

Returns:

Type Description
list of str

The family's names, measured among them.

comparison_scale
comparison_scale(specification: Any, measured: Any) -> int

The decibels a measured PSD is scaled by when it is compared with a specification. The comparison's plot, bars and report all use this value.

A scale held on any member of the family is used (set_comparison_scale keeps the family equal). Otherwise it is detected on the family's narrowband member, so the same data on octave bands cannot round to a different decibel than the lines it came from.

Parameters:

Name Type Description Default
specification str or Specification

What is compared against.

required
measured str or Psd

The measurement.

required

Returns:

Type Description
int

Whole decibels.

set_comparison_scale
set_comparison_scale(measured: Any, db: int | None) -> list[str]

Hold a comparison scale on a measured PSD and its whole family (scale_family), or with None, go back to detecting it from the data.

The scale is stored on the objects, not on a view, so the report compares exactly what the screen shows and a saved project keeps the choice. The data itself is never changed. A value that is not a whole number raises ValueError.

Parameters:

Name Type Description Default
measured str or Psd

A measured PSD.

required
db int or None

Whole decibels, or None for automatic.

required

Returns:

Type Description
list of str

The PSDs the value was set on.

fit_coherence
fit_coherence(source: Any, records: Sequence[int] | None = None) -> str | None

The coherence the fitting screen weights a fit of source by, or None when no coherence covers any of the fit's response DOFs.

It is the coherence covering the most of those DOFs, and one in the FRF's own object group is chosen in a tie.

Parameters:

Name Type Description Default
source str or Frf

The FRF set being fitted.

required
records sequence of int

The records fitted; every record when omitted.

None

Returns:

Type Description
str or None

The coherence's name, for fit_modes(coherence=...).

fit_modes
fit_modes(source: str, *, bounds: tuple[float, float] | None = None, limit: int = 30, name: str | None = None, at: Sequence[tuple[float, float]] | None = None, refine: int = 0, records: Sequence[int] | None = None, coherence: Any = None) -> str

Fit a modal model to an FRF set, as the fitting screen does.

This runs the screen's loop: confirm the suggested mode, then take the next suggestion, up to limit times. The session's suggestion logic makes every choice (a peak already confirmed is not offered again unless a different shape is found there, as for a repeated pair). On the screen the person stops the loop; here it stops when no peak left in the residual holds a tenth of the measurement at its line (suggest(modes_only=True)), since the rest is what fitted modes left behind, or at limit, and the plate demonstration's cap is a worked example of choosing it. The first suggestion is always taken.

On the screen the zoom does the job of bounds: what is on the plot is what gets searched. A script has no plot, so it gives bounds instead.

Parameters:

Name Type Description Default
source str

The FRF set to fit.

required
bounds tuple of float

(low, high) frequency limits to fit within, in Hz. Defaults to the whole band. Bounds that hold none of the FRF set's lines raise ValueError, rather than fitting the whole band as the screen does with a view scrolled off the data.

None
limit int

The most modes to accept.

30
name str

What to call the shape set. Defaults to the FRF set's name followed by 'Modes'.

None
at sequence of tuple

Explicit (frequency, damping) picks, each optionally (frequency, damping, description), confirmed in the order given. Each mode is removed from the residual before the next is fitted, so the order is part of the fit. The fitting screen journals its confirms as this call, which is how an interactive session is replayed. bounds and limit are ignored when picks are given.

None
refine int

How many times to refine the fit after the confirms (the screen's Refine): modes whose half-power bands overlap get their poles searched together and their residues fitted together (ModalFitSession.refine_residues).

0
records sequence of int

Fit these records only; the screen fits the records picked in the tree. Every record when omitted.

None
coherence str or Coherence

Weight each response's least-squares fit by this coherence, line by line. The screen weights by fit_coherence(source, records) when the project has one. Unweighted when omitted.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

fit_replay_line
fit_replay_line(source: str, name: str, session: Any, coherence: str | None = None) -> str

The journal line that replays a fit made by hand and published as name, and the recipe refresh runs it again from: a fit_modes(at=...) call, or a comment when no call can make the set (ModalFitSession.replay).

Parameters:

Name Type Description Default
source str

The FRF set fitted.

required
name str

The shape set the fit was published as.

required
session ModalFitSession

The fit.

required
coherence str

The coherence the fit was weighted by, by name.

None

Returns:

Type Description
str

The line, for the journal.

project_onto_basis
project_onto_basis(source: str, *, onto: str | None = None, channels: Iterable[int] | None = None, modes: Iterable[int] | None = None, tolerance: float = 0.02, distance: float | None = None, name: str | None = None) -> str

Sample a shape set at the Basis shape set's DOFs, at a channel table's, or at every node of a geometry (Project onto Basis DOFs). Returns the new shape set's name.

For each target DOF, the nearest node of the source's geometry is found, and the displacement there is dotted with the DOF's direction on the target's geometry, its node's coordinate system and sign included. A DOF with no node within tolerance is dropped rather than estimated. The result is linked into the target's group. A channel table as the target puts a model's modes at a test's sensors and drives before there are test modes to compare with: its channels' DOFs, on the geometry the table answers to. A strain channel is left out unless a motion channel shares its node and direction, since a shape set holds displacements; the report's 'strain' names those left out, and gauge_strains reads them. channels narrows a channel table to some of its rows, such as the drives alone; each row's values are the same as in the projection onto the whole table. A geometry as the target puts the set on another model: its X, Y and Z at each of the geometry's nodes, in the node's own coordinate system, which only a set holding three directions at its nodes can give. With no target, or the source or the target without a geometry, this raises ValueError.

Parameters:

Name Type Description Default
source str

The shape set to project.

required
onto str

The shape set, channel table or geometry to project onto. Defaults to the shape set in the project's Basis.

None
channels iterable of int

Rows of the channel table onto (0-based, the table's order) whose DOFs are the target. Rows with no node or direction are skipped. Every row when omitted.

None
modes iterable of int

The source's modes to project, by index from zero, such as the ones picked in the tree. Every mode when omitted.

None
tolerance float

How far the nearest node may be, as a fraction of the Basis geometry's extent (the largest distance of a node from the nodes' mean position), when no distance is given.

0.02
distance float

How far the nearest node may be, in meters when the geometries' units are defined and in the model's own units otherwise. Left out, match_distance says.

None
name str

What to call the result. Defaults to the source's name followed by '@ Basis DOFs', or by '@' and the table's or the geometry's name, with the number of channels in parentheses when channels picks some.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

projected
projected(source: str, onto: str, *, tolerance: float = 0.02, distance: float | None = None) -> ShapeSet

The shape set project_onto_basis would add, without adding it: source sampled at the DOFs of onto (a shape set, a channel table or a geometry), its projection_report saying what matched. What a view shows of a projection before one is made.

Parameters:

Name Type Description Default
source str

The shape set to project.

required
onto str

The shape set, channel table or geometry to project onto.

required
tolerance float

As project_onto_basis.

0.02
distance float

As project_onto_basis.

0.02

Returns:

Type Description
ShapeSet

The projected set.

Raises:

Type Description
ValueError

As project_onto_basis; core.correlate.NoNodeMatched, with its report, when no node is matched.

match_modes
match_modes(first: str, second: str, *, pairs: Iterable[tuple[int, int]] | None = None, macs: Iterable[float] | None = None, threshold: float = 0.7, first_modes: Iterable[int] | None = None, second_modes: Iterable[int] | None = None, name: str = 'Matched Modes') -> str

Save matched mode pairs as an object (the comparison screen's + button).

With pairs, exactly those pairs are kept. Otherwise each of first's modes is paired with the mode in second that has the highest MAC, when that MAC is at least threshold. Across geometries the MAC is computed after projection, as the screen does it (comparison_mac). The result is in no object group, since it names a shape set in each; it records both geometries itself.

Parameters:

Name Type Description Default
first str

One shape set, by name.

required
second str

The other shape set, by name.

required
pairs iterable of tuple of int

Explicit (first, second) index pairs, overriding the automatic matching.

None
macs iterable of float

MAC values for those pairs. Computed from comparison_mac when omitted.

None
threshold float

The lowest MAC an automatic pairing may have.

0.7
first_modes iterable of int

The modes of each set an automatic pairing may use, by index from zero, such as the ones picked in the tree. Every mode when omitted.

None
second_modes iterable of int

The modes of each set an automatic pairing may use, by index from zero, such as the ones picked in the tree. Every mode when omitted.

None
name str

What to call the result.

'Matched Modes'

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

comparison_mac
comparison_mac(first: str, second: str) -> ndarray

The MAC between two shape sets, as the comparison screen shows it.

When the sets are on different geometries, the second set is projected onto the first set's DOFs, because DOFs with the same name on two geometries need not point in the same direction.

Parameters:

Name Type Description Default
first str

One shape set, by name.

required
second str

The other shape set, by name.

required

Returns:

Type Description
ndarray

The MAC matrix, with first's shapes down the rows and second's across the columns.

compared_sets
compared_sets(first: str, second: str, *, tolerance: float = 0.02, distance: float | None = None) -> tuple[ShapeSet, ShapeSet, str, dict | None]

Two shape sets as they are compared: on DOFs they share.

Sets on one geometry are compared as they are. Sets on two geometries share no DOF, so one is projected onto the other's DOFs, the way the pair's projection says (projection_of): as Project set it (set_projection), or else the way core.correlate.projection_order decides from what the sets measure, not the order they are named in. The MAC, the matches and the angle that aligns a pair are all read from these.

Parameters:

Name Type Description Default
first str

One shape set, by name.

required
second str

The other shape set, by name.

required
tolerance float

How far the nearest node may be, as a share of the extent of the geometry projected onto, when neither distance nor the pair's projection gives a distance.

0.02
distance float

How far the nearest node may be, in place of the pair's projection's (project_onto_basis).

None

Returns:

Type Description
tuple of (ShapeSet, ShapeSet, str, dict or None)

The first set and the second, one of them projected when they are on two geometries; which was projected onto which and why ('' on one geometry); and what the projection matched (core.correlate.project_shapes' report, None on one geometry).

set_projection
set_projection(first: str, second: str, *, source: str | None = None, distance: float | None = None) -> None

Set how the DOFs of two shape sets on two geometries are mapped onto each other (DOF Mapping): each DOF of one matched to the nearest node of the other's geometry within a distance, along its own direction. The MAC, the matches, the animated projection and a Matched Modes object of the pair compare the sets on those DOFs (compared_sets); Reduce takes the other set's modes at them (project_onto_basis) and Expand fits the set there with the other's modes and takes the fit to the other's DOFs (expand_modes). The project file keeps it.

A shape set and a geometry it is not on are a pair too: the set's modes at the geometry's nodes, which Reduce adds at the distance kept.

Parameters:

Name Type Description Default
first str

The two shape sets, or a shape set and a geometry, by name, in either order.

required
second str

The two shape sets, or a shape set and a geometry, by name, in either order.

required
source str

The set whose nodes are matched to the other's DOFs, first or second: the one whose modes are taken at the other's DOFs. Left out, the one core.correlate.projection_order chooses from what the sets measure; beside a geometry, the set.

None
distance float

How far a node may be from the node it is matched to, in meters when the geometries' units are defined and in their own units otherwise. Left out, match_distance's.

None

Returns:

Type Description
None

Raises:

Type Description
TypeError

If either is not a shape set, or a geometry beside one.

ValueError

If the two are on one geometry, either has no geometry, source is neither of them or holds too little motion to be projected onto the other (projection_why), or distance is not above zero.

projection_of
projection_of(first: str, second: str) -> tuple[str, str, float | None]

How two shape sets are projected when compared (compared_sets): (the set projected, the one it is projected onto, the node match distance or None for match_distance's), as Project set it (set_projection), or else the way core.correlate.projection_order decides, with no distance. For a shape set and a geometry, the set onto the geometry.

Parameters:

Name Type Description Default
first str

The two shape sets, or a shape set and a geometry, by name, in either order.

required
second str

The two shape sets, or a shape set and a geometry, by name, in either order.

required

Returns:

Type Description
tuple of (str, str, float or None)
projection_records
projection_records() -> list[dict[str, Any]]

The pairs' DOF mappings as the project file holds them: one {'first', 'second', 'source', 'distance'} per pair set.

expanded
expanded(source: str, onto: str, *, modes: Any = None, basis: Any = None, tolerance: float = 0.02, distance: float | None = None) -> ShapeSet

The shape set expand_modes would add, without adding it: source expanded to the DOFs of onto's modes (SEREP, core.correlate.expand_shapes), its expansion_report saying what matched and how well it fits.

Parameters:

Name Type Description Default
source str

The shape set to expand, a test's.

required
onto str

The shape set to expand through.

required
modes sequence of int

The modes of source to expand, indices from 0. Every one when left out.

None
basis sequence of int

The modes of onto to expand through, indices from 0, no more of them than the test DOFs matched. Every one when left out.

None
tolerance float

As project_onto_basis.

0.02
distance float

As project_onto_basis. Left out, the distance the pair's DOF mapping keeps (projection_of).

None

Returns:

Type Description
ShapeSet

The expanded set.

Raises:

Type Description
ValueError

If it cannot be expanded (mapping_why), or as core.correlate.expand_shapes.

expand_modes
expand_modes(source: str, *, onto: str, modes: Any = None, basis: Any = None, tolerance: float = 0.02, distance: float | None = None, name: str | None = None) -> str

Expand a test's shape set to a model's DOFs through the model's modes (Expand): SEREP, each test mode fitted at the test DOFs as a combination of the model's modes and taken at every model DOF (core.correlate.expand_shapes). The result is linked with the model, so it animates on the model's geometry. expand is another thing: modal responses back to physical ones.

Parameters:

Name Type Description Default
source str

The test's shape set.

required
onto str

The model's shape set.

required
modes optional

As expanded.

None
basis optional

As expanded.

None
tolerance optional

As expanded.

None
distance optional

As expanded.

None
name str

What to call the result. Defaults to the source's name followed by '@' and the model set's name.

None

Returns:

Type Description
str

The name the result was added under, unique within the project.

match_distance
match_distance(source: Any, onto: Any, *, tolerance: float = 0.02) -> float | None

How far a node may be from the nearest node of source's geometry when source is projected onto onto and no distance is given (core.correlate.match_distance): tolerance of the extent of onto's geometry, plus half the thickest plate of source's. What a projection form opens on.

Parameters:

Name Type Description Default
source str or object

The shape set that would be projected.

required
onto str or object

The shape set, channel table or geometry it would be projected onto.

required
tolerance float

The share of the extent.

0.02

Returns:

Type Description
float or None

In meters when the geometries' units are defined, in the model's own units otherwise. None when either has no geometry or their units do not agree, so no projection would be made.

merge
merge(*names: str, name: str | None = None) -> str

Combine compatible objects into one (Merge). The merged object replaces its parts.

Only objects of the same type can be merged, and each kind has its own rule: geometries need disjoint node ids, shape sets the same DOFs, and data arrays an identical abscissa. The merged object is linked into the first part's object group.

Parameters:

Name Type Description Default
*names str

The objects to merge, by name.

()
name str

What to call the merged object. Defaults to the first part's name.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

export
export(name: str, path: str | PathLike, unit_system: Any = None, *, records: Sequence[int] | None = None, **kwargs: Any) -> str

Write an object to another file format, chosen by the file's suffix (Export).

Any registered writer can be used: .unv, .exo, .npz, .bdf, .afu/.ati/.ash, .xlsx, .3mf, .stl, .hftemplate and the rest of io.exporters().

Parameters:

Name Type Description Default
name str

The object to write.

required
path str or PathLike

Where to write it. The format follows the extension.

required
unit_system UnitSystem

Units to write in. Omitted, the stored (SI) values are written as they are.

None
records sequence of int

The records of a data object, or the modes of a shape set, to write, by index from zero, such as the ones picked in the tree. Every one when omitted.

None
**kwargs Any

Passed through to the exporter. An Exodus file's geometry may be the object or its name, as the journal writes it.

{}

Returns:

Type Description
str

The path written.

export_state_space
export_state_space(shapes: Any, table: Any, path: str | PathLike, *, maximum_frequency: float | None = None, rigid_frequency: float = 1.0, modes: Sequence[int] | None = None, unit_system: Any = None) -> Any

Write a shape set at a channel table's channels as a modal state-space model, the file Rattlesnake's state-space virtual hardware loads (Export State Space).

The table's reference rows are the inputs, each a force at its DOF, and every row is an output, in table order, in its own unit (core.state_space). The file matches that table row for row, so it is written for the whole table.

Parameters:

Name Type Description Default
shapes str or object

The shape set: real, mass-normalized, with a mass unit.

required
table str or object

The channel table.

required
path str or PathLike

Where to write the .npz.

required
maximum_frequency float

Modes at or above this frequency, in Hz, are left out. For a controller, its Nyquist frequency, since a mode above it aliases into the band. Every mode is kept when omitted.

None
rigid_frequency float

Modes below this frequency, in Hz, are moved up to it, so a rigid-body mode does not drift through a long run.

1.0
modes sequence of int

The set's modes to put in the model, by index from zero, such as the ones picked in the tree. Every mode when omitted.

None
unit_system UnitSystem or str

The units for a channel whose unit cell is blank, or the name of one of units.SYSTEMS. SI when omitted.

None

Returns:

Type Description
StateSpaceModel

The model written: its matrices, the rows' DOFs and units, and how many modes were lifted and left out.

Raises:

Type Description
TypeError

If shapes is not a shape set or table not a channel table.

ValueError

As core.state_space.state_space_model.

generate_report
generate_report(template: str = 'modal', name: str = 'Report', marking: str | None = None, marking_color: str | None = None) -> str

Build a report from a starter template, bound by type to this project's objects (Generate Report).

An unknown template raises ValueError.

Parameters:

Name Type Description Default
template str

Which starter to build: 'modal', 'random', 'shock', 'transient', 'sine', 'sysid', 'mimo' (a multiple-input random run, judged on its control matrix), 'model' (a finite element model and its modes), 'specify' (the specifications with their limits), 'signals' (the time histories and spectra) or 'empty'. (In the app, a Random and Sine project makes 'random' and 'sine', one report each.) It can also be a saved template, by the name it was saved under in the templates folder, or the path of a .hftemplate file, a report exported on its own (io.report_template).

'modal'
name str

What to call the report object.

'Report'
marking str

The banner across the top and bottom of every page. 'UNCLASSIFIED' when omitted.

None
marking_color str

'ink' or 'red'.

None

Returns:

Type Description
str

The name the result was added under, unique within the project. A name already taken gets a numbered suffix.

report_features
report_features(name: str, *, enable: Sequence[str] = (), disable: Sequence[str] = (), preset: str | None = None) -> FeatureSelection

Turn a report's optional features on or off (the report editor's Report Features panel).

A report feature is an addition to the generated report, off until it is enabled; with none enabled the report is exactly what Hertzforge writes otherwise. The features, their groups and what each one needs are listed in hertzforge.report.features.FEATURES, and the presets in PRESETS. The choice is saved with the report and in a .hftemplate template.

Parameters:

Name Type Description Default
name str

The report.

required
enable sequence of str

Feature keys to turn on. A feature that needs another can be enabled in the same call as the one it needs.

()
disable sequence of str

Feature keys to turn off. A feature that needs one turned off goes with it, and the notes say so.

()
preset str

'default' (no features), 'test_report' or 'flash_report': the report's features are replaced by the preset's before disable and enable apply. A feature the preset names that is not available yet is skipped with a note.

None

Returns:

Type Description
FeatureSelection

enabled, the report's features afterwards, and notes, what was skipped or turned off along the way.

Raises:

Type Description
ValueError

For an unknown feature or preset, a feature not yet available, or a feature whose requirement is not met. Nothing is changed.

TypeError

When name is not a report, or a key is not a string.

report_section
report_section(name: str, section: str, text: str | None = None, *, none: bool = False, by: str | None = None) -> None

Write one skeleton section of a report (the report editor's pane on a section's block).

With the report feature skeleton_sections on, the report is laid out on the sections in hertzforge.report.skeleton.SECTIONS, and each section only the author can write is shown as owed until it says something. This sets what it says.

Parameters:

Name Type Description Default
name str

The report.

required
section str

The section's key: 'identification', 'summary', 'requirement', 'article', 'setup', 'instrumentation', 'chronology', 'results', 'deviations', 'discussion', 'conclusion' or 'record'.

required
text str

The section's words, in the report's Markdown, replacing what it said.

None
none bool

Write the section's own wording for nothing to report, in one step ('deviations' and 'discussion' only): "No deviations. No anomalies. No nonconformances." With the report feature findings on and findings entered, the deviations' None says "none" only of each kind with nothing entered (hertzforge.report.findings.none).

False
by str

Who made the interpretation ('discussion' only); an empty string clears it.

None

Returns:

Type Description
None

Raises:

Type Description
ValueError

For an unknown section, text and none together, none for a section that always has something to say, or by outside the discussion. Nothing is changed.

TypeError

When name is not a report, or a value is not a string.

report_check_block
report_check_block(name: str, check: str, *, source: str | None = None, measured: str | None = None, specification: str | None = None, shapes: str | None = None, **settings: Any) -> int

Give a report a check of its own, with what it reads and its settings (report feature check_blocks).

With the feature on, the report carries a block for every check it can make from what it shows. A check that needs a fact no object holds is made from a block of its own: the classical pulse ('pulse', with its nominal shape, peak and duration), the sweep rate against the modes the test plan names ('sweep_rate', modes), two signatures before and after the test ('signature', source before and measured after) and a replicated record's segments ('segments', segments). A check made from what the report shows, given a block of its own, is made from the block, so its settings hold. The checks and what each reads are hertzforge.report.check_blocks.CHECKS.

Parameters:

Name Type Description Default
name str

The report.

required
check str

'time_statistics', 'rms', 'chance', 'shock_validity', 'srs_points', 'pulse', 'distortion', 'frequency', 'sweep_rate', 'signature' or 'segments'.

required
source str

What the check reads, by object name or symbolic binding ('@basis:TimeHistory'); each field the check takes defaults to its own binding.

None
measured str

What the check reads, by object name or symbolic binding ('@basis:TimeHistory'); each field the check takes defaults to its own binding.

None
specification str

What the check reads, by object name or symbolic binding ('@basis:TimeHistory'); each field the check takes defaults to its own binding.

None
shapes str

What the check reads, by object name or symbolic binding ('@basis:TimeHistory'); each field the check takes defaults to its own binding.

None
**settings Any

The keyword arguments of the check's reading in core, such as shape, peak (SI) and duration for the pulse, or modes as [[frequency, Q], ...] for the sweep rate.

{}

Returns:

Type Description
int

The index of the check's block in the report.

Raises:

Type Description
ValueError

For an unknown check, a field or setting the check does not take, a required setting left out, or settings that cannot be saved. Nothing is changed.

TypeError

When name is not a report.

report_check
report_check(name: str) -> list[str]

What a report still owes before it is issued, one line per section, in order (what Export lists and asks about).

A line names the section and why: not yet written; nothing in it (Instrumentation or Results with nothing generated or written); or a discussion that does not say by whom. With the report feature findings on, section 9 is read off the register: a kind neither entered nor set to None, a kind both entered and said to be none, and each finding's blank parts, such as '9. Deviations, Anomalies and Nonconformances: D-1: cause not yet written'. An empty list means every section of the skeleton says something. With the report feature flash_report on, the lines are what the flash report's one page still owes (hertzforge.report.flash.check), such as 'Condition on release: not yet written', since the page draws none of the skeleton's sections.

Parameters:

Name Type Description Default
name str

The report.

required

Returns:

Type Description
list of str

One line per owed section, such as '4. Test Article: not yet written', in the skeleton's order.

Raises:

Type Description
ValueError

When the report does not have the report feature skeleton_sections enabled: without the skeleton there is nothing to check against, and an empty list would read as a complete report.

TypeError

When name is not a report.

report_flash
report_flash(name: str, *, condition: str | None = None, next_steps: str | None = None, report_date: str | None = None, opinions: Sequence[Any] | None = None, opinions_none: bool | None = None) -> None

Type the parts of a flash report only the author can write.

With the report feature flash_report on, the report is one preliminary page drawn from the identity, the result table and the findings register (hertzforge.report.flash). What the project does not hold is owed on the page until it is typed here.

Parameters:

Name Type Description Default
name str

The report.

required
condition str

The article's condition on release: the post-test functional and inspection results as far as they go, and who received it ('' clears it).

None
next_steps str

What is still to be done before the result is final.

None
report_date str

The date the test report will be issued, as the lab writes it.

None
opinions sequence

The opinions given at the console, replacing those entered, each (by, text) or a mapping of 'by' and 'text'. Each is drawn marked as an opinion, with who gave it.

None
opinions_none bool

True to say no opinion was given; False takes it back.

None

Returns:

Type Description
None

Raises:

Type Description
ValueError

When the feature is off, for an opinion without its words or without who gave it, and for opinions entered while None is said of them. Nothing is changed.

TypeError

When name is not a report, or a value is of the wrong type.

report_finding
report_finding(name: str, number: str | None = None, *, kind: str | None = None, run: str | None = None, channel: str | None = None, band: Sequence[float] | None = None, fact: str | None = None, cause: str | None = None, effect: str | None = None, approval: str | None = None, status: str | None = None, accept: bool = False, discard: bool = False, remove: bool = False) -> str

Enter, change or remove a finding in a report's findings register (report feature findings; the report editor's pane on section 9).

A finding is a deviation, an anomaly or a nonconformance, numbered by kind (D-1, A-1, NC-1) and written in four parts: the fact, the cause, the effect, and the approval (of a deviation) or disposition (of an anomaly or nonconformance). Section 9 of the report draws each one, and the summary lists them by number. A blank part is drawn as owed, and report_check lists it.

Parameters:

Name Type Description Default
name str

The report.

required
number str

The finding to change. Without it a finding of kind is entered under the next number of its kind.

None
kind str

'deviation', 'anomaly' or 'nonconformance', for a new finding only: a finding's kind is its number's.

None
run str

The run and the channel the finding concerns.

None
channel str

The run and the channel the finding concerns.

None
band (float, float)

The band it concerns, low and high in Hz; an empty sequence clears it.

None
fact str

The four parts, in the author's words.

None
cause str

The four parts, in the author's words.

None
effect str

The four parts, in the author's words.

None
approval str

The four parts, in the author's words.

None
status str

'open', 'closed' or '' (not stated).

None
accept bool

Make the fact draft offered on the finding its fact (draft_finding_fact); with fact, as edited.

False
discard bool

Drop the fact draft offered on the finding.

False
remove bool

Take the finding out of the register. Its number is not given again.

False

Returns:

Type Description
str

The finding's number.

Raises:

Type Description
ValueError

When the report does not have the feature enabled; for a kind on an existing finding or none for a new one, an unknown number, a band that is not two ordered frequencies, a status other than open or closed, accept with no draft waiting, discard with none, more than one of accept, discard and remove, or remove with fields. Nothing is changed.

TypeError

When name is not a report, or a text field is not a string.

draft_finding_fact
draft_finding_fact(name: str, number: str, measured: str, specification: str, channel: str | None = None, *, band: Sequence[float] | None = None, limits: str = 'abort', progress: Any = None) -> str

Offer a finding a draft of its fact, read off a comparison the project holds.

The draft names the channel, each stretch where measured went outside specification's limits (its band, its side, how far beyond at worst in dB, how many lines), the record and the time history it was computed from, and what was not judged. It is read on the same cells, at the same scale, as the comparison figure (hertzforge.core.findings.excursions). The draft fills nothing: the author accepts it, edits it or discards it (report_finding(..., accept=True)). Only the fact is ever offered; a channel inside its limits gives no draft.

Parameters:

Name Type Description Default
name str

The report.

required
number str

The finding.

required
measured str

The measured spectrum and the specification it is compared with.

required
specification str

The measured spectrum and the specification it is compared with.

required
channel str

The channel, such as '2Y+'; the finding's own when omitted.

None
band (float, float)

The band to read, in Hz; the finding's own when omitted, and the whole comparison when it has none.

None
limits str

'abort' or 'warning'.

'abort'
progress callable

Accepted so the app can run the reading on its worker; not called.

None

Returns:

Type Description
str

The draft offered.

Raises:

Type Description
ValueError

When the report does not have the feature enabled; for an unknown finding, a name that is not a spectrum or a specification of the project, a channel they do not share, no channel, a pair of limits the specification does not carry, a comparison refused (different quantities, units on one side only), nothing judged in the band, an all-zero channel, and a channel inside its limits wherever it was judged. Nothing is changed.

TypeError

When name is not a report.

draft_finding_from_requirement
draft_finding_from_requirement(name: str, number: str, measured: str, specification: str, criterion: int | str) -> str

Offer a finding a draft of its fact, read off a row of a requirement's result table.

A row offers a fact where the run departed from the plan: a limit channel's notch the plan does not name (its band, its line count and how far the control fell under the reference), and a cross-axis channel over its limit (its worst percentage, the lines over and their reach). The draft names the channel and the record and the time history it was computed from, and reaches the finding as draft_finding_fact's does, through the register's one entry point for drafts (hertzforge.report.findings.offer): it fills nothing until the author accepts it, edits it or discards it (report_finding(..., accept=True)).

Parameters:

Name Type Description Default
name str

The report, with the features test_requirement and findings on.

required
number str

The finding.

required
measured str

The run and the specification the requirement is bound to (report_requirement).

required
specification str

The run and the specification the requirement is bound to (report_requirement).

required
criterion int or str

The row: its number in the result table from 1, or its name, such as 'Limit channel 3Z+'.

required

Returns:

Type Description
str

The draft offered.

Raises:

Type Description
ValueError

When the report does not have both features enabled; for an unknown finding, no requirement bound to the pair, one that cannot be read, a row number out of range, a name no row has, a name two offering rows share, and a row that offers no finding. Nothing is changed.

TypeError

When name is not a report.

draft_findings_from_run_log
draft_findings_from_run_log(name: str, run_log: str | None = None) -> list[str]

Offer a report the deviations and anomalies a run log extract holds, as drafts beside its findings register.

Each is offered with the log's number, proposed (D-1, A-1), its kind and its fact as typed at the console, citing the log, test and entry (with the extract's badge when the log has newer entries). Nothing enters the register: the deviations section stays owed, the editing page shows the drafts marked as drafted from the run log, and the check lists them as waiting. The author accepts one (accept_logged_finding), which enters the finding, or discards it. A new offer replaces the drafts waiting. A finding the register holds with its fact written is not offered over, one with no fact logged is not offered, and the cause, effect and approval or disposition are never offered. A log holding no deviation or anomaly offers nothing: setting the section to None stays the author's step.

Parameters:

Name Type Description Default
name str

The report, with the report feature findings on.

required
run_log str

The run log extract; the project's one extract when omitted.

None

Returns:

Type Description
list of str

A line per finding of the log: offered, or left alone and why; or one line saying the log holds none.

Raises:

Type Description
ValueError

When the report does not have the feature enabled, the project holds no run log extract, or holds several and run_log does not name one. Nothing is changed.

TypeError

When name is not a report, or run_log is not a run log extract.

accept_logged_finding
accept_logged_finding(name: str, number: str, *, fact: str | None = None, discard: bool = False) -> str | None

Accept, or discard, a finding a run log offered a report (draft_findings_from_run_log).

Accepting is what enters the finding in the register: under the log's number when the register has not given it, otherwise under the next number of its kind (a finding already entered under that number with its fact blank takes the fact instead). Its fact, as offered or as edited (fact), reaches it through the register's one entry point for drafts (hertzforge.report.findings.offer) and is accepted; its cause, effect and approval or disposition stay owed, for the author to type (report_finding). Discarding drops the draft and enters nothing.

Parameters:

Name Type Description Default
name str

The report, with the report feature findings on.

required
number str

The number the log gave it, as offered.

required
fact str

The fact as the author edited it; the logged fact when omitted.

None
discard bool

Drop the draft instead.

False

Returns:

Type Description
str or None

The number the finding was entered under; None when discarded.

Raises:

Type Description
ValueError

When the report does not have the feature enabled, no finding is offered as number, the fact accepted is blank, or fact is given with discard. Nothing is changed.

TypeError

When name is not a report, or fact is not a string.

report_test_date
report_test_date(name: str, start: str | None, end: str | None = None) -> None

Set the dates of the test a report covers, which its sensors' calibration is judged against (the dates in the report editor's pane on the channel table).

With the report feature calibration_in_date on, the report's channel table carries each sensor's calibration status on these dates: in date, expired before the test, lapsing during it, or no date given (hertzforge.core.calibration). The dates are kept with the report's channel table blocks, and a .hftemplate template leaves them out.

Parameters:

Name Type Description Default
name str

The report.

required
start str or None

The first test day, YYYY-MM-DD. None or '' clears the dates.

required
end str

The last test day, YYYY-MM-DD, for a test over several days; the first day when omitted.

None

Returns:

Type Description
None

Raises:

Type Description
ValueError

When the report does not have calibration_in_date enabled or has no channel table block, or for a date not written YYYY-MM-DD (a slashed date reads two ways) or a last day before the first. Nothing is changed.

TypeError

When name is not a report, or a date is not a string.

report_calibration
report_calibration(name: str) -> CalibrationCheck

Each sensor of a report's channel table against its test dates (what the report's Calibration column shows).

Parameters:

Name Type Description Default
name str

The report.

required

Returns:

Type Description
CalibrationCheck

span, the test dates; channels, one entry per channel with its status ('in date', 'expired', 'lapses during the test' or 'no date given') and days; summary(), the check in words.

Raises:

Type Description
ValueError

When the report does not have calibration_in_date enabled, has no channel table block or no test date (there is then nothing to judge against, and no answer would read as in date), or when a date or an Expiration cell cannot be read as a date; the message names the cell.

TypeError

When name is not a report.

report_calibration_text
report_calibration_text(name: str) -> str

The equipment list with each sensor's calibration status on the test date, as Markdown offered for the report's Setup and Method section (the section pane's Insert Calibration Status).

The section is the author's, so nothing is written into it here; put the text in with report_section:

text = project.report_calibration_text('Report')
project.report_section('Report', 'setup', text)

Parameters:

Name Type Description Default
name str

The report.

required

Returns:

Type Description
str

A sentence, a pipe table of the sensors (channel, DOF, quantity, make, model, serial number, expiration and calibration status) and the lines of the check.

Raises:

Type Description
ValueError

As report_calibration refuses.

TypeError

When name is not a report.

predict
predict(name: str, channel: str, quantity: str, peaks: Sequence[Any], *, unit: str | None = None, level_db: float | None = None, curve: tuple[Sequence[float], Sequence[float]] | None = None, reference: str | None = None, source: str = '', customer: bool = False, frequency_uncertainty: float | None = None, level_uncertainty: float | None = None) -> str

Enter one response channel's predicted response, the analyst's numbers, into the predictions object name, made when the project has nothing of that name. A prediction already held for the channel and quantity is replaced.

A report reads a measurement against these with the report feature prediction (hertzforge.report.prediction), and a script with core.prediction.compare.

Parameters:

Name Type Description Default
name str

The predictions object.

required
channel str

The response DOF, as the records name it ('201Z+').

required
quantity str

'asd', 'amplitude' or 'transmissibility'.

required
peaks sequence

The predicted peaks, each (frequency [Hz], level, Q, band): the level in unit (squared per hertz for an ASD), Q optional, and the band (low, high) in Hz to look for the measured peak in, optional when the model states its frequency uncertainty. For a curve, each mode's frequency alone.

required
unit str

The unit of the quantity: 'g' for an ASD in g²/Hz or an amplitude in g. A transmissibility has none.

None
level_db float

The input level the prediction is stated at, dB relative to full level (0 at full level). A transmissibility has none.

None
curve (frequencies, values)

The predicted curve, in unit; the peaks' levels and Q are read off it. Given as lists, the journal's line replays it.

None
reference str

The input DOF of a transmissibility.

None
source str

The analysis it comes from, with its document and revision.

''
customer bool

Whether the customer supplied it.

False
frequency_uncertainty float

The model's stated frequency uncertainty, plus or minus, in percent.

None
level_uncertainty float

The model's stated level uncertainty, plus or minus, in dB.

None

Returns:

Type Description
str

The name of the predictions object.

Raises:

Type Description
ValueError

For what a prediction cannot hold (core.prediction.Prediction lists it). Nothing is changed.

TypeError

When name is an object that is not a predictions object.

report_prediction
report_prediction(name: str, measured: Any, predictions: Any, *, level: float | None = None, caption: str = '') -> int

Add a block reading measured against predictions at the end of the report name (the report editor's Insert, Responses Against Prediction), and return its index.

While the report feature prediction is on, the block draws a figure per response channel, the measurement over its prediction scaled to the level run, and a table of each predicted peak against the measured one.

Parameters:

Name Type Description Default
name str

The report.

required
measured str or object

The response: a PSD, an amplitude spectrum or sine level, or a transmissibility (an FRF).

required
predictions str or object

The predictions object.

required
level float

The level measured was run at, dB relative to full level (-12 for a run at minus 12 dB). Required for an ASD or an amplitude, unless the PSD holds its scaling; refused for a transmissibility.

None
caption str

The table's caption.

''

Returns:

Type Description
int

The block's index in the report.

Raises:

Type Description
ValueError

When the comparison cannot be read; core.prediction.compare says why. Nothing is changed.

TypeError

When name is not a report or predictions not a predictions object.

report_requirement
report_requirement(name: str, specification: Any, measured: Any, document: str, composite_bands: Sequence[Any], *, revision: str = '', clause: str = '', strategy: str = 'single', channels: Sequence[str] = (), weights: Sequence[float] | None = None, individual_bands: Sequence[Any] = (), grms_percent: float | None = None, duration: float | None = None, duration_tolerance: Sequence[float] | None = None, min_dof: float | None = None, max_line_spacing: float | None = None, cross_axis: Sequence[Any] = (), cross_axis_channels: Mapping[str, str] | None = None, limit_channels: Sequence[Any] = (), rule: str = 'any_line', combine: int = 1, sources: Mapping[str, Any] | None = None, uncertainty: Mapping[str, Any] | None = None, duration_run: float | None = None, caption: str = '') -> int

Bind a test requirement to a run in the report name, and return its block's index.

While the report feature test_requirement is on, the block draws the requirement in words and a result table with one row per criterion, worded met, not met or not judged, and the report's pass/fail box for the same specification and run reads from it (hertzforge.report.requirement). The requirement's fields are core.requirement.TestRequirement's; a band is (low, high, below_db, above_db), low or high None for the specification's own end.

Parameters:

Name Type Description Default
name str

The report.

required
specification str or object

The specification the run was controlled to; a symbolic binding ('@basis:Specification') is kept as given, so a template carries it.

required
measured str or object

The run's PSD, likewise.

required
document str

The governing document.

required
composite_bands sequence

The control band: the one channel's, or the composite's under a multi-point strategy; one band per frequency range.

required
revision str

The document's revision, and the tolerance clause as the plan copied it.

''
clause str

The document's revision, and the tolerance clause as the plan copied it.

''
strategy str

'single', or a multi-point composite: 'average', 'weighted', 'maximum' or 'minimum'.

'single'
channels sequence of str

The control channels by response DOF; by default the channel table's Control flags, else the records that pair with the specification.

()
weights sequence of float

One per channel, under 'weighted' only.

None
individual_bands sequence

Each control channel's band, under a multi-point strategy.

()
grms_percent float

The overall rms tolerance, plus or minus, percent.

None
duration float

The nominal duration at level, seconds.

None
duration_tolerance (float, float)

Its tolerance below and above, percent.

None
min_dof float

The fewest degrees of freedom the control may have.

None
max_line_spacing float

The widest line spacing the control may have, Hz.

None
cross_axis sequence

The cross-axis limits, each (low, high, percent).

()
cross_axis_channels mapping

Each cross-axis channel's response DOF, to the in-axis control channel it is read against as a percentage.

None
limit_channels sequence

The response channels held under a limit profile, each (channel, profile, notches): the name of the object holding its profile ('' for the specification's own record at the channel) and the notches the plan names for it, each (low, high) Hz.

()
rule str

The decision rule: 'any_line' or 'combined'.

'any_line'
combine int

How many adjacent lines are combined under 'combined'.

1
sources mapping

Where each number came from, by field: (origin, owner), the origin 'laboratory', 'customer' or 'derived'.

None
uncertainty mapping

Each control channel's measurement uncertainty, by response DOF: a list of contributions, each (name, percent, coverage, source), an expanded uncertainty in percent on the acceleration with its coverage factor (2 when left out), drawn against one third of the tolerance.

None
duration_run float

How long the run was at level, seconds: the controller's counter, which the duration row is judged on.

None
caption str

The result table's caption.

''

Returns:

Type Description
int

The block's index in the report.

Raises:

Type Description
ValueError

For a requirement TestRequirement refuses, or a run it cannot be read against at all (core.requirement.evaluate says why). Nothing is changed.

TypeError

When name is not a report, or the specification or the run is not of its kind.

index_file
index_file(path: str | PathLike, holds: str | None = None, *, role: str = 'referenced', objects: Sequence[str] = (), source: str = 'author', progress: Any | None = None) -> IndexEntry

Add a file to the project's data index (the report editor's Insert, Attached File).

The data index lists every file the project rests on, by name, what it holds, format, size and SHA-256, and the report feature data_index prints it in the report's record. A file imported into the project is indexed by the import; this adds any other file: a document that goes with the report (the settings list, the log, the as-run procedure, the flash report), or a data file kept in the archive that was not imported. Another source of files adds its entries through this verb as well, naming itself in source, so the project keeps one index.

Parameters:

Name Type Description Default
path str or PathLike

The file. It is hashed now.

required
holds str

What the file is or holds, in words ("settings list", "log, Day 1 and Day 2"). Taken from objects when omitted.

None
role str

'attached' for a document sent with the report, or 'referenced' for a file named in it and kept in the archive. An attached text file of up to 64 KiB is kept whole, so the report can print it; a CSV prints as a table.

'referenced'
objects sequence of str

The project objects read from the file, by name.

()
source str

What added the entry, as the index records it.

'author'
progress callable

Called as progress(bytes read, bytes in the file) while the file is hashed.

None

Returns:

Type Description
IndexEntry

The file's entry. The same file indexed again with the same checksum is the same entry.

Raises:

Type Description
ValueError

When neither holds nor objects says what the file holds, for an unknown role, or for an object not in the project. Nothing is changed.

(FileNotFoundError, IsADirectoryError)

When path is not a file.

index_run_log_files
index_run_log_files(run_log: str | None = None, *, search: Sequence[str | PathLike] = (), progress: Any | None = None) -> list[str]

Add the files a run log extract names to the project's data index, each checked against the SHA-256 the log records.

Each file is looked for by its name in each folder of search, then beside the log, then beside the project's own file. Found, it is hashed; when its SHA-256 is the one the log records it is indexed through the index's own entry point (DataIndex.add, source 'run log'), saying which entry named it. A file found but not the one the log records, and a file not found, are not indexed, and each has a line saying so. The log itself is never indexed: its checksum changes with every entry, and the test's head hash, which the report's data index prints beside the extract, stands for it.

Parameters:

Name Type Description Default
run_log str

The run log extract; the project's one extract when omitted.

None
search sequence of str

Folders to look in first, for example the archive copy.

()
progress callable

Called as progress(bytes read, bytes in the file) while each file is hashed.

None

Returns:

Type Description
list of str

One line per file the log names, in the order first named: 'run11.nc4: indexed', or why it was not; or one line saying the log names no file.

Raises:

Type Description
ValueError

When the project holds no run log extract, or holds several and run_log does not name one.

TypeError

When run_log is not a run log extract.

unindex_file
unindex_file(name: str) -> IndexEntry

Take a file out of the data index (the report editor's Insert, Remove from Index).

For a document added by mistake, or one that no longer goes with the report. A file imported into the project leaves the index on its own when the last object read from it is removed.

Parameters:

Name Type Description Default
name str

The file's name as the index prints it, or its path when two entries share a name.

required

Returns:

Type Description
IndexEntry

The entry taken out.

Raises:

Type Description
ValueError

When no entry, or more than one, has that name. Nothing is changed.

verify_data_index
verify_data_index(search: Sequence[str | PathLike] = (), progress: Any | None = None) -> list[str]

Hash every file in the data index again and record whether it matches (what Export does when the report prints the index).

A file is looked for where it was indexed, then by its name in each folder of search, then beside the project's own file. It matches when its size and SHA-256 are the ones indexed; it has changed when they are not; it is not found when it is nowhere. The result is kept with each entry and printed in the report. The project's own file, when it has one, is hashed too, and the report states it.

Parameters:

Name Type Description Default
search sequence of str

Folders to look in for files that are not where they were indexed, for example the archive copy.

()
progress callable

Called as progress(bytes read, bytes to read) across the whole index.

None

Returns:

Type Description
list of str

One line per file, in the index's order: its name and what the check found, such as 'run11.nc4: matches'. Empty when the index is empty.

attach_run_log
attach_run_log(path: str | PathLike, test: int | None = None, upto: int | None = None, *, name: str | None = None) -> str

Bring one test of a run log into the project, frozen at a stated entry, as a run log extract (core.run_log_extract).

The extract holds the test's entries as they stood at entry upto (corrected), with the test's head hash, and reads them as the run log model does: its runs, interruptions, credited duration, findings, files and chronology. A report drawing on it never changes because the log grew; the extract says when the log holds newer entries (RunLogExtract.status), and refresh_run_log takes them, as a step of its own. The log's path is saved relative to the project file when the log is in the project file's folder or one beneath it, and absolute otherwise.

Parameters:

Name Type Description Default
path str or PathLike

The run log (.hflog, or an older .vdlog).

required
test int

The test, by number; may be left out when the log holds one.

None
upto int

The id of the last entry to take; the log's last entry when omitted.

None
name str

What to call the extract; 'Run Log, Test N' when omitted.

None

Returns:

Type Description
str

The name the extract was added under.

Raises:

Type Description
FileNotFoundError

When there is no file at path.

RunLogError

A ValueError: when the file is not a run log, holds no test test (or no entry upto), cannot read an entry before the cut, or a chain the extract rests on does not verify, the message naming the chain, entry and line. Nothing is changed.

detach_run_log
detach_run_log(name: Any) -> RunLogExtract

Take a run log extract out of the project, and return it.

Attaching the same log with the same test and entry (attach_run_log(path, test=..., upto=...)) brings back the same entries, since a log is only ever added to.

Parameters:

Name Type Description Default
name str or RunLogExtract

The extract.

required

Returns:

Type Description
RunLogExtract

The extract taken out.

Raises:

Type Description
TypeError

When name is not a run log extract. Nothing is changed.

refresh_run_log
refresh_run_log(name: Any, upto: int | None = None) -> RunLogExtract

Take a run log extract again from its log, to its newest entry or to entry upto: the one way an extract changes, and never on its own.

Refused when the log at the extract's path is another log, or no longer holds the entries the extract was taken from (cut short or changed since): attach it again to take it as it is now. Giving the upto the extract had before takes back its entries.

Parameters:

Name Type Description Default
name str or RunLogExtract

The extract.

required
upto int

The id of the last entry to take; the log's last entry when omitted.

None

Returns:

Type Description
RunLogExtract

The new extract, under the same name.

Raises:

Type Description
TypeError

When name is not a run log extract.

FileNotFoundError

When the log is not at the extract's path.

RunLogError

A ValueError: when the log is another log, has changed under the extract, or is refused as attach_run_log refuses it. Nothing is changed.

report_identity
report_identity(name: str, **fields: Any) -> None

Enter a report's identification (the report editor's Identity and Issue fields).

With the report feature report_identity on, every printed page carries the laboratory, the report number and revision, the title and page n of N, and the first page the identification block. Every field is the author's: the program never writes a number, a date or a name of its own, and a field left blank shows as not entered.

Parameters:

Name Type Description Default
name str

The report.

required
**fields Any

Any of 'number', 'revision', 'laboratory', 'address', 'location', 'customer', 'contact', 'received', 'tested', 'issued' (the dates as the lab writes them) and 'distribution', each a str ('' clears it); 'authorized', the people authorizing the report, a list of names or one per line ("name, role"), printed each with a blank line for the signature; and 'full_only', whether the first page says the report is not reproduced except in full (True unless turned off).

{}

Returns:

Type Description
None

Raises:

Type Description
ValueError

For an unknown field, the status or issue record (changed only by issuing and amending), or the number or revision of a report already issued. Nothing is changed.

TypeError

When name is not a report, or a value is of the wrong type.

amend_report
amend_report(name: str, changes: Sequence[Mapping[str, str]], *, revision: str, number: str | None = None) -> None

Make an issued report an amendment, to be issued in its turn (report.issue).

The amendment carries its own revision (and, if given, its own number), refers to the revision it amends by number, revision and date of issue, and prints a table of what it changes. It ends "End of amendment.". The original's record is kept.

Parameters:

Name Type Description Default
name str

The report.

required
changes sequence of mapping

Each change: 'where' (page or section), 'was' (what it said), 'now' (what it says) and, where appropriate, 'reason'.

required
revision str

The amendment's revision, entered by the author.

required
number str

The amendment's own report number; the original's when left out.

None

Returns:

Type Description
None

Raises:

Type Description
ValueError

When the report has not been issued, a change lacks where, was or now, there are no changes, or the number and revision were already issued. Nothing is changed.

TypeError

When name is not a report, or a value is of the wrong type.

run_identity
run_identity(name: str) -> Any

Which run of the test a time history is, as a report reads it.

The axis, run, level against full and start the history carries (read from its file's name on import, or entered with set_run_identity), and the level the comparison with its specification detects when nothing else gives one. A field read two ways is not read, and refused says why, naming the record.

Parameters:

Name Type Description Default
name str

A time history, or an object computed from one (which answers with that run's identity).

required

Returns:

Type Description
RunIdentity

axis, run, level_db, start and comment; sources, where each came from; refused, what was not read and why.

Raises:

Type Description
ValueError

When name is not in the project.

TypeError

When name is not a time history and comes from none.

set_run_identity
set_run_identity(name: str, *, axis: str | None = None, run: str | int | None = None, level_db: float | str | None = None, start: Any = None, comment: str | None = None) -> Any

Enter which run of the test a time history is.

An entered field stands over what the file's name or the comparison gave. A field left out (None) is unchanged; an empty string clears it, back to what the record shows. The identity is saved with the history in the project file.

Parameters:

Name Type Description Default
name str

The time history: one imported, not one computed from another (that is part of the run it came from).

required
axis str

The test axis, 'X', 'Y', 'Z' or a lab's own name.

None
run str or int

The run's identifier.

None
level_db float

The level against full, in decibels: 0 for full level.

None
start (str, datetime or date)

When the run started, ISO 8601 text such as '2026-10-11T11:11:05'.

None
comment str

A free note on the run.

None

Returns:

Type Description
RunIdentity

What the history carries afterwards.

Raises:

Type Description
ValueError

For a history computed from another, a level that is not a finite number, a start that is not a date, or an axis or run on more than one line; the message names the record. Nothing is changed.

TypeError

For an object that is not a time history, or a value of the wrong type.

report_chronology
report_chronology(name: str, *, window_s: float = 0.5, drop_db: float = 6.0, min_s: float = 1.0, progress: Callable[[int, int], None] | None = None) -> str

Draft the chronology of the project's runs and offer it to a report's Chronology section (the editor's Draft from the Runs).

Each run in the order it was run, with its axis, level, start, the time its record was at level and the interruptions found in it, as a Markdown table, then how they were read. The chronology is the author's: the draft is offered beside the section, marked as drafted on the editing page, and the section stays owed until the author accepts it (accept_chronology) or writes the section (report_section). The outcome of each run and the cause of each interruption are left for the author.

With a run log brought into the project (attach_run_log), the draft also carries what the log records: each run's outcome, matched by run number and axis, the cause of each interruption where the record and the log count the same, and under the table the log's interruptions with their cause, path and restart and the time credited on each axis, with which log, test and entry they come from. A project with an extract and no time history is offered the log's own chronology. Without an extract, the draft is the records' alone.

Parameters:

Name Type Description Default
name str

The report, with the report feature run_sections on.

required
window_s float

The running-RMS window, in seconds.

0.5
drop_db float

How far below the run's level an interruption reaches.

6.0
min_s float

How long an interruption lasts at least, in seconds.

1.0
progress callable

Called with (runs read, runs) as each record is read.

None

Returns:

Type Description
str

The draft offered, in the report's Markdown.

Raises:

Type Description
ValueError

When the report does not have run_sections enabled, the project holds no time history (and no run log extract with a run), the order of the runs cannot be read (the records with neither a start nor a run number are named), or a setting is not one the reading can use.

TypeError

When name is not a report.

accept_chronology
accept_chronology(name: str, text: str | None = None) -> None

Accept the drafted chronology as a report's Chronology section, as it was drafted or as the author edited it.

Parameters:

Name Type Description Default
name str

The report.

required
text str

The draft as the author edited it; the draft on offer when omitted.

None

Returns:

Type Description
None

Raises:

Type Description
ValueError

When no draft is on offer and no text is given.

TypeError

When name is not a report, or text is not a string.

report_runs
report_runs(name: str) -> list[str]

Repeat a report's Results for every run (the editor's Results for Every Run).

The report's generated Results sections drawn from its first run are added again for each run it does not draw on yet, each figure bound by name to the object computed from that run the same way, its caption naming the run. A section whose figure has nothing computed from a run is not added for that run, and the line for the run says what to compute. A second call adds nothing for a run already drawn on.

Parameters:

Name Type Description Default
name str

The report, with the report feature run_sections on.

required

Returns:

Type Description
list of str

A line per run: the figures added, and what was not added and why.

Raises:

Type Description
ValueError

When the report does not have run_sections enabled, or draws on no run.

TypeError

When name is not a report.

work_up
work_up(project_type: str | None = None) -> list[str]

Compute every missing object a kind of test expects from what is loaded, with the report last (Work Up, in that kind's module).

The empty slots are filled in their own order, each from the objects already there, the way the workflow guide makes them: PSDs from the time data, octave bands from the PSDs and the specification, and the coherence from the time data; the FRFs, a fitted shape set and the matched modes for a modal test; the levels for a sine sweep; the filtered record, its SRS and the integrated motion for a shock; the two streams' PSDs on shared frames and the H1 FRFs for a system identification; and then the type's report. A slot the loaded data cannot fill (a geometry, the photographs, a specification) is left gray. A computation the data refuses (no drive channel for a coherence) is skipped, with its reason in last_work_up_skipped, and the rest still run. Nothing already present is made again, so calling this twice adds nothing the second time; but an object already present that is out of date (its source's settings or values changed since it was made, stale) is recomputed first, and its name is in last_work_up_refreshed.

It is journaled as one line, project.work_up(), the way merge is. The verbs it calls are the ones the guide describes, and a script that wants them one at a time can call them.

Parameters:

Name Type Description Default
project_type str

The kind of test, one of core.report.PROJECT_TYPES, which becomes the project's type. Defaults to the type it has.

None

Returns:

Type Description
list of str

The names added, in the order made; empty when the skeleton was already full.

Raises:

Type Description
ValueError

When the project has no type, so there are no slots to fill.

export_report
export_report(name: str, path: str | PathLike, unit_system: Any = None) -> str

Write a report as one self-contained HTML file (Export).

Parameters:

Name Type Description Default
name str

The report object to render.

required
path str or PathLike

Where to write the self-contained HTML file.

required
unit_system UnitSystem

Units to render in. Defaults to units.DEFAULT_SYSTEM, 'in-slinch-lbf-s (g)'.

None

Returns:

Type Description
str

The path written.

Raises:

Type Description
ValueError

With the report feature report_identity on, when the report was issued and has changed since: an issued report is not written again under its identity, and a change after issue is an amendment (amend_report).

table
table(name: Any, *, values: bool = False, dofs: Any = None, form: str = 'shapes', environment: str | None = None) -> tuple[list[str], list[list[str]]]

(headers, rows) for an object that can be shown as a table.

The rows are a channel table's instrumentation, a shape set's identified parameters, or a matched-modes object's pairs beside both sets' parameters. They are the same rows the report prints, so a script and a report always agree. With values, a shape set gives its shape values instead, as the app's Shape Values table shows them: at every DOF of the set, or at dofs, and as the shapes or one of the transformations through them (core.transform.matrix_at). With environment, a channel table's Control column is that control loop's, and with form 'response' or 'reference' as well the rows are that loop's transformation instead, as the app shows it with the environment and the view picked on the table's bar. An object with no table raises ValueError.

Parameters:

Name Type Description Default
name str or object

The object to tabulate.

required
values bool

For a shape set, its values rather than its modes.

False
dofs str or sequence of str

With values, where: a list of DOFs, or a channel choice ('all', 'control', 'reference', 'response' or 'monitor') of the channel table in the set's object group. Every DOF of the set when left out.

None
form str

With values, what: 'shapes' (Φ, a row per DOF), 'response' (Φ⁺, a row per mode) or 'reference' (Φᵀ). With environment, 'response' or 'reference' for that loop's transformation (ChannelTable.transformation).

'shapes'
environment str

For a channel table, one of its environments (ChannelTable.environments).

None

Returns:

Type Description
tuple of (list of str, list of list of str)

The column headings and the rows, both as text.

transformation_of
transformation_of(name: Any, dofs: Any = None, *, max_condition: float | None = None) -> Any

A rigid set's transformation at a choice of DOFs, as an object (core.transformation.Transformation.from_shapes): the matrix from motions at the DOFs to the set's six coordinates, with its conditioning, its residual projector and its table.

Parameters:

Name Type Description Default
name str or ShapeSet

Six unscaled rigid-body shapes.

required
dofs str or sequence of str

Where, as for table: a list of DOFs or a channel choice ('control', 'response', ...) of the channel table in the set's object group. Every DOF of the set when left out.

None
max_condition float

The conditioning past which it is refused; the package's limit (core.transformation.MAX_CONDITION) when left out.

None

Returns:

Type Description
Transformation

Raises:

Type Description
ValueError

If the set is not unscaled rigid shapes, a DOF is not in it, or the DOFs resolve too little or too poorly.

TypeError

If the object is not a shape set.

read_transformation
read_transformation(name: Any, *, threshold: float | None = None, progress: Any = None) -> Any

What a rigid-body transformation leaves unexplained of the density it was applied to, line by line (core.transformation.read_residual).

name is a density transformed in this project (Transform to Modal Responses) from a cross-spectral density through six unscaled rigid-body shapes. The transformation is rebuilt from the set at the channels the transform used, and the source's measured power at those channels is split into the part the six motions explain and the residual, with the frequency up to which the residual stays under threshold of it. The conditioning is reported, not refused: a reading of a poor layout is the point.

Parameters:

Name Type Description Default
name str or object

The transformed density, by name or as the object itself.

required
threshold float

The residual's share of the measured power at which the rigid-body assumption is said to stop holding; a tenth when left out (core.transformation.RESIDUAL_THRESHOLD).

None
progress callable

Called with (0, core.progress.BUSY) as the work starts, which cannot count its own stages; the app's progress bar uses it.

None

Returns:

Type Description
TransformationResidual

Raises:

Type Description
ValueError

If the object was not transformed in this project from a cross-spectral density through rigid shapes, or no motion channel of the source is in the set.

name_of
name_of(target: Any) -> str

The name an object is stored under; a string is returned as it is.

Every verb accepts either, so project.compute_psds('Time History') and project.compute_psds(project.basis.time_history) are the same call. An object not in the project raises ValueError.

Parameters:

Name Type Description Default
target str or object

A name, or an object the project holds.

required

Returns:

Type Description
str

The name it is stored under.

extract_sine
extract_sine(source: Any, specification: Any = None, progress: Any = None, *, records: Sequence[int] | None = None) -> list[str]

Read each specification tone's level out of a recording (Extract Sine Levels), as one sine level set holding every tone.

Each tone is read against its own sweep, since each sweeps its own frequencies on its own clock. When no specification is named, the project's one sine sweep specification is used. The settings are the recording's sine_extraction; when none is set, the suggested setting is used, as filter_data uses its suggested filter, and the setting with the smoothing chosen is stored on the recording. The result is linked to the recording.

Parameters:

Name Type Description Default
source str or object

The recording (a time history) to read.

required
specification str or object

The sweep specification to extract against. Defaults to the project's own, when it holds exactly one.

None
progress callable

Called with (done, total) as the extraction advances: the matched filter for each tone, the smoothing steps, then the solve's pieces for each channel. The app's progress bar uses it; a script can print it. Anything it raises stops the extraction.

None
records sequence of int

Which of the source's records to read, by index from zero, such as the ones picked in the tree. Every record when omitted; a refresh reads the same ones.

None

Returns:

Type Description
list of str

A list holding the name of the sine level set added.

Raises:

Type Description
ValueError

When none is named and the project does not hold exactly one.

stale
stale() -> dict[str, str]

{derived name: reason} for every derived object whose source's settings or values have changed since it was computed.

An object whose source is gone, or whose provenance records no state to compare, is not reported.

refresh
refresh(name: Any) -> str

Recompute a derived object in place, under its own name.

What was set on the object itself (its comparison scale, its run identity) is kept. Links, the report's figures and the grids all refer to the object by name, so replacing the value under that name keeps every reference correct. Objects derived from this one then become stale by content, and are refreshed one at a time or all together with refresh_stale, never automatically. An object with no recorded derivation, or whose source is gone, raises ValueError.

Parameters:

Name Type Description Default
name str or object

The derived object to recompute, in place and under its own name.

required

Returns:

Type Description
str

The name refreshed.

refresh_stale
refresh_stale() -> list[str]

Refresh every stale object, sources before the objects derived from them, until nothing is stale. Returns the names refreshed.

This is the refresh on the project's row in the tree.

save
save(path: str | PathLike, compress: bool = False, **options: Any) -> str

Write the whole project to one file: .hforge, .mat for the same layout in a MATLAB file, or .h5 for the Engineering Sciences Common Data Format.

Parameters:

Name Type Description Default
path str or PathLike

Where to write the file. A .mat suffix writes the project as MATLAB structs (io.matlab), and .h5, .hdf5 or .escdf writes the standard's types with each object stored whole in an attachment (io.escdf_objects). Any other suffix writes a .hforge file, with .hforge added when the path does not end in it. A .vdyn path raises ValueError: .vdyn files are opened, never written.

required
compress bool

For a .hforge file, write the large arrays with gzip, for archiving: a file with quiet stretches shrinks by most of its size, a continuous random record by about a tenth, and the save takes longer (io.native.compressed). ValueError for any other format.

False
**options Any

Passed to the MATLAB or ESCDF writer, for example an ESCDF file's created_by. Not used for a .hforge file.

{}

Returns:

Type Description
str

The path written.

open classmethod
open(path: str | PathLike) -> Project

Read a project from a .hforge, an older .vdyn, a .mat or an ESCDF .h5 (.hdf5, .escdf) file, or from a control run's folder (or its run.json), which opens as the .hforge file it converts to inside the folder, converted first when there is none or the run has changed since (io.run_convert.converted).

The journal starts over with the one line that opens the file. A file holding a single object rather than a project raises SingleObjectFile, a ValueError.

journal_as
journal_as(line: str | None) -> Iterator[None]

Record a stretch of front-end work as the one line that replays it.

The app imports a file by building the objects itself and adding them one at a time. Journaled verb by verb, that stretch would be lines that do not replay, when the accurate record is the single import_file call a script would make. Inside the stretch, verbs record nothing, the same as verbs called from other verbs, and the line is added only when the stretch finishes without an error.

Parameters:

Name Type Description Default
line str or None

The line that replays the stretch, or None to record nothing.

required

Returns:

Type Description
None
record_setting
record_setting(target: Any, attribute: str, value: Any) -> None

Journal a settings write the way a script would make it.

The app stores analysis settings by assignment (a dragged averaging span, a filter corner, the shock windows), and those writes are part of the session as much as any verb. A repeated write to the same attribute replaces its own last line, so a setting adjusted many times leaves one assignment, not a line for each change. An object not in the project is ignored.

Parameters:

Name Type Description Default
target str or object

The object written to, by name or as the object.

required
attribute str

Which settings attribute was stored.

required
value Any

What was stored. Its repr must rebuild it, as every settings dataclass in hertzforge does.

required

Returns:

Type Description
None
record_call
record_call(target: Any, method: str, *args: Any, settle: bool = False, **kwargs: Any) -> None

Journal a method call on an object the way a script would make it.

This is for object methods that are not Project verbs, such as a line added to a geometry or a photo renamed, so the console shows every change made in the session. An object not in the project is ignored.

Parameters:

Name Type Description Default
target str or object

The object acted on, by name or as the object.

required
method str

The method a script would call.

required
*args Any

The call's arguments. Their reprs must rebuild them.

()
settle bool

Replace the last line when it was the same call (the same object, method, positional arguments and keyword names, with only the keyword values different), so a gesture adjusted again leaves one line, not one per adjustment.

False
**kwargs Any

Keyword arguments, under the same rule as args.

{}

Returns:

Type Description
None
session_script
session_script() -> str

This session's changes to the project as a runnable Python script.

It is the journal under the imports it needs: every verb that ran and every setting stored, whether clicked in the app or called from a script, as the line that reproduces it. A session worked up by hand can then be replayed, adapted or kept. Reads and refused calls are left out, because the script records what changed the project, and a verb that raised changed nothing.

Returns:

Type Description
str

A Python script; running it rebuilds this session's project from the same inputs.

UnitsRequired

UnitsRequired(message: str, required: Sequence[str] = ('length_unit',))

Bases: UnitError

Raised when an operation needs units that have not been defined.

required names the unit settings that are missing (by default ('length_unit',)), so the caller can ask for exactly those.

UnitSystem dataclass

UnitSystem(name: str, units: dict = dict(), base: UnitSystem | None = None)

A named mapping of dimension tag to display unit.

base is the coherent system a derived system was made from, such as in-slinch-lbf-s for in-slinch-lbf-s (g), which shows accelerations in g. It is None for a coherent system. UNV export writes the coherent system (see coherent), because its units block cannot declare g.

The angular, moment, density and modal units are filled in from the base units when the system does not name them.

Methods:

Name Description
unit

Display unit for a dimension tag or dimension expression.

transform

(scale, offset) converting a value in this system's unit to SI,

factor

SI value per display unit, for dimensions with no offset.

from_si

Convert SI values to this system's display unit for dimension.

to_si

Convert values from this system's units into SI.

label

Display unit text, the same as unit; empty for 'unknown'.

label_text

Display unit for plain-text output, with superscript

label_ascii

Display unit in plain ASCII, with exponents as carets: in/s^2.

label_html

Display unit as HTML, drawn as a stacked fraction when it has a

with_units

A copy of this system with some dimensions' units replaced.

Attributes:

Name Type Description
coherent UnitSystem

The coherent system this one is based on, or this system if it

Attributes
coherent property
coherent: UnitSystem

The coherent system this one is based on, or this system if it is coherent.

Methods:
unit
unit(dimension: str) -> str

Display unit for a dimension tag or dimension expression.

Expressions are built from the base units: in in-slinch-lbf-s, 'acceleration/force' gives '(in/s**2)/lbf'.

Parameters:

Name Type Description Default
dimension str

A dimension tag, such as 'acceleration', or an expression, such as 'acceleration/force'.

required

Returns:

Type Description
str

The unit string in pint's spelling; empty for 'unknown'.

Raises:

Type Description
UnitError

If the system has no unit for a dimension in the expression.

transform
transform(dimension: str) -> tuple[float, float]

(scale, offset) converting a value in this system's unit to SI, si = value * scale + offset.

Parameters:

Name Type Description Default
dimension str

A dimension tag or expression, such as 'acceleration' or 'acceleration/force'.

required

Returns:

Type Description
tuple of (float, float)

The scale and offset. The offset is non-zero only for temperature; (1.0, 0.0) for 'unknown'.

Raises:

Type Description
UnitError

If an expression includes an offset unit such as degF.

factor
factor(dimension: str) -> float

SI value per display unit, for dimensions with no offset.

Parameters:

Name Type Description Default
dimension str

A dimension tag or expression, such as 'acceleration' or 'acceleration/force'.

required

Returns:

Type Description
float

What a value in this system's unit is multiplied by to give SI; divide an SI value by it to display it.

Raises:

Type Description
UnitError

If the display unit has an offset (degC, degF).

from_si
from_si(values: ArrayLike, dimension: str) -> Any

Convert SI values to this system's display unit for dimension.

Parameters:

Name Type Description Default
values array_like

Values in SI.

required
dimension str

A dimension tag or expression, such as 'acceleration' or 'force'.

required

Returns:

Type Description
array_like

The same values in this system's units.

to_si
to_si(values: ArrayLike, dimension: str) -> Any

Convert values from this system's units into SI.

Parameters:

Name Type Description Default
values array_like

Values in this system's units.

required
dimension str

A dimension tag or expression, such as 'acceleration'.

required

Returns:

Type Description
array_like

The same values in SI.

label
label(dimension: str) -> str

Display unit text, the same as unit; empty for 'unknown'.

Parameters:

Name Type Description Default
dimension str

A dimension tag or expression, such as 'acceleration' or 'force'.

required

Returns:

Type Description
str

The unit string in this system.

label_text
label_text(dimension: str) -> str

Display unit for plain-text output, with superscript exponents: in/s².

Parameters:

Name Type Description Default
dimension str

A dimension tag or expression, such as 'acceleration' or 'force'.

required

Returns:

Type Description
str

The label as plain text; empty for 'unknown'.

label_ascii
label_ascii(dimension: str) -> str

Display unit in plain ASCII, with exponents as carets: in/s^2.

This is for renderers that drop characters they cannot draw. VTK's 3-D axis titles drop unicode superscripts in every text mode, so label_text's (in/s²)²/Hz is drawn as (in/s)/Hz there.

Parameters:

Name Type Description Default
dimension str

A dimension tag or expression, such as 'acceleration' or 'force'.

required

Returns:

Type Description
str

The label with no unicode characters; empty for 'unknown'.

label_html
label_html(dimension: str) -> str

Display unit as HTML, drawn as a stacked fraction when it has a denominator.

Parameters:

Name Type Description Default
dimension str

A dimension tag or expression, such as 'acceleration' or 'force'.

required

Returns:

Type Description
str

The label with HTML superscripts; empty for 'unknown'.

with_units
with_units(name: str | None = None, **overrides: str) -> UnitSystem

A copy of this system with some dimensions' units replaced.

IN_LBF_S.with_units(acceleration='g') shows acceleration in g and every other dimension in inch-pound-second units. The copy's base is this system's coherent system.

Parameters:

Name Type Description Default
name str

What to call the derived system. The default is this system's name followed by ' (custom)'.

None
**overrides str

Dimension/unit pairs to change.

{}

Returns:

Type Description
UnitSystem

A copy with those units replaced.

Raises:

Type Description
UnitError

If a unit cannot be read or is not of its dimension.

Functions:

check_compatibility

check_compatibility(objects: Mapping[str, Any], geometry_name: str | None = None, object_groups: Sequence[Mapping[str, Any]] | None = None) -> Report

Check every object in a test against the geometry it answers to.

An object linked into a group that holds a geometry is judged against that geometry, so a FEM shape set beside its own FEM mesh is consistent whichever geometry is active. Everything else is judged against geometry_name. A modal object is judged against the shape sets in its group, or against every set in the project when it is not linked.

Parameters:

Name Type Description Default
objects Mapping[str, Any]

The test's objects, by name.

required
geometry_name str

The geometry everything not linked to one is judged against, normally the active geometry. When it is omitted or names no geometry in objects, the first geometry found is used.

None
object_groups sequence of Mapping

The project's object groups, which say which geometry each object answers to.

None

Returns:

Type Description
Report

What is consistent and what is not, object by object.

frequency_axis

frequency_axis(mode: str | bool | None = ...) -> str

Read or set how frequency axes are drawn in every plot, 3-D view and report figure: 'log', 'linear', or 'default' (each kind of data by its own convention: an SRS on a log axis, the rest linear).

The setting belongs to the session, not to a project, and is not saved.

Parameters:

Name Type Description Default
mode ('log', 'linear', 'default')

The choice to make. When omitted, the current one is returned. True and False stand for 'log' and 'linear', None for 'default'.

'log'

Returns:

Type Description
str

The setting after the call.

Raises:

Type Description
ValueError

If mode is none of these.

export_file

export_file(obj: Any, path: str | PathLike, format: str | None = None, unit_system: UnitSystem | None = None, **kwargs: Any) -> None

Write obj to a file in a format chosen by name or by suffix.

unit_system is the system to write in; without one the stored values are written as they are. When no exporter can write the object to that format, the ValueError lists the formats it can be written as, since the fix is nearly always a different format. A ValueError is also raised when a format that writes DOFs as node numbers (UNV, ADF functions and time histories, Exodus, the sdynpy data array) is asked to write modal coordinates. A leading ~ in the path is expanded.

Parameters:

Name Type Description Default
obj object

What to write: a geometry, data, shapes, a project, and so on.

required
path str or PathLike

Where; the suffix picks the format when format is not given.

required
format str

An exporter by name (hertzforge.io.exporters), whatever the suffix says.

None
unit_system UnitSystem

The units to write in; the stored values as they are when omitted.

None
**kwargs Any

Passed to the format's writer, e.g. an ESCDF file's created_by.

{}

Returns:

Type Description
None

from_sep005

from_sep005(timeseries: dict[str, Any] | list[dict[str, Any]]) -> Any

Convert SEP 005 timeseries to TimeHistory objects.

history = hertzforge.from_sep005({'data': y, 'fs': 256.0,
                                      'name': 'run 4',
                                      'unit_str': 'm/s²'})

One dict returns one TimeHistory. A list, the standard's form for several series, returns {name: TimeHistory}, with a repeated name numbered 'name (2)' and so on, as in the project tree. The channels are named by channel_name, or numbered from 1 without it, and the series name becomes the comment.

A unit_str entry that parses is declared on its channel, so the values are converted to SI as define_units converts them, since the producer stated the unit. One that does not parse leaves that channel's values as they are and keeps the unit string in dimension_hint, unless the series quantity letter has already put a dimension there. Values are never scaled by a guess.

Raises ValueError, with the reason, for a series with no data, data with more than two dimensions, neither fs nor time, a time vector of the wrong length, or a channel_name list that does not match the channel count.

Parameters:

Name Type Description Default
timeseries dict or list of dict

One SEP 005 series, or a list of them.

required

Returns:

Type Description
TimeHistory or dict of str to TimeHistory

One for one dict; for a list, every series by name.

import_file

import_file(path: str | PathLike, format: str | None = None, progress: Any | None = None, **kwargs: Any) -> Any

Import a file, returning the Hertzforge object it contains.

Units may be declared here (for example length_unit='m') for sources that do not record them; without a declaration the object imports without units, holding the file's values as they are until define_units() is called. format chooses an importer by name instead of by recognizing the file; a .hforge or .vdyn file is always read by the native loader, and a control run's folder (or the run.json in it) is read as the project file it converts to, converting it first when it has none or the run has changed since (run_convert.converted). progress is a (done, total) callable, used where the reader can count (a project file's objects, a Rattlesnake run's samples) and ignored where it cannot: a UFF file is read in one parse with no partial progress to report. A leading ~ in the path is expanded.

Raises FileNotFoundError when there is no file at path, IsADirectoryError for a folder that is not a run folder, and ValueError for an unknown format or a file no importer recognizes (the message says what the file appears to be, where that can be told).

Parameters:

Name Type Description Default
path str or PathLike

The file to read.

required
format str

An importer by name, rather than the one the file is recognized as.

None
progress callable

Called as progress(done, total) where the reader can count.

None
**kwargs Any

Passed to the importer: declared units (length_unit='m'), a window of a long run (start=, stop=), channels, and so on.

{}

Returns:

Type Description
object

The object the file holds; a dict of them by name for a file that holds several, and a Project for a project file.

importers

importers() -> list[Importer]

Every format Hertzforge can read, in the order they are tried.

load

load(path: str | PathLike, progress: Callable[[int, int], None] | None = None) -> Any

Load a .hforge or .vdyn file: the object it holds, or a whole test.

The stamp inside the file decides how it is read, not the suffix.

For a whole test, progress is called as (objects loaded, objects in the file), once at the start with 0 and once per object, because a large project can take minutes to load and only the reader knows how far along it is. For a single-object file it is not called, since loading one object is a single step.

Parameters:

Name Type Description Default
path str or PathLike

The .hforge or .vdyn file.

required
progress callable

Called as progress(loaded, total), once up front and once per object.

None

Returns:

Type Description
object

The object the file holds, or a Project for a whole test.

Raises:

Type Description
ValueError

When the file has neither the .hforge nor the .vdyn stamp, was written with a newer schema, or holds nothing this reader recognizes.

register_importer

register_importer(name: str, description: str, sniff: Callable, load: Callable, project_type: Callable | None = None) -> None

Add a format to the importers. Registered importers are tried in order, so one added later is tried last.

Parameters:

Name Type Description Default
name str

The importer's name, which import_file(format=) takes.

required
description str

What the format is, as a file dialog lists it.

required
sniff callable

sniff(path) -> bool: whether a file is this format.

required
load callable

load(path, **kwargs): the file read into objects.

required
project_type callable

project_type(path) -> str or None: the project type the file declares, for a format that carries one.

None

Returns:

Type Description
None

save

save(obj: Any, path: str | PathLike, compress: bool = False) -> None

Save one Hertzforge object to a .hforge (HDF5) file.

Raises TypeError for an object of a kind the format does not hold, and ValueError for a .vdyn path.

Parameters:

Name Type Description Default
obj object

The object to save.

required
path str or PathLike

Where; .hforge is added when the suffix is not there.

required
compress bool

Write the large arrays with gzip (compressed), for archiving.

False

Returns:

Type Description
None

mixed_run

mixed_run(run: str | PathLike, per_octave: int | None = None, *, last: float | None = None, geometry: str | PathLike | None = None, length_unit: str | None = None, photos: Any = None) -> Project

Work a Rattlesnake random run with a sine sweep under it up into a project, both halves.

project = hertzforge.mixed_run('run.nc4')

This does everything random_vibration_run does (imports the run, averages and bands the PSDs, bands the specification, computes the coherence, and brings in the geometry and photographs), and then the sine half: each tone's level is extracted from the same recording against the sweep specification the file carries. The run records that it is both, so the project's type is set to Random and Sine. A run with no sine sweep specification raises ValueError instead of being worked up as half of what was asked for; use random_vibration_run for it. The keyword arguments are the same as random_vibration_run's.

Parameters:

Name Type Description Default
run str or PathLike

The controller's .nc4.

required
per_octave int

Bands per octave for the banded PSD and specification. Defaults to 6.

None
last float

Import only the last last seconds of the run's streams; a shorter run is imported whole.

None
geometry str or PathLike

A geometry file to import and link to the run.

None
length_unit str

The geometry's length unit, for a file that does not say.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None

Returns:

Type Description
Project

The worked-up project, of type Random and Sine.

random_vibration_report

random_vibration_report(run: Any = ASK, path: str | PathLike | None = None, *, last: float | None = None, geometry: Any = None, photos: Any = None, per_octave: int | None = None, unit_system: Any = None, marking: str | None = None) -> Any

Read a Rattlesnake random vibration run and write an HTML report.

hertzforge.random_vibration_report('run.nc4', 'report.html')
hertzforge.random_vibration_report(
    'run.nc4', 'report.html', last=100.0,
    geometry='article.stp', photos='setup_photos/')
hertzforge.random_vibration_report('run.nc4', 'reports/')

Given a list of runs, it writes one report for each and returns the list. A run given without a geometry argument means no geometry. The Python API opens no file dialog, so a run left out, or ASK in either place, is refused with a message to name the file; in the app the shell asks.

path may be the file to write, or a folder the report is written into under the run's own name with an .html extension. Without a path the report is written beside the run. Several runs need a folder or no path; a single file name raises ValueError.

The whole workflow runs in one call: import the run (or only its last last seconds; a shorter run is imported whole), detect the averaging, compute the PSDs, put them and the specification on octave bands, compute the multiple coherence, bring in the geometry and the photographs when they are given, generate the Random Vibration report, and write it as one self-contained HTML file. The keyword arguments are random_vibration_run's except length_unit, plus unit_system and marking for the report.

It is random_vibration_run followed by generate_report and export_report. Use those instead when the project is wanted afterwards, to write the test summary or to save it as .hforge.

Parameters:

Name Type Description Default
run str, os.PathLike, sequence of them, or `hertzforge.ASK`

The controller's .nc4, or a list of them for a batch. Required: left out, or ASK, it is refused with a message to name it, since the Python API opens no file dialog.

ASK
path (str, PathLike or None)

The file to write, or a folder (one that exists, or a name ending in a separator) the report is written into under the run's own name. Beside the run when omitted. Several runs need a folder or None.

None
last float

Import only the last last seconds of the run; a shorter run is imported whole.

None
geometry str, os.PathLike, `hertzforge.ASK` or None

A geometry file to import and link to the run. None, the default, means no geometry; ASK is refused, as for the run.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None
per_octave int

Bands per octave for the banded PSD and specification. Defaults to 6.

None
unit_system UnitSystem

The units the report is written in. Defaults to the package default, 'in-slinch-lbf-s (g)'.

None
marking str

The banner across the top and bottom of every page. 'UNCLASSIFIED' when omitted.

None

Returns:

Type Description
str or list of str

The path written, or a list of them when several runs were chosen or a list of runs was given.

random_vibration_run

random_vibration_run(run: str | PathLike, per_octave: int | None = None, *, last: float | None = None, geometry: str | PathLike | None = None, length_unit: str | None = None, photos: Any = None) -> Project

Work a Rattlesnake random vibration run up into a project.

project = hertzforge.random_vibration_run('run.nc4')
project = hertzforge.random_vibration_run(
    'run.nc4', last=100.0, geometry='article.stp', length_unit='mm',
    photos='setup_photos/')

These are the steps the app takes from a controller file to a finished project, in the same order: import the run, average PSDs from the control time histories, put those on proportional bands, put the specification on the same bands with its limits (the report compares the banded measurement with the banded requirement), and compute how much of each response the drives account for. The run records that it is a random vibration test, so the project's type is set to Random Vibration.

The averaging is what Detect finds: the controller's own frame length, window and overlap from the file, with the start and the number of frames worked out from the record (where the run is at level and how many frames that stretch holds). A script, an import and a click on Detect therefore give the same numbers.

The other arguments are what the app's tree asks for after the run is imported, so a script never has to open the app: the article's geometry, with its length unit given when the file does not carry one; the setup photographs, as a folder of png or jpeg files, one file, or a list of files in the order they should appear; and, for a run too long to hold in memory, last, the number of seconds before the end to import. last is the same window the import dialog's Last field sets, and a run shorter than that is imported whole. The geometry and the photographs are linked into the run's own group, so the report can read them against the channel table. A run with no time data raises ValueError.

Parameters:

Name Type Description Default
run str or PathLike

The controller's .nc4.

required
per_octave int

Bands per octave for the banded PSD and specification. Defaults to 6.

None
last float

Import only the last last seconds of the run's streams.

None
geometry str or PathLike

A geometry file to import and link to the run.

None
length_unit str

The geometry's length unit, for a file that does not say.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several.

None

Returns:

Type Description
Project

The worked-up project, of type Random Vibration.

report_kind

report_kind(run: str | PathLike) -> str

Which one-call reports a Rattlesnake run gets: 'random', 'mixed', 'sine' or 'sysid', from the project type the file records.

'mixed' is a random run with a sweep under it, which gets both a random report and a sine report (run_report). 'sysid' is also given for a streamed save shaped like a system identification (two streams, a quiet one and then a loud one); the app asks in that case, and this function chooses 'sysid'. A run of a type with no one-call report, such as a modal or transient run, raises ValueError.

Parameters:

Name Type Description Default
run str or PathLike

The controller's .nc4.

required

Returns:

Type Description
str

'random', 'mixed', 'sine' or 'sysid'.

run_report

run_report(run: Any = ASK, path: str | PathLike | None = None, *, last: Any = None, kinds: Any = None, geometry: Any = None, photos: Any = None, per_octave: int | None = None, unit_system: Any = None, marking: str | None = None, progress: Any = None) -> Any

Read a Rattlesnake run and write the report its type calls for.

hertzforge.run_report('run.nc4', 'report.html')
hertzforge.run_report('run.nc4', 'reports/')
hertzforge.run_report(['a.nc4', 'b.nc4'], 'reports/',
                          geometry='article.stp')

This one-call report reads the run's own type (report_kind) and writes that report. A random run gets random_vibration_report's report, a sweep sine_report's, a system identification system_id_report's, and a random and sine run gets both a random and a sine report, as <name>_random.html and <name>_sine.html. For that run the random report reads only the last last seconds when they are given, and the sine report always reads the whole run, since a sweep cut short loses tones. A streamed save that looks like a system identification (two streams, quiet and then loud) is treated as one without asking. The function is named for what it takes, since hertzforge.report is the rendering package.

The asking, the batch and the folder follow the same rules as the typed functions, and a batch may mix kinds. The keyword arguments are the union of theirs, and per_octave is used only for the random reports.

Every run's kind is read before any report is written, so a batch holding a run with no one-call report raises ValueError before writing anything instead of stopping partway through. kinds overrides the reading run by run, for example for a restarted random run that was taken for a system identification or a file that records no type, and last can be given run by run too. progress(done, total) is called after each run, which is what the app's progress bar and Cancel use; a run is the smallest step, so a cancel takes effect between runs.

Parameters:

Name Type Description Default
run str, os.PathLike, sequence of them, or `hertzforge.ASK`

The controller's .nc4, or a list of them for a batch. Required: left out, or ASK, it is refused with a message to name it, since the Python API opens no file dialog.

ASK
path (str, PathLike or None)

The file to write, or a folder (one that exists, or a name ending in a separator) the report is written into under the run's own name. Beside the run when omitted. Several runs need a folder or None.

None
last float or Mapping

Import only the last last seconds of the run; a shorter run is imported whole. For a random and sine run it applies to the random report only, and the sine report reads the whole run. A mapping gives each run its own value, by path; a run it leaves out, or maps to None, is read whole.

None
kinds Mapping

The report each run gets, by path: 'random', 'mixed' (a random and a sine report), 'sine' or 'sysid'. Any other value raises ValueError. A run it leaves out gets the report its file records (report_kind).

None
geometry str, os.PathLike, `hertzforge.ASK` or None

A geometry file to import and link to the run. None, the default, means no geometry; ASK is refused, as for the run.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None
per_octave int

Bands per octave for the banded PSD and specification. Defaults to 6. Only the random reports use it.

None
unit_system UnitSystem

The units the report is written in. Defaults to the package default, 'in-slinch-lbf-s (g)'.

None
marking str

The banner across the top and bottom of every page. 'UNCLASSIFIED' when omitted.

None
progress callable

Called as progress(done, total) before the first run and after each one. It may raise to stop the batch between runs.

None

Returns:

Type Description
str or list of str

The path written, or a list of them when several runs were chosen, a list of runs was given, or a run was random and sine (two reports).

sine_report

sine_report(run: Any = ASK, path: str | PathLike | None = None, *, last: float | None = None, geometry: Any = None, photos: Any = None, unit_system: Any = None, marking: str | None = None) -> Any

Read a Rattlesnake sine sweep run and write an HTML report.

hertzforge.sine_report('sweep.nc4', 'report.html')
hertzforge.sine_report('sweep.nc4', 'reports/')

This is random_vibration_report for a sweep: the batch and folder rules are the same, the project is worked up by sine_run, and the Sine Sweep report is written as one self-contained HTML file. Returns the path written, or the list of them when several runs were chosen. marking is the banner across every page of the report, 'UNCLASSIFIED' when omitted.

Parameters:

Name Type Description Default
run str, os.PathLike, sequence of them, or `hertzforge.ASK`

The controller's .nc4, or a list of them for a batch. Required: left out, or ASK, it is refused with a message to name it, since the Python API opens no file dialog.

ASK
path (str, PathLike or None)

The file to write, or a folder (one that exists, or a name ending in a separator) the report is written into under the run's own name. Beside the run when omitted. Several runs need a folder or None.

None
last float

Import only the last last seconds of the run; a shorter run is imported whole.

None
geometry str, os.PathLike, `hertzforge.ASK` or None

A geometry file to import and link to the run. None, the default, means no geometry; ASK is refused, as for the run.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None
unit_system UnitSystem

The units the report is written in. Defaults to the package default, 'in-slinch-lbf-s (g)'.

None
marking str

The banner across the top and bottom of every page. 'UNCLASSIFIED' when omitted.

None

Returns:

Type Description
str or list of str

The path written, or a list of them when several runs were chosen or a list of runs was given.

sine_run

sine_run(run: str | PathLike, *, last: float | None = None, geometry: str | PathLike | None = None, length_unit: str | None = None, photos: Any = None) -> Project

Work a Rattlesnake sine sweep run up into a project.

project = hertzforge.sine_run('sweep.nc4')

The run is imported, each tone's level is extracted from the control channels against the sweep specification the file carries, and the geometry and photographs are imported and linked the way random_vibration_run does it. The run records that it is a sine sweep, so the project's type is set to Sine Sweep. A run with no sine sweep specification, or no time data, raises ValueError; use random_vibration_run or mixed_run for a run without a sweep. The keyword arguments are random_vibration_run's except per_octave, which a sweep does not use.

Parameters:

Name Type Description Default
run str or PathLike

The controller's .nc4.

required
last float

Import only the last last seconds of the run's streams; a shorter run is imported whole.

None
geometry str or PathLike

A geometry file to import and link to the run.

None
length_unit str

The geometry's length unit, for a file that does not say.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None

Returns:

Type Description
Project

The worked-up project, of type Sine Sweep.

system_id_report

system_id_report(run: Any = ASK, path: str | PathLike | None = None, *, last: float | None = None, geometry: Any = None, photos: Any = None, unit_system: Any = None, marking: str | None = None) -> Any

Read a Rattlesnake system identification and write an HTML report.

hertzforge.system_id_report('sysid.nc4', 'sysid.html')

This is system_id_run followed by the System ID report: the measured FRFs, the coherence map, and the signal-to-noise ratio of the measurement at each line and for each channel. Where the ratio falls to zero decibels, the measurement is of the ambient noise, not of the structure.

Batches and folders work as in random_vibration_report: a list of runs writes one report each, and path may be the file to write or the folder to write into.

Parameters:

Name Type Description Default
run str, os.PathLike, sequence of them, or `hertzforge.ASK`

The controller's .nc4, or a list of them for a batch. Required: left out, or ASK, it is refused with a message to name it, since the Python API opens no file dialog.

ASK
path (str, PathLike or None)

The file to write, or a folder (one that exists, or a name ending in a separator) the report is written into under the run's own name. Beside the run when omitted. Several runs need a folder or None.

None
last float

Import only the last last seconds of the run; a shorter run is imported whole.

None
geometry str, os.PathLike, `hertzforge.ASK` or None

A geometry file to import and link to the run. None, the default, means no geometry; ASK is refused, as for the run.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None
unit_system UnitSystem

The units the report is written in. Defaults to the package default, 'in-slinch-lbf-s (g)'.

None
marking str

The banner across the top and bottom of every page. 'UNCLASSIFIED' when omitted.

None

Returns:

Type Description
str or list of str

The path written, or a list of them when several runs were chosen or a list of runs was given.

system_id_run

system_id_run(run: str | PathLike, *, last: float | None = None, geometry: str | PathLike | None = None, length_unit: str | None = None, photos: Any = None) -> Project

Work a Rattlesnake system identification up into a project.

project = hertzforge.system_id_run('sysid.nc4')

These are the steps the app takes, in the same order: import the recording, name the two streams (the ambient and the driven), and compute the FRFs from the driven stream by H1, the controller's own estimator, since the excitation is known and the noise is on the response. Then compute the multiple coherence, and average a PSD from each stream on the same frames, since the signal-to-noise ratio is a ratio of densities and is only defined on lines both hold. The project's type is set to System ID. A recording with no time data raises ValueError.

last, geometry, length_unit and photos mean the same as in random_vibration_run. The ambient stream, the geometry and the photographs are linked into the driven stream's group.

Parameters:

Name Type Description Default
run str or PathLike

The controller's .nc4.

required
last float

Import only the last last seconds of the run's streams; a shorter run is imported whole.

None
geometry str or PathLike

A geometry file to import and link to the run.

None
length_unit str

The geometry's length unit, for a file that does not say.

None
photos str, os.PathLike or sequence of them

A folder of photographs, one photograph, or several in order.

None

Returns:

Type Description
Project

The worked-up project, of type System ID.

export_figure

export_figure(path: str | PathLike, data: Any = None, *, renderer: str | PathLike | None = None, specification: Any = None, channel: str | None = None, mode: str = 'curves', geometry: Any = None, shapes: Any = None, dofs: tuple[Any, ...] | None = None, name: str | None = None, caption: str = '', theme: str | None = None, unit_system: UnitSystem | None = None, fill: bool = False, channels: Sequence[str] | None = None, max_points: int | None = None, component: str = 'magnitude', frame: Sequence[str] | None = None, node_dots: bool | None = None) -> str

Write one interactive figure as a JSON data file, and optionally the script that draws it, for a page that mounts the figure itself.

hertzforge.export_figure('spec.json', psd, specification=spec,
                             channel='101Z+', theme='light',
                             renderer='hertzforge-figure.js')

The figure is the one export_html writes, split in two. The data file holds this figure alone. The renderer is one script for every figure, the same viewers the HTML file carries; a page loads it from its own site and draws a figure into an element of its own:

<div id="spec"></div>
<script src="hertzforge-figure.js"></script>
<script src="page.js"></script>   // HertzforgeFigure.load(
                                  //   element, 'spec.json')

So a page whose Content-Security-Policy allows no inline script and no frames can still show the figure. HertzforgeFigure.mount( element, data, options) draws data already fetched, and load( element, url, options) fetches it first; with {pageScroll: true} the figure leaves the wheel and a vertical swipe to the page and zooms on Ctrl or Cmd with the wheel. The figure's styles are scoped to that element. The renderer refuses data written for another format (FIGURE_FORMAT), so a page never draws a figure it would misread.

Parameters:

Name Type Description Default
path str or path - like

Where the .json goes.

required
data DataArray or ShapeSet

What a plot draws.

None
renderer str or path - like

Where to write the renderer script as well. It is the same for every figure this version writes, so a page needs it once.

None
specification Specification

What data is drawn against.

None
channel str

The one control channel of a comparison to draw.

None
mode str

The plot's reading.

'curves'
geometry Geometry

Makes the figure a scene.

None
shapes ShapeSet

What the scene animates.

None
dofs (str, object) or (str, object, Geometry)

A quantity and an object: its DOFs of that quantity, as arrows. Their node ids are geometry's own unless a third item names the geometry the object was measured on; then each is drawn at the nearest node of geometry, as DOF Mapping matches a test to a model. A DOF with no place on geometry is refused by name.

None
name str

What the legend calls data.

None
caption str

A line under the figure.

''
theme ('light', 'dark')

Fixes the figure's theme; unset, it follows the reader's.

'light'
unit_system UnitSystem

The units it is drawn in.

None
fill bool

Lay the figure out as the report page does, at its own height; True fills the element, which must then have a height.

False
channels sequence of str

The records of data to keep, by response DOF ('101Z+').

None
max_points int

The most points a plot's curve keeps; at least 16.

None
component ('magnitude', 'phase', 'real', 'imag')

How a plot of complex data reads, as the app's drop-down reads it.

'magnitude'
frame sequence of str

Element groups of geometry the scene opens framed on.

None
node_dots bool

Draw a dot at each node of the scene. Unset, the dots are drawn on a geometry of at most NODE_DOT_LIMIT (1000) drawn nodes and left off a larger one, where they tile the surface.

None

Returns:

Type Description
str

The data file's path.

Raises:

Type Description
ValueError

As export_html raises them.

export_html

export_html(path: str | PathLike, data: Any = None, *, specification: Any = None, channel: str | None = None, mode: str = 'curves', geometry: Any = None, shapes: Any = None, dofs: tuple[Any, ...] | None = None, name: str | None = None, caption: str = '', theme: str | None = None, unit_system: UnitSystem | None = None, fill: bool = True, channels: Sequence[str] | None = None, max_points: int | None = None, component: str = 'magnitude', frame: Sequence[str] | None = None, node_dots: bool | None = None) -> str

Write one interactive figure as a single self-contained HTML file.

hertzforge.export_html('spec.html', psd, specification=spec,
                           channel='101Z+', theme='light')
hertzforge.export_html('modes.html', geometry=g, shapes=modes)

The figure is the one a report draws, with zoom, pan and the readout on a plot, and turning and animation on a scene, and nothing else: no title and no marking. With fill the figure fills whatever frame holds it, such as an iframe or a box on a slide, and redraws when the frame changes size. Everything the page needs is in the file, so it opens offline.

Given a geometry, the figure is a scene of it, with its shapes animating or, with dofs, the DOFs one object measures as a quantity, ('acceleration', frf), drawn as labeled arrows; a test's DOFs drawn on a model, ('acceleration', history, test), are placed by position on it rather than by node id. frame names element groups of the geometry the scene opens framed on, the rest of it still drawn around them; the shapes still swing by the whole model's size. Otherwise it is a plot of data, against specification and its zones when one is given, of one channel when named, in mode ('curves', 'stage', 'cmif', 'mac' or 'map').

channels and max_points make the file smaller: the first keeps only those records of data (and of specification), the second thins every curve of a plot to that many points, keeping every peak and dip, and says so under the figure. export_figure writes the same figure as a data file and a script, for a page that cannot carry an inline script.

Parameters:

Name Type Description Default
path str or path - like

Where the .html goes.

required
data DataArray or ShapeSet

What a plot draws.

None
specification Specification

What data is drawn against.

None
channel str

The one control channel of a comparison to draw.

None
mode str

The plot's reading.

'curves'
geometry Geometry

Makes the figure a scene.

None
shapes ShapeSet

What the scene animates.

None
dofs (str, object) or (str, object, Geometry)

A quantity and an object: its DOFs of that quantity, as arrows. Their node ids are geometry's own unless a third item names the geometry the object was measured on; then each is drawn at the nearest node of geometry, as DOF Mapping matches a test to a model. A DOF with no place on geometry is refused by name.

None
name str

What the legend calls data.

None
caption str

A line under the figure.

''
theme ('light', 'dark')

Fixes the figure's theme; unset, it follows the reader's.

'light'
unit_system UnitSystem

The units it is drawn in.

None
fill bool

Fill the frame; False lays it out as the report page does.

True
channels sequence of str

The records of data to keep, by response DOF ('101Z+').

None
max_points int

The most points a plot's curve keeps; at least 16.

None
component ('magnitude', 'phase', 'real', 'imag')

How a plot of complex data reads, as the app's drop-down reads it.

'magnitude'
frame sequence of str

Element groups of geometry the scene opens framed on.

None
node_dots bool

Draw a dot at each node of the scene. Unset, the dots are drawn on a geometry of at most NODE_DOT_LIMIT (1000) drawn nodes and left off a larger one, where they tile the surface.

None

Returns:

Type Description
str

The path written.

Raises:

Type Description
ValueError

When neither data nor geometry is given, when channels names a channel data does not hold, when nothing of the figure can be drawn, when max_points is under 16, when component is not one of the four, when frame or node_dots is given without a geometry or frame names a group it does not have, or when a DOF of dofs has no place on geometry.

convert

convert(values: ArrayLike, from_unit: str, to_unit: str) -> Any

values converted from one unit to another, through SI.

Parameters:

Name Type Description Default
values array - like

The values, in from_unit.

required
from_unit str

The unit they are in, for example 'in/s**2'.

required
to_unit str

The unit wanted, of the same dimension.

required

Returns:

Type Description
ndarray or float

The values in to_unit, the shape of values.

si_factor

si_factor(unit: str, dimension: str | None = None) -> float

Multiplier converting values in unit to SI.

Affine units (degC, degF) have no single factor; convert those with to_si and from_si.

Parameters:

Name Type Description Default
unit str

The unit, for example 'mm' or 'lbf'.

required
dimension str

If given, the unit is checked to be of this dimension.

None

Returns:

Type Description
float

The factor: a value in unit times this is the value in SI.

Raises:

Type Description
UnitError

If the unit has an offset, cannot be read, or is not of dimension.