From 25704fdcaed4738c98fe751130c634890f79fb86 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Wed, 6 Dec 2023 15:26:56 -0600 Subject: [PATCH] GUI: Remove deleted reconstruction algorithms from GUI (#64) * API: Remove deleted reconstruction algorithms from GUI Tike has removed conjugate gradient and adam from its reconstruction options in v0.25. * BUG: Remove adaptive moment and adam classses --- ptychodus/controller/tike/factory.py | 8 ----- ptychodus/model/tike/core.py | 7 ---- ptychodus/model/tike/reconstructor.py | 50 --------------------------- 3 files changed, 65 deletions(-) diff --git a/ptychodus/controller/tike/factory.py b/ptychodus/controller/tike/factory.py index 6fe3c8e1..fe3b7ac0 100644 --- a/ptychodus/controller/tike/factory.py +++ b/ptychodus/controller/tike/factory.py @@ -24,14 +24,6 @@ def createViewController(self, reconstructorName: str) -> QWidget: view = TikeParametersView.createInstance(showCgIter=False, showAlpha=True, showStepLength=False) - elif reconstructorName == 'adam_grad': - view = TikeParametersView.createInstance(showCgIter=False, - showAlpha=True, - showStepLength=True) - elif reconstructorName == 'cgrad': - view = TikeParametersView.createInstance(showCgIter=True, - showAlpha=False, - showStepLength=True) elif reconstructorName == 'lstsq_grad': view = TikeParametersView.createInstance(showCgIter=False, showAlpha=False, diff --git a/ptychodus/model/tike/core.py b/ptychodus/model/tike/core.py index 20a0750b..a350134e 100644 --- a/ptychodus/model/tike/core.py +++ b/ptychodus/model/tike/core.py @@ -172,8 +172,6 @@ def createInstance(cls, settingsRegistry: SettingsRegistry, core = cls(settingsRegistry) try: - from .reconstructor import AdaptiveMomentGradientDescentReconstructor - from .reconstructor import ConjugateGradientReconstructor from .reconstructor import DifferenceMapReconstructor from .reconstructor import IterativeLeastSquaresReconstructor from .reconstructor import RegularizedPIEReconstructor @@ -183,8 +181,6 @@ def createInstance(cls, settingsRegistry: SettingsRegistry, if isDeveloperModeEnabled: core.reconstructorList.append(NullReconstructor('rpie')) - core.reconstructorList.append(NullReconstructor('adam_grad')) - core.reconstructorList.append(NullReconstructor('cgrad')) core.reconstructorList.append(NullReconstructor('lstsq_grad')) core.reconstructorList.append(NullReconstructor('dm')) else: @@ -193,9 +189,6 @@ def createInstance(cls, settingsRegistry: SettingsRegistry, core._probeCorrectionSettings, core._objectCorrectionSettings) core.reconstructorList.append(RegularizedPIEReconstructor(tikeReconstructor)) - core.reconstructorList.append( - AdaptiveMomentGradientDescentReconstructor(tikeReconstructor)) - core.reconstructorList.append(ConjugateGradientReconstructor(tikeReconstructor)) core.reconstructorList.append(IterativeLeastSquaresReconstructor(tikeReconstructor)) core.reconstructorList.append(DifferenceMapReconstructor(tikeReconstructor)) diff --git a/ptychodus/model/tike/reconstructor.py b/ptychodus/model/tike/reconstructor.py index 9479e26c..15e5c7d8 100644 --- a/ptychodus/model/tike/reconstructor.py +++ b/ptychodus/model/tike/reconstructor.py @@ -252,56 +252,6 @@ def reconstruct(self, parameters: ReconstructInput) -> ReconstructOutput: return self._tikeReconstructor(parameters, self._algorithmOptions) -class AdaptiveMomentGradientDescentReconstructor(Reconstructor): - - def __init__(self, tikeReconstructor: TikeReconstructor) -> None: - super().__init__() - self._algorithmOptions = tike.ptycho.solvers.AdamOptions() - self._tikeReconstructor = tikeReconstructor - - @property - def name(self) -> str: - return self._algorithmOptions.name - - @property - def _settings(self) -> TikeSettings: - return self._tikeReconstructor._settings - - def reconstruct(self, parameters: ReconstructInput) -> ReconstructOutput: - self._algorithmOptions.num_batch = self._settings.numBatch.value - self._algorithmOptions.batch_method = self._settings.batchMethod.value - self._algorithmOptions.num_iter = self._settings.numIter.value - self._algorithmOptions.convergence_window = self._settings.convergenceWindow.value - self._algorithmOptions.alpha = float(self._settings.alpha.value) - self._algorithmOptions.step_length = float(self._settings.stepLength.value) - return self._tikeReconstructor(parameters, self._algorithmOptions) - - -class ConjugateGradientReconstructor(Reconstructor): - - def __init__(self, tikeReconstructor: TikeReconstructor) -> None: - super().__init__() - self._algorithmOptions = tike.ptycho.solvers.CgradOptions() - self._tikeReconstructor = tikeReconstructor - - @property - def name(self) -> str: - return self._algorithmOptions.name - - @property - def _settings(self) -> TikeSettings: - return self._tikeReconstructor._settings - - def reconstruct(self, parameters: ReconstructInput) -> ReconstructOutput: - self._algorithmOptions.num_batch = self._settings.numBatch.value - self._algorithmOptions.batch_method = self._settings.batchMethod.value - self._algorithmOptions.num_iter = self._settings.numIter.value - self._algorithmOptions.convergence_window = self._settings.convergenceWindow.value - self._algorithmOptions.cg_iter = self._settings.cgIter.value - self._algorithmOptions.step_length = float(self._settings.stepLength.value) - return self._tikeReconstructor(parameters, self._algorithmOptions) - - class IterativeLeastSquaresReconstructor(Reconstructor): def __init__(self, tikeReconstructor: TikeReconstructor) -> None: