Skip to content

[WAVE 2] Fix multiphase rigid contact force plot mapping#1062

Open
mickaelbegon wants to merge 1 commit into
pyomeca:masterfrom
mickaelbegon:codex/fix-1057-contact-force-plot-mapping
Open

[WAVE 2] Fix multiphase rigid contact force plot mapping#1062
mickaelbegon wants to merge 1 commit into
pyomeca:masterfrom
mickaelbegon:codex/fix-1057-contact-force-plot-mapping

Conversation

@mickaelbegon

@mickaelbegon mickaelbegon commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • map phase-local rigid contact force rows to the corresponding global plot axes
  • preserve the global contact legend across phases
  • add a regression test for removing the first contact in a later phase

Root cause

The default BiMapping.to_first values were derived from global contact indices. The rigid-contact function returns a phase-local vector, so a phase containing only the second global contact attempted to read local row 1 instead of row 0. This produced empty or mislabeled plots.

Validation

  • MPLCONFIGDIR=/private/tmp/mplconfig-1057 /Users/mickaelbegon/miniconda3/envs/bioptim/bin/python -m pytest tests/shard5/test_configure_problem.py -q
  • 7 passed

Closes #1057


This change is Reviewable

@mickaelbegon mickaelbegon changed the title Fix multiphase rigid contact force plot mapping [HOLD] Fix multiphase rigid contact force plot mapping Jul 22, 2026
@mickaelbegon
mickaelbegon force-pushed the codex/fix-1057-contact-force-plot-mapping branch from 9ee1323 to f830a96 Compare July 26, 2026 22:08
@mickaelbegon mickaelbegon changed the title [HOLD] Fix multiphase rigid contact force plot mapping [WAVE 2] Fix multiphase rigid contact force plot mapping Jul 26, 2026
@mickaelbegon
mickaelbegon marked this pull request as ready for review July 26, 2026 22:09
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.86%. Comparing base (89c83a3) to head (f830a96).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1062      +/-   ##
==========================================
+ Coverage   77.26%   77.86%   +0.60%     
==========================================
  Files         196      196              
  Lines       21506    21503       -3     
==========================================
+ Hits        16616    16743     +127     
+ Misses       4890     4760     -130     
Flag Coverage Δ
unittests 77.86% <ø> (+0.60%) ⬆️

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.

@mickaelbegon

Copy link
Copy Markdown
Contributor Author

Codex analysis

This PR is part of Wave 2 and is rebased onto current master (e8fbc729). It fixes the phase-specific mapping used by rigid contact-force plots and adds focused regression coverage.

Review isolation: it changes only bioptim/dynamics/configure_variables.py and tests/shard5/test_configure_problem.py; it has no source-file overlap with #1065 or #1067.

Validation completed by Codex:

  • macOS, Python 3.14 / CasADi 3.7.2: tests/shard5/test_configure_problem.py — 7 passed
  • GitHub Actions: 23/23 checks passed
  • git diff --check passed

@EveCharbie @pariterre, all local and online checks are green. This PR is ready for review as an independent Wave 2 change.

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.

Issue with rigid_contact_forces plots in multi-phase simulation (Phase 2 curves empty and titles duplicated)

1 participant