pyOMA.core.PreProcessingTools.GeometryProcessor#

class pyOMA.core.PreProcessingTools.GeometryProcessor(nodes=None, lines=None, parent_childs=None)[source]#

Bases: object

Stores structural geometry for mode-shape visualisation.

Holds node coordinates, structural connectivity lines, and parent-child (skewed-sensor) relationships. Passed to ModeShapePlot after loading with load_geometry().

Parameters:
  • nodes (dict, optional) – Mapping {node_name: (x, y, z)}.

  • lines (list of (str, str), optional) – Connectivity list [(node_start, node_end), ...].

  • parent_childs (list of tuple, optional) – Skewed-sensor parent-child relations, each entry (parent_node, x_amp, y_amp, z_amp, child_node, x_amp, y_amp, z_amp).

Notes

Conventions:

  • chan_dofs = [(chan, node, (x_amplif, y_amplif, z_amplif)), ...]

  • Channels are numbered 0 ... N-1 (complete sequence).

  • Node names are strings; coordinates are (x, y, z) float tuples.

  • Lines are unordered pairs (node_start, node_end).

  • Parent-child entries are 8-tuples as described in Parameters.

Todo

  • change parent_child assignment to skewed coordinate

  • change parent_childs to az, elev

__init__(nodes=None, lines=None, parent_childs=None)[source]#

Methods

__init__([nodes, lines, parent_childs])

add_line(line)

add_lines(lines)

add_node(node_name, coordinate_list)

add_nodes(nodes)

add_parent_child(ms)

add_parent_childs(parent_childs)

lines_loader(filename)

lines file uses one header line tab-separated file nodenames are treated as strings

lines_saver(filename, lines)

Write a lines file readable by lines_loader(): one header line, then tab-separated node_start, node_end rows.

load_geometry(nodes_file[, lines_file, ...])

Load geometry from tab-separated text files.

nodes_loader(filename)

nodes file uses one header line tab-separated file node is treated as a string x,y,z are treated as floats (in scientific format)

nodes_saver(filename, nodes)

Write a nodes file readable by nodes_loader(): one header line, then tab-separated node_name, x, y, z rows.

parent_childs_loader(filename)

lines file uses one header line tab-separated file nodenames are treated as strings amplification factors are treated as floats

parent_childs_saver(filename, parent_childs)

Write a parent-child file readable by parent_childs_loader(): one header line, then tab-separated 8-tuple rows.

rescale_geometry(factor)

save_geometry(nodes_file[, lines_file, ...])

Save geometry to tab-separated text files.

take_line([line, line_ind])

take_node(node_name)

take_parent_child([ms, ms_ind])

static lines_loader(filename)[source]#

lines file uses one header line tab-separated file nodenames are treated as strings

static lines_saver(filename, lines)[source]#

Write a lines file readable by lines_loader(): one header line, then tab-separated node_start, node_end rows.

Parameters:
  • filename (str) – Path to write to.

  • lines (list of (str, str)) – Connectivity list [(node_start, node_end), ...].

classmethod load_geometry(nodes_file, lines_file=None, parent_childs_file=None)[source]#

Load geometry from tab-separated text files.

Parameters:
  • nodes_file (str) – Path to the nodes file (node name + x, y, z coordinates, tab-separated, one header line).

  • lines_file (str, optional) – Path to the lines file (start_node, end_node pairs, tab-separated).

  • parent_childs_file (str, optional) – Path to the parent-child file describing skewed-sensor relationships.

Returns:

Populated geometry object ready to pass to ModeShapePlot.

Return type:

GeometryProcessor

static nodes_loader(filename)[source]#

nodes file uses one header line tab-separated file node is treated as a string x,y,z are treated as floats (in scientific format)

static nodes_saver(filename, nodes)[source]#

Write a nodes file readable by nodes_loader(): one header line, then tab-separated node_name, x, y, z rows.

Parameters:
  • filename (str) – Path to write to.

  • nodes (dict) – Mapping {node_name: (x, y, z)}.

static parent_childs_loader(filename)[source]#

lines file uses one header line tab-separated file nodenames are treated as strings amplification factors are treated as floats

static parent_childs_saver(filename, parent_childs)[source]#

Write a parent-child file readable by parent_childs_loader(): one header line, then tab-separated 8-tuple rows.

Parameters:
  • filename (str) – Path to write to.

  • parent_childs (list of tuple) – Each entry (parent_node, x_ampl, y_ampl, z_ampl, child_node, x_ampl, y_ampl, z_ampl).

save_geometry(nodes_file, lines_file=None, parent_childs_file=None)[source]#

Save geometry to tab-separated text files.

Mirrors load_geometry()’s file layout so the result can be loaded back with it.

Parameters:
  • nodes_file (str) – Path to write the nodes file to.

  • lines_file (str, optional) – Path to write the lines file to. Skipped if None.

  • parent_childs_file (str, optional) – Path to write the parent-child file to. Skipped if None.