PtyRADSolver#

class ptyrad.reconstruction.PtyRADSolver(params, device=None, seed=None, acc=None, logger=None)[source]#

Bases: object

A wrapper class to perform ptychographic reconstruction or hyperparameter tuning.

The PtyRADSolver class initializes the necessary components for ptychographic reconstruction and provides methods to execute the reconstruction or perform hyperparameter tuning using Optuna.

params#

Dictionary containing all the parameters required for initialization, loss functions, constraints, model, and optional hyperparameter tuning.

Type:

dict

if_hypertune#

A flag to indicate whether hyperparameter tuning should be performed instead of regular reconstruction. Defaults to False.

Type:

bool

verbose#

A flag to control the verbosity of the output. Defaults to True unless if_quiet is set to True.

Type:

bool

device#

The device to run the computations on (e.g., ‘cuda’ for GPU, ‘cpu’ for CPU). Defaults to None to let accelerate automatically decide.

Type:

str

__init__(params, device=None, seed=None, acc=None, logger=None)[source]#

Methods

__init__(params[, device, seed, acc, logger])

hypertune()

Performs hyperparameter tuning using Optuna.

init_constraint()

Initializes the constraint function using the provided parameters.

init_initializer()

Initializes the variables and objects needed for the reconstruction process.

init_loss()

Initializes the loss function using the provided parameters.

reconstruct()

Executes the ptychographic reconstruction process by creating the model, optimizer, and running the reconstruction loop.

run()

A wrapper method to run the solver in either reconstruction or hyperparameter tuning mode based on the if_hypertune flag