Skip to content

Extract single-particle likelihoods explicitly in Linker - #145

Merged
SuperdoerTrav merged 1 commit into
llnl:mainfrom
sylvesterkaczmarek:fix/linker-single-particle-likelihood
Sep 19, 2026
Merged

SuperdoerTrav merged 1 commit into
llnl:mainfrom
sylvesterkaczmarek:fix/linker-single-particle-likelihood

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Particles.draw_orbit() returns a one-orbit list, so Particles.lnlike() returns a one-element array. Assigning that array directly to lnL[j] raises ValueError: setting an array element with a sequence with NumPy 2.5.3, preventing the documented Linker + Particles workflow from sampling track assignments.

Extract the single likelihood explicitly with np.asarray(...).item(). Existing scalar-returning likelihood providers remain supported. Probability normalization and the small-likelihood fallback are unchanged.

Regression coverage uses real Particles objects with a deterministic likelihood fixture, covering the first track, multiple model choices, and the existing small-likelihood fallback. No changes to orbit selection or propagation.

Validation on Python 3.12 and NumPy 2.5.3:

  • New regression tests on unmodified main: 4 failed with the reported exception. After the fix: 4 passed.
  • Focused linker tests: 10 passed.
  • Full suite: python -m pytest -q -n 2 --tb=short returned 310 passed, 2 skipped, and 35 subtests passed.
  • New tests pass Flake8; no additional Flake8 diagnostics in linker.py relative to the base revision.
  • Syntax checks and git diff --check passed.

@sylvesterkaczmarek
sylvesterkaczmarek marked this pull request as ready for review September 19, 2026 08:56
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.32%. Comparing base (6af6000) to head (cc59145).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #145   +/-   ##
=======================================
  Coverage   97.32%   97.32%           
=======================================
  Files          17       17           
  Lines        5895     5895           
=======================================
  Hits         5737     5737           
  Misses        158      158           
Flag Coverage Δ
unittests 97.32% <100.00%> (ø)

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

Files with missing lines Coverage Δ
ssapy/linker.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SuperdoerTrav
SuperdoerTrav merged commit 8bb784c into llnl:main Sep 19, 2026
5 checks passed
@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor Author

Thanks for merging this one too. I really appreciate the quick reviews and I’m glad to keep contributing to SSAPy.

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.

3 participants