Skip to Content
DocsAPI ReferencePhase Retrieval Problem

Phase Retrieval Problem

Алгоритмы восстановления фазы

from svetlanna.phase_retrieval_problem import ...

Классы

SetupLike

Наследует: Protocol

A class for phase_retrieval_problem with personal realizations of forward and reverse methods instead of methods in svetlanna.setup.LinearOpticalSetup

📥 Параметры

ПараметрТипОписание
Protocol_type_description

Методы

forward

forward(self, input_field: torch.Tensor) -> torch.Tensor

reverse

reverse(self, transmission_field: torch.Tensor) -> torch.Tensor

AlgorithmOptions

Наследует: TypedDict

PhaseRetrievalResult

Represents the phase retrieval result

Функции

gerchberg_saxton_algorithm(target_intensity: torch.Tensor, source_intensity: torch.Tensor, forward: Callable, reverse: Callable, initial_approximation: torch.Tensor, tol: float, maxiter: int, target_phase: torch.Tensor | None = None, target_region: torch.Tensor | None = None) -> prr.PhaseRetrievalResult

Gerchberg-Saxton algorithm(GS) for solving the phase retrieval problem

📥 Параметры

ПараметрТипОписание
target_intensitytorch.TensorIntensity profile in the Fourier plane
source_intensitytorch.TensorIntensity distribution before the optical setup(in the image plane)
forwardCallableFunction which describes forward propagation through the optical system
reverseCallableFunction which describes reverse propagation through the optical system
initial_approximationtorch.TensorInitial approximation for the phase profile
tolfloatAccuracy for the algorithm
maxiterintMaximum number of iterations
target_phase`torch.TensorNone, optional`
target_region`torch.TensorNone, optional`

📤 Возвращает

prr.PhaseRetrievalResult

Exemplar of class PhaseRetrievalResult which presents result of optimization

hybrid_input_output(target_intensity: torch.Tensor, source_intensity: torch.Tensor, forward: Callable, reverse: Callable, initial_approximation: torch.Tensor, tol: float, maxiter: int, target_phase: torch.Tensor | None = None, target_region: torch.Tensor | None = None, constant_factor: float = 0.9) -> prr.PhaseRetrievalResult

Hybrid Input-Output(HIO) algorithm for for solving the phase retrieval problem

📥 Параметры

ПараметрТипОписание
target_intensitytorch.TensorIntensity profile in the Fourier plane
source_intensitytorch.TensorIntensity distribution before the optical setup(in the image plane)
forwardCallableFunction which describes forward propagation through the optical system
reverseCallableFunction which describes reverse propagation through the optical system
initial_approximationtorch.TensorInitial approximation for the phase profile
tolfloatAccuracy for the algorithm
maxiterintMaximum number of iterations
target_phase`torch.TensorNone, optional`
target_region`torch.TensorNone, optional`
Noneconstant_factor: floatLearning rate value for the HIO algorithm, by default 0.9

📤 Возвращает

prr.PhaseRetrievalResult

Exemplar of class PhaseRetrievalResult which presents result of optimization

retrieve_phase(source_intensity: torch.Tensor, optical_setup: LinearOpticalSetup | SetupLike, target_intensity: torch.Tensor) -> prr.PhaseRetrievalResult

retrieve_phase(source_intensity: torch.Tensor, optical_setup: LinearOpticalSetup | SetupLike, target_intensity: torch.Tensor, target_phase: torch.Tensor, target_region: torch.Tensor) -> prr.PhaseRetrievalResult

retrieve_phase(source_intensity: torch.Tensor, optical_setup: LinearOpticalSetup | SetupLike, target_intensity: torch.Tensor, target_phase: torch.Tensor | None = None, target_region: torch.Tensor | None = None) -> prr.PhaseRetrievalResult

Function for solving phase retrieval problem: generating target intensity profile or reconstructing the phase profile of the field

📥 Параметры

ПараметрТипОписание
source_intensitytorch.TensorIntensity distribution before the optical setup
optical_setup`LinearOpticalSetupSetupLike`
target_intensitytorch.TensorIntensity profile in the Fourier plane
target_phase`torch.TensorNone, optional`
target_regiontorch.Tensor, optionalRegion to preserve phase and amplitude profiles in the Fourier plane( optional for the generating target intensity profile problem)
initial_phasetorch.Tensor, optionalInitial approximation for the phase profile, by default None
methodLiteral['GS', 'HIO'], optionalAlgorithms for phase retrieval problem, by default ‘GS’
optionsdict, optionalDictionary with optimization parameters, by default { ‘tol’: 1e-16, # criteria for stop optimization ‘maxiter’: 100, # maximum number of iterations ‘constant_factor’: 0.9, # convergence parameter for HIO ‘disp’: False # show result of optimization }

📤 Возвращает

prr.PhaseRetrievalResult

Exemplar of class PhaseRetrievalResult which presents result of optimization

⚠️ Исключения

  • ValueError — Unknown optimization method