Skip to content

feat(python): add MATLAB-compatible oversampling APIs#39

Closed
Fairylizzy wants to merge 1 commit into
Arcadia-1:mainfrom
Fairylizzy:feat/python-matlab-oversampling-parity
Closed

feat(python): add MATLAB-compatible oversampling APIs#39
Fairylizzy wants to merge 1 commit into
Arcadia-1:mainfrom
Fairylizzy:feat/python-matlab-oversampling-parity

Conversation

@Fairylizzy

Copy link
Copy Markdown
Contributor

Summary

本 PR 为 Python 侧补齐 MATLAB 过采样/分析 API 的命名兼容层,并更新文档与测试。

MATLAB 修改说明:MATLAB 相关修复(ensureMatlabRoot、3 级 pipeline CSV 导出、run_basic 独立运行等)已在 upstream 合并:PR #225bb9c46)。本 PR 仅包含 Python 新增与修改。

新增 API(MATLAB 同名入口)

MATLAB Python 新入口 实现
ifilter adctoolbox.ifilter 包装 extract_freq_components
perfosr adctoolbox.perfosr 包装 sweep_performance_vs_osr,返回 (osr, sndr, sfdr, enob)
ntfperf adctoolbox.ntfperf 包装 ntf_analyzer

其他 Python 变更

  • extract_freq_components:增加实数输入与频带 [0, 0.5] 校验(对齐 MATLAB ifilter
  • sweep_performance_vs_osr:新增 logscalesmooth 参数,贴近 MATLAB perfosr 行为
  • 包导出:顶层 adctoolboxoversampling / spectrum 子模块导出上述符号
  • 文档:更新 oversampling.rstspectrum.rstpython_matlab_parity.rstifilter/perfosr/ntfperf 标记为 Matched)
  • 测试:新增 tests/unit/oversampling/test_matlab_compat_api.py

Changed files (12)

  • python/src/adctoolbox/oversampling/ifilter.py (new)
  • python/src/adctoolbox/oversampling/ntfperf.py (new)
  • python/src/adctoolbox/oversampling/perfosr.py (new)
  • python/tests/unit/oversampling/test_matlab_compat_api.py (new)
  • python/src/adctoolbox/__init__.py
  • python/src/adctoolbox/oversampling/__init__.py
  • python/src/adctoolbox/spectrum/__init__.py
  • python/src/adctoolbox/spectrum/extract_freq_components.py
  • python/src/adctoolbox/spectrum/sweep_performance_vs_osr.py
  • python/docs/source/api/oversampling.rst
  • python/docs/source/api/spectrum.rst
  • python/docs/source/python_matlab_parity.rst

Test plan

  • cd python && uv run pytest tests/unit/oversampling/test_matlab_compat_api.py -q
  • from adctoolbox import ifilter, perfosr, ntfperf 导入正常
  • 文档构建无报错(可选)

Expose ifilter, perfosr, and ntfperf wrappers aligned with MATLAB names.
Harden extract_freq_components validation, extend OSR sweep options, and
document parity in API docs and python_matlab_parity.rst.

Co-authored-by: Cursor <cursoragent@cursor.com>
Arcadia-1 pushed a commit that referenced this pull request Jun 11, 2026
Add MATLAB-compatible oversampling APIs, Python oversampling examples, noise-shaping tests, and MATLAB noiseshape helper. Supersedes PR #39.
@Arcadia-1

Copy link
Copy Markdown
Owner

Closed as superseded by #40, which included this PR's MATLAB-compatible oversampling API commit and added the follow-up oversampling examples/noiseshape work. #40 is merged on main as 7d4f04a.

@Arcadia-1 Arcadia-1 closed this Jun 11, 2026
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.

2 participants