Skip to content

Raise on too few frequencies in frequency_dof - #87

Merged
galjos merged 2 commits into
mainfrom
fix-frequency-dof-underflow
Jul 7, 2026
Merged

Raise on too few frequencies in frequency_dof#87
galjos merged 2 commits into
mainfrom
fix-frequency-dof-underflow

Conversation

@galjos

@galjos galjos commented Jul 7, 2026

Copy link
Copy Markdown
Member

frequency_dof kept the top dof frequencies via frequency[N-1-i]; when len(frequency) < dof the index wrapped and silently duplicated modes into the thermochemistry. It now raises TSValueError on underflow (and is simplified to a slice).

check_frequency_length was called on the output of frequency_dof (always length dof), so it always returned True; it now validates the raw input count.

Adds unit tests for keep-highest / identity / underflow-raises / input-count.

Closes #86

frequency_dof kept the top dof modes via negative indexing, which wrapped
and silently duplicated modes when given fewer than dof frequencies. Raise
TSValueError on underflow and simplify to a slice. check_frequency_length
now validates the raw input count (it was checking the always-dof-length
output, so it was always True).

Closes #86
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.91%. Comparing base (a9e5335) to head (9ea3dde).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #87      +/-   ##
==========================================
- Coverage   96.92%   96.91%   -0.01%     
==========================================
  Files          28       28              
  Lines        1689     1685       -4     
==========================================
- Hits         1637     1633       -4     
  Misses         52       52              
Flag Coverage Δ
unittests 96.91% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@galjos
galjos merged commit 309ca0f into main Jul 7, 2026
3 checks passed
@galjos
galjos deleted the fix-frequency-dof-underflow branch July 7, 2026 08:51
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.

frequency_dof silently duplicates modes when given too few frequencies

1 participant