Repository navigation
Conversation
strip() filters eigenvalues per length, so the number of valid modes can differ between lengths (e.g. fewer modes at long half-wavelengths). The final padding loop copied every length into [:max_n_modes], raising "could not broadcast input array from shape (8,) into shape (10,)". It also sized the mode shapes as 4 * n_nodes DOF, which fails when m_all has more than one longitudinal term (4 * n_nodes * total_m DOF). Pad each length to the largest mode count and DOF actually found, and document the zero padding in the docstring. Add tests: results padded to the largest mode count, each row equal to a single-length run, and all DOF kept with several longitudinal terms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
pycufsm.fsm.stripfails when it is called with several lengths and the results do not all have the same size:n_eigsmodes. The final padding loop copies every length into[:max_n_modes]and raises:m_allwith more than one term). Each mode then has4 * n_nodes * total_mDOF, butuniform_shapesis sized with4 * n_nodes:Reproduction
A lipped channel 200 x 75 x 20 x 2 (mm), uniform compression, S-S,
n_eigs=10, 20 lengths from 10 to 20 000 mm: the number of modes per length is 10 up to ~3 000 mm and then 8, 7, 7, 6, sostripraises (1). The same section withB_C="C-C"andm_all=[[1, 2, 3]] * 3raises (2). Each length on its own runs fine.Fix
Pad every length to the largest mode count and the largest DOF count actually found, copying only the modes each length has. The zero padding (which the code already used) is now documented in the
stripdocstring. No change in results for lengths that already hadmax_n_modesmodes.Tests
New
tests/test_strip.py(coarse plain channel, runs in ~0.2 s):m_all = [1, 2, 3](C-C), shapes keep4 * n_nodes * 3DOFAll three fail on master and pass with this change.
Checks (pinned dev/test dependencies, numpy 2.2.6)
pylint ./pycufsm: 10.00/10black --check .: passedmypy: no issuespytest --pspec tests/: 49 passed locallyNote: CI may show the same unrelated
test_e2e.py::…rack_post_Mz::it_results_in_correct_signature_curvefailure seen on #327 and #328 (see the comment on #328).Independent of #328.