Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI: Remove deleted reconstruction algorithms from GUI #64

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions ptychodus/controller/tike/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 0 additions & 7 deletions ptychodus/model/tike/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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))

Expand Down
50 changes: 0 additions & 50 deletions ptychodus/model/tike/reconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down