Skip to content

Added multisession assignment (New)#1751

Open
FlorianPfaff wants to merge 7 commits intomainfrom
multisess2
Open

Added multisession assignment (New)#1751
FlorianPfaff wants to merge 7 commits intomainfrom
multisess2

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 10.68s
✅ JSON prettier 2 0 0 0 0.62s
✅ JSON v8r 2 0 0 2.66s
✅ MARKDOWN markdownlint 1 0 0 0 0.66s
✅ MARKDOWN markdown-table-formatter 1 0 0 0 0.27s
✅ PYTHON bandit 338 0 0 5.31s
✅ PYTHON black 338 6 0 0 8.55s
✅ PYTHON flake8 338 0 0 2.89s
✅ PYTHON isort 338 10 0 0 0.68s
✅ PYTHON mypy 338 0 0 5.05s
✅ PYTHON pylint 338 0 0 109.66s
✅ PYTHON ruff 338 10 0 0 0.07s
✅ REPOSITORY checkov yes no no 23.96s
✅ REPOSITORY gitleaks yes no no 7.06s
✅ REPOSITORY git_diff yes no no 0.04s
✅ REPOSITORY secretlint yes no no 7.13s
✅ REPOSITORY syft yes no no 3.05s
✅ REPOSITORY trivy-sbom yes no no 2.22s
✅ REPOSITORY trufflehog yes no no 19.14s
✅ YAML prettier 4 0 0 0 0.44s
✅ YAML v8r 4 0 0 6.13s
✅ YAML yamllint 4 0 0 0.49s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.4.0 --custom-flavor-setup --custom-flavor-linters PYTHON_PYLINT,PYTHON_BLACK,PYTHON_FLAKE8,PYTHON_ISORT,PYTHON_BANDIT,PYTHON_MYPY,PYTHON_RUFF,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

Test Results

    8 files   -     4      8 suites   - 4   1h 38m 56s ⏱️ - 2h 39m 27s
  992 tests +    7    992 ✅ +    7      0 💤 ±  0  0 ❌ ±0 
8 148 runs   - 3 956  6 104 ✅  - 3 268  2 044 💤  - 688  0 ❌ ±0 

Results for commit 02b6acd. ± Comparison against base commit 224177b.

♻️ This comment has been updated with latest results.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Suppress these warnings

************* Module pyrecest.utils.multisession_assignment
pyrecest/utils/multisession_assignment.py:91:0: R0914: Too many local variables (35/15) (too-many-locals)
pyrecest/utils/multisession_assignment.py:415:0: R0913: Too many arguments (8/6) (too-many-arguments)
pyrecest/utils/multisession_assignment.py:415:0: R0914: Too many local variables (26/15) (too-many-locals)


Your code has been rated at 10.00/10

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Suppress these warnings

************* Module pyrecest.utils.multisession_assignment
...

Done in 078ff00. Added # pylint: disable=too-many-locals to solve_multisession_assignment and # pylint: disable=too-many-arguments,too-many-locals to _build_candidate_edges.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Do not import numpy except for numpy.testing. import from pyrecest.backend (as done in other files).

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/c4d8e0ab-3207-4176-8206-ae8ce08944b4

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Do not import numpy except for numpy.testing. import from pyrecest.backend (as done in other files).

Done in 02e6060. Replaced import numpy as np with imports from pyrecest.backend in both multisession_assignment.py and test_multisession_assignment.py. The np.ndarray type annotations are kept under a TYPE_CHECKING guard so they're only evaluated by type checkers, not at runtime.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot There are loads of errors about missing numpy. Import the respective functions from pyrecest.backend and do not prefix them with numpy or np.

ERROR pyrecest/tests/test_evaluation_basic.py - NameError: name 'np' is not defined
ERROR pyrecest/tests/test_hyperspherical_sampler.py - NameError: name 'np' is not defined
ERROR pyrecest/tests/test_hypertoroidal_sampler.py - NameError: name 'np' is not defined
ERROR pyrecest/tests/test_metrics.py - NameError: name 'np' is not defined
ERROR pyrecest/tests/test_multisession_assignment.py - NameError: name 'np' is not defined
!!!!!!!!!!!!!!!!!! Interrupted: 108 errors during collection !!!!!!!!!!!!!!!!!!!
============================= 108 errors in 12.50s =============================

Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/4d3a0fe3-bb75-4da9-91ed-f7b7b542192b

Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Make the functions fail via an assertion for jax backend. Skip the test cases using skipif (see other classes).

=========================== short test summary info ============================
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_consecutive_costs_form_two_long_tracks - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_cross_gap_linking_is_supported - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_global_solution_beats_pairwise_greedy_choice - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_tracks_to_session_labels - TypeError: JAX arrays are immutable and do not support in-place item assignment. Instead of x[idx] = y, use x = x.at[idx].set(y) or another .at[] method: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.ndarray.at.html
= 4 failed, 484 passed, 504 skipped, 29 warnings, 9 subtests passed in 1062.26s (0:17:42) =

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

@copilot Make the functions fail via an assertion for jax backend. Skip the test cases using skipif (see other classes).

=========================== short test summary info ========================...

Done in c6bd12f. Added assert pyrecest.backend.__backend_name__ != "jax", "Not supported on JAX backend" at the top of solve_multisession_assignment and tracks_to_session_labels, and added @unittest.skipIf(pyrecest.backend.__backend_name__ == "jax", reason="Not supported on this backend") to all 7 test methods.

@FlorianPfaff
Copy link
Copy Markdown
Owner Author

@copilot Failure with pytorch backend, please fix:

=========================== short test summary info ============================
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_consecutive_costs_form_two_long_tracks - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_cross_gap_linking_is_supported - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_drops_non_beneficial_links_even_without_threshold - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_global_solution_beats_pairwise_greedy_choice - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_rejects_inconsistent_session_sizes - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_singletons_without_edges - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
FAILED pyrecest/tests/test_multisession_assignment.py::TestMultiSessionAssignment::test_tracks_to_session_labels - TypeError: isfinite(): argument 'input' (position 1) must be Tensor, not float
= 7 failed, 806 passed, 179 skipped, 5585436 warnings, 18 subtests passed in 2471.06s (0:41:11) =
Error: Process completed with exit code 1.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 21, 2026

@copilot Failure with pytorch backend, please fix:

=========================== short test summary info ============================
...

Fixed in 3d3785b. PyTorch's isfinite requires a Tensor input, so _validate_scalar_cost now uses math.isfinite (from Python's standard library) for scalar validation. The backend isfinite is still used for array operations in _build_candidate_edges.

@FlorianPfaff FlorianPfaff force-pushed the main branch 3 times, most recently from 7b21428 to 429a157 Compare April 21, 2026 13:50
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