Skip to content

Add a multi-channel FDD example script - #74

Merged
Ayberkrk merged 1 commit into
Ayberkrk:mainfrom
ArdaEkiz0:example-multichannel-fdd
Oct 18, 2026
Merged

Ayberkrk merged 1 commit into
Ayberkrk:mainfrom
ArdaEkiz0:example-multichannel-fdd

Conversation

@ArdaEkiz0

Copy link
Copy Markdown
Contributor

Closes #71.

New examples/multichannel_fdd.py, following the issue's suggested flow:

  1. tm.Structure with three equal stories; its analytical frequencies
    (1.829 / 5.124 / 7.405 Hz) are printed first.
  2. Three synchronized channels are synthesized from those modes with
    unequal amplitude weights and a fixed numpy.random.default_rng seed.
  3. The channels make a temporary-directory CSV round trip through
    tm.load_multichannel_csv.
  4. tm.identify_fdd prints the identified frequencies next to the model
    frequencies.
  5. tm.modal_assurance_criterion compares each identified shape with the
    analytical model shape.

Output on Python 3.12:

Model frequencies (Hz): [1.829, 5.124, 7.405]
Spectral resolution: 0.0625 Hz
Mode 1.830 Hz (ratio 1.000), MAC 1.000
Mode 5.124 Hz (ratio 1.000), MAC 1.000
Mode 7.405 Hz (ratio 1.000), MAC 1.000
CSV round trip samples: 16384

Verified locally:

  • python -m pytest passes (359 passed, 1 skipped, coverage 92.19%);
    the new script runs under test_examples_run in a couple of seconds.
  • python -m ruff check ., python -m ruff format --check .,
    python -m mypy and python -m mkdocs build --strict pass.

docs/numerical-methods.md mentions the example next to the multi-channel
FDD section, and docs/changelog.md has a line under Unreleased/Added.

The examples directory had no end-to-end demonstration of
`tm.identify_fdd`. The new script follows the issue's list:

- `tm.Structure` with three equal stories, printing the analytical
  frequencies (1.829 / 5.124 / 7.405 Hz).
- Three synchronized channels synthesized from those modes with unequal
  amplitude weights and a fixed `numpy.random.default_rng` seed.
- A temporary-directory CSV round trip through `tm.load_multichannel_csv`.
- `tm.identify_fdd`, printing recognized frequencies next to the model
  frequencies, and `tm.modal_assurance_criterion` against the analytical
  shape of each mode.

Verified locally on Python 3.12:

- The script identifies all three modes within one resolution bin and
  reports MAC 1.000 for each (the middle mode is best resolved with
  `nperseg=2048`; a comment in the script records why).
- `python -m pytest` passes: 359 passed, 1 skipped, coverage 92.19%.
  The new script is executed automatically by `test_examples_run`.
- `python -m ruff check .`, `python -m ruff format --check .`,
  `python -m mypy` and `python -m mkdocs build --strict` pass.

docs/numerical-methods.md mentions the example next to the FDD section,
and docs/changelog.md has a line under Unreleased/Added.
@Ayberkrk

Copy link
Copy Markdown
Owner

Thanks, merged! If you would like another one, #72 (SDOF harmonic response example) is a close sibling of this issue, and #69 (mqtt.py coverage) is also open.

@Ayberkrk
Ayberkrk merged commit 04a101b into Ayberkrk:main Oct 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an example script for multi-channel FDD identification

2 participants