Skip to content

Commit

Permalink
Fix deprecation warning for rtol and atol in GD (#2056)
Browse files Browse the repository at this point in the history
* Fix deprecation warning for `rtol` and `atol` in GD

Signed-off-by: Emmanuel Ferdman <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Margaret Duff <[email protected]>

---------

Signed-off-by: Emmanuel Ferdman <[email protected]>
  • Loading branch information
emmanuel-ferdman authored Jan 31, 2025
1 parent a14ac33 commit 5749b38
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* XX.X
- Bug fixes:
- Fix deprecation warning for rtol and atol in GD (#2056)


* 24.3.0
- New features:
- Added `FluxNormaliser` processor (#1878)
Expand Down
4 changes: 3 additions & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ Institutions Key:
10 - University of Warwick
11 - University of Helsinki
12 - Australian e-Health Research, Australia
13 - KU Leuven
13 - KU Leuven
14 - Independent Contributor

CIL Developers in date order:
Edoardo Pasca (2017 – present) - 1
Expand Down Expand Up @@ -69,6 +70,7 @@ Sam Porter (2024) - 5
Joshua Hellier (2024) - 3
Nicholas Whyatt (2024) - 1
Rasmia Kulan (2024) - 1
Emmanuel Ferdman (2025) - 14

CIL Advisory Board:
Llion Evans - 9
Expand Down
9 changes: 5 additions & 4 deletions Wrappers/Python/cil/optimisation/algorithms/GD.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ def __init__(self, initial=None, f=None, step_size=None, preconditioner=None,
if self.alpha is not None or self.beta is not None: # to be deprecated
warn('To modify the parameters for the Armijo rule please use `step_size_rule=ArmijoStepSizeRule(alpha, beta, kmax)`. The arguments `alpha` and `beta` will be deprecated. ', DeprecationWarning, stacklevel=2)

if self.rtol!=0 or self.atol!=0: # to be deprecated (released in 25.0)
warn('`rtol` and `atol` are deprecated. For early stopping, please use a callback (cil.optimisation.utilities.callbacks), for example `EarlyStoppingObjectiveValue`.', DeprecationWarning, stacklevel=2)
else:
log.warn('Breaking backwards compatibility, GD no longer automatically stops if the objective function is close to zero. For this functionality, please use a callback (cil.optimisation.utilities.callbacks).' )
if self.rtol is not None or self.atol is not None: # to be deprecated (released in 25.0)
if self.rtol != 0 or self.atol != 0: # to be deprecated (released in 25.0)
warn('`rtol` and `atol` are deprecated. For early stopping, please use a callback (cil.optimisation.utilities.callbacks), for example `EarlyStoppingObjectiveValue`.', DeprecationWarning, stacklevel=2)
else:
log.warning('Breaking backwards compatibility, GD no longer automatically stops if the objective function is close to zero. For this functionality, please use a callback (cil.optimisation.utilities.callbacks).')

super().__init__(**kwargs)

Expand Down

0 comments on commit 5749b38

Please sign in to comment.