Skip to content

fix: add missing D_and_Ds_swap() to 13 algorithms for consistent parameter labelling#147

Open
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes:fix-missing-d-and-ds-swap
Open

fix: add missing D_and_Ds_swap() to 13 algorithms for consistent parameter labelling#147
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes:fix-missing-d-and-ds-swap

Conversation

@Devguru-codes
Copy link

@Devguru-codes Devguru-codes commented Feb 27, 2026

Add self.D_and_Ds_swap(results) call before return in ivim_fit() for:

  • IAR_LU_segmented_3step, IAR_LU_subtracted
  • PV_MUMC_biexp
  • OGC_AmsterdamUMC_biexp, OGC_AmsterdamUMC_biexp_segmented, OGC_AmsterdamUMC_Bayesian_biexp
  • OJ_GU_seg, PvH_KB_NKI_IVIMfit, TF_reference_IVIMfit
  • TCML_TechnionIIT_SLS, TCML_TechnionIIT_lsq_sls_lm/trf/BOBYQA

This corrects mislabelled D and D* when the optimizer swaps them. Previously only 9/22 algorithms had this correction.

No regressions: 1127 passed, 167 skipped, 22 xfailed, 6 xpassed.

Describe the changes you have made in this PR

A clear and concise description of what you want to happen

Link this PR to an issue [optional]

Fixes #146

Checklist

  • Self-review of changed code
  • Added automated tests where applicable
  • Update Docs & Guides

…meter labelling

Add self.D_and_Ds_swap(results) call before return in ivim_fit() for:
- IAR_LU_segmented_3step, IAR_LU_subtracted
- PV_MUMC_biexp
- OGC_AmsterdamUMC_biexp, OGC_AmsterdamUMC_biexp_segmented, OGC_AmsterdamUMC_Bayesian_biexp
- OJ_GU_seg, PvH_KB_NKI_IVIMfit, TF_reference_IVIMfit
- TCML_TechnionIIT_SLS, TCML_TechnionIIT_lsq_sls_lm/trf/BOBYQA

This corrects mislabelled D and D* when the optimizer swaps them.
Previously only 9/22 algorithms had this correction.

No regressions: 1127 passed, 167 skipped, 22 xfailed, 6 xpassed.
@Devguru-codes
Copy link
Author

This PR adds the missing D_and_Ds_swap() call to 13 standardized algorithm implementations that were missing it. This method corrects mislabelled D and D* (Dp) parameters when the optimizer assigns them to the wrong parameter.

Previously, only 9 out of 22 Python algorithms applied this correction, leading to inconsistent parameter labelling.

Changes Made

Added results = self.D_and_Ds_swap(results) before return results in the ivim_fit() method of these 13 files:

# File
1 IAR_LU_segmented_3step.py
2 IAR_LU_subtracted.py
3 PV_MUMC_biexp.py
4 OGC_AmsterdamUMC_biexp.py
5 OGC_AmsterdamUMC_biexp_segmented.py
6 OGC_AmsterdamUMC_Bayesian_biexp.py
7 OJ_GU_seg.py
8 PvH_KB_NKI_IVIMfit.py
9 TF_reference_IVIMfit.py
10 TCML_TechnionIIT_SLS.py
11 TCML_TechnionIIT_lsq_sls_lm.py
12 TCML_TechnionIIT_lsq_sls_trf.py
13 TCML_TechnionIIT_lsq_sls_BOBYQA.py

Each change is a single +1 line addition. No other code was modified.

Testing/Verification

  • Ran the full test suite: 1127 passed, 167 skipped, 22 xfailed, 6 xpassed — identical to main baseline
  • Zero regressions. The D_and_Ds_swap() is a no-op when parameters are already correctly labelled, so existing test results are unchanged.

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.

[BUG] Missing D_and_Ds_swap() post-fit correction in 13 out of 22 Python algorithms

1 participant