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.Tensorreverse
reverse(self, transmission_field: torch.Tensor) -> torch.TensorAlgorithmOptions
Наследует: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_intensity | torch.Tensor | Intensity profile in the Fourier plane |
source_intensity | torch.Tensor | Intensity distribution before the optical setup(in the image plane) |
forward | Callable | Function which describes forward propagation through the optical system |
reverse | Callable | Function which describes reverse propagation through the optical system |
initial_approximation | torch.Tensor | Initial approximation for the phase profile |
tol | float | Accuracy for the algorithm |
maxiter | int | Maximum number of iterations |
target_phase | `torch.Tensor | None, optional` |
target_region | `torch.Tensor | None, 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_intensity | torch.Tensor | Intensity profile in the Fourier plane |
source_intensity | torch.Tensor | Intensity distribution before the optical setup(in the image plane) |
forward | Callable | Function which describes forward propagation through the optical system |
reverse | Callable | Function which describes reverse propagation through the optical system |
initial_approximation | torch.Tensor | Initial approximation for the phase profile |
tol | float | Accuracy for the algorithm |
maxiter | int | Maximum number of iterations |
target_phase | `torch.Tensor | None, optional` |
target_region | `torch.Tensor | None, optional` |
None | constant_factor: float | Learning 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_intensity | torch.Tensor | Intensity distribution before the optical setup |
optical_setup | `LinearOpticalSetup | SetupLike` |
target_intensity | torch.Tensor | Intensity profile in the Fourier plane |
target_phase | `torch.Tensor | None, optional` |
target_region | torch.Tensor, optional | Region to preserve phase and amplitude profiles in the Fourier plane( optional for the generating target intensity profile problem) |
initial_phase | torch.Tensor, optional | Initial approximation for the phase profile, by default None |
method | Literal['GS', 'HIO'], optional | Algorithms for phase retrieval problem, by default ‘GS’ |
options | dict, optional | Dictionary 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