Commit 6d10d6f
Fix spurious conservation-law assertion for condition-dependent compartments (#3202)
* Fix spurious conservation-law assertion for condition-dependent compartments
When importing a PEtab problem with condition-dependent compartment sizes,
the conservation-law coefficients contain a product of `Piecewise` factors
that cancels to 1. `self.eq("w")` is passed through `self._simplify`, which
collapses this product, while `ConservationLaw.get_x_rdata` returns the
unsimplified expression. The strict equality check in the `dwdx` computation
then failed on mathematically equivalent but structurally different forms,
raising a spurious AssertionError (e.g. PEtab v2 test suite case 0012).
Apply the same simplification to both sides before comparing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6qHLHHce8fyPNeoT2BxPf
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent e07af43 commit 6d10d6f
1 file changed
Lines changed: 18 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1817 | 1817 | | |
1818 | 1818 | | |
1819 | 1819 | | |
1820 | | - | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | | - | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
1826 | 1824 | | |
1827 | | - | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
1828 | 1839 | | |
1829 | 1840 | | |
1830 | 1841 | | |
| |||
0 commit comments