Skip to content

pypty.iterative

run

Launch an iterative ptychographic reconstruction.

PARAMETER DESCRIPTION
pypty_params

Reconstruction parameters dictionary or path to a saved parameters file. Must include experiment setup and algorithm settings (see custom_presets.md and reference/initialize.md).

TYPE: dict or str

Notes
  • The function mutates global state, including obj, probe, and history_bfgs.
  • Parameters can be dynamically varied via lambda functions in pypty_params.
  • Checkpoints and logs are saved to output_folder as specified in the parameters.

bfgs_update

x Internal function of PyPTy. Perform a single L-BFGS update step for all active reconstruction parameters.

PARAMETER DESCRIPTION
Way

RETURNS DESCRIPTION
total_loss

Total objective loss for this epoch.

TYPE: float

this_sse

Sum of squared errors for this epoch.

TYPE: float

constraint_contributions

Regularization term contributions.

TYPE: list of float

actual_step

Final step length chosen by line search.

TYPE: float

count

Number of line search iterations performed.

TYPE: int

d_value

Directional derivative before update.

TYPE: float

new_d_value

Directional derivative after update.

TYPE: float

warnings

Warnings generated during update.

TYPE: str

Notes
  • This function updates global variables: obj, probe, positions, etc.
  • Handles both first-time and history-based L-BFGS updates.

reset_bfgs_history

Reset the global BFGS history and free GPU memory.

Notes
  • Clears all stored vectors and scalars in history_bfgs.
  • Attempts to free memory pools for CuPy and pinned memory.