Skip to content

Strange Errors for Post-Processing Roving Hammer Data #17

@Nidish96

Description

@Nidish96

Firstly, kudos to the developers - this is a really well designed package for most things modal, thanks a lot!

I've encountered a very strange bug while doing polyreference fit on a roving hammer dataset. I had a plate specimen with 4 accelerometers attached to the corners and roving hammer data for a 4x4 grid of (16) points.

Calling sdynpy.PolyPy_GUI on this FRF works but whenever it tried to synthesize it throws the following error:

Traceback (most recent call last):
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/modal/sdynpy_polypy.py", line 801, in compute_shapes
    self.shapes, self.resynthesized_frfs, self.frfs_synth_residual, self.frfs_synth_kernel = (
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
            None if self.all_frequency_lines_checkbox.isChecked() else self.lines_at_resonance_spinbox.value(),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/modal/sdynpy_modeshape.py", line 509, in compute_shapes_multireference
    frfs_resynthesized = (output_shape.compute_frf(
                          ~~~~~~~~~~~~~~~~~~~~~~~~^
        frequencies,
        ^^^^^^^^^^^^
        responses=experimental_frf.response_coordinate[:, 0],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        references=experimental_frf.reference_coordinate[0, :],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        displacement_derivative=displacement_derivative)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/core/sdynpy_shape.py", line 516, in compute_frf
    reference_shape_matrix = flat_self[references]  # nm x ni
                             ~~~~~~~~~^^^^^^^^^^^^
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/core/sdynpy_shape.py", line 194, in __getitem__
    raise ValueError(
        'Not all indices in requested coordinate array exist in the shape\n{:}'.format(str(extra_keys)))
ValueError: Not all indices in requested coordinate array exist in the shape
['2Y+' '3Y+' '5Y+' '6Y+' '7Y+' '8Y+' '9Y+' '10Y+' '11Y+' '12Y+' '14Y+'
 '15Y+']

Scale for mode 1: (-3.715743983207786-3.3003698788755154j)
Scale for mode 2: (4.139374910612414+4.737157125173919j)
Traceback (most recent call last):
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/modal/sdynpy_polypy.py", line 801, in compute_shapes
    self.shapes, self.resynthesized_frfs, self.frfs_synth_residual, self.frfs_synth_kernel = (
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
            None if self.all_frequency_lines_checkbox.isChecked() else self.lines_at_resonance_spinbox.value(),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/modal/sdynpy_modeshape.py", line 509, in compute_shapes_multireference
    frfs_resynthesized = (output_shape.compute_frf(
                          ~~~~~~~~~~~~~~~~~~~~~~~~^
        frequencies,
        ^^^^^^^^^^^^
        responses=experimental_frf.response_coordinate[:, 0],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        references=experimental_frf.reference_coordinate[0, :],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        displacement_derivative=displacement_derivative)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/core/sdynpy_shape.py", line 516, in compute_frf
    reference_shape_matrix = flat_self[references]  # nm x ni
                             ~~~~~~~~~^^^^^^^^^^^^
  File "/home/nidish/.local/lib/python3.13/site-packages/sdynpy/core/sdynpy_shape.py", line 194, in __getitem__
    raise ValueError(
        'Not all indices in requested coordinate array exist in the shape\n{:}'.format(str(extra_keys)))
ValueError: Not all indices in requested coordinate array exist in the shape
['2Y+' '3Y+' '5Y+' '6Y+' '7Y+' '8Y+' '9Y+' '10Y+' '11Y+' '12Y+' '14Y+'
 '15Y+']

It basically says that all the indices except for the indices corresponding to my sensor locations can't be found. I tried to look at the code a little bit but I couldn't follow much unfortunately.

A Workaround

After snooping around in the code I realized that it kind of expects the response_dofs to be a superset of the reference_dofs . So in my code I just swapped the reference and responses (this is okay I guess since the linear FRF is symmetric anyways). Now everything works!

This is okay for me, but I certainly think that this must be a relatively simple bug.

Here's how I'm reading in the data for the workaround.

dat = sdn.uff.readuff('./Frequency Responses.uff')

# BUG WORKAROUND: Reversing the references and responses
for d in dat[58]:
    rdir = d.reference_direction
    rnd = d.reference_node

    d.reference_direction = d.response_direction
    d.reference_node = d.response_node

    d.response_direction = rdir
    d.response_node = rnd

Files to reproduce the bug

I've uploaded the dataset (as a UFF 58 file), a text file with node positions, and a python script using SDynPy here. This bug can be reproduced by commenting out lines 51-59 and running the script.
https://drive.google.com/drive/folders/1kTd67nOCJuEFnDVT8-OBlKnzplRy6f0R?usp=sharing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions