Skip to content

Remove dead numpy_impl newton module - #279

Merged
neuromechanist merged 3 commits into
devfrom
feature/issue-270-newton-cleanup
Aug 23, 2026
Merged

neuromechanist merged 3 commits into
devfrom
feature/issue-270-newton-cleanup

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Deletes pamica/numpy_impl/newton.py (176 lines), a standalone Newton-method module that predates the issue #21/#24 parity fixes and was never imported by the live numpy Newton path.

The dead module's math diverges from the live inlined implementation in numpy_impl/core.py: compute_newton_parameters takes the density derivative dpdf instead of the score and omits the sbeta^2 factor on kappa and the mu^2 fold in lambda, and update_unmixing_matrix uses the += right-multiply form that was the issue #24 root cause. It had exactly one consumer in the repo, pamica/tests/test_amica.py, which imported compute_newton_direction and pinned it via test_newton_direction (synthetic RandomState data); both are removed. No other file, including numpy_impl/__init__.py, imported from this module.

The behavior it pinned is superseded by coverage of the live Newton path: tests/torch_tests/test_ng_backend.py and the issue #267 regression suite tests/test_numpy_newton_multimodel.py. Nothing from the dead module was ported forward, per the repo's replace-don't-deprecate rule.

Also drops the two stale newton.py mentions in AGENTS.md's architecture map and module-naming note, so the docs stay accurate after the deletion.

Test plan

  • uv run pytest -m "not slow" -n auto — 409 passed, 24 skipped, 1 xfailed (pre-existing, unrelated)
  • uv run ruff check . — all checks passed
  • uv run ruff format --check . — 99 files already formatted
  • uv run ty check . — all checks passed
  • Repo-wide grep confirms pamica.numpy_impl.newton had exactly one importer before this change (the removed test), and numpy_impl/core.py's live Newton path never imported it

Closes #270

Delete numpy_impl/newton.py (pre-#21/#24 Newton math, never imported by
the live inlined Newton path in numpy_impl/core.py). Drop its sole consumer,
test_amica.py's test_newton_direction, which pinned that dead code.
Reflect the numpy_impl/newton.py removal: the module doc comment and the
topic-based module list no longer name it.
@neuromechanist
neuromechanist merged commit 45fee2a into dev Aug 23, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-270-newton-cleanup branch August 23, 2026 17:33
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.

Remove dead numpy_impl/newton.py module

1 participant