frog

Submodules

frog.classic_algorithms_frog module

class frog.classic_algorithms_frog.Vanilla(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, **kwargs)[source]

Bases: ClassicAlgorithmsBASE, RetrievePulsesFROG

The Vanilla-FROG Algorithm as described by R. Trebino.

  1. Trebino, “Frequency-Resolved Optical Gating: The Measurement of Ultrashort Laser Pulses”, 10.1007/978-1-4615-1181-6 (2000)

update_pulse(pulse, signal_t_new, gate_shifted, measurement_info, descent_info)[source]

Generates an new (maybe improoved) guess for the pulse.

update_gate(gate, signal_t_new, pulse_t_shifted, measurement_info, descent_info)[source]

Generates an new (maybe improoved) guess for the gate.

step(descent_state, measurement_info, descent_info)[source]

Performs one iteration of the Vanilla Algorithm.

Parameters:
  • descent_state – Pytree,

  • measurement_info – Pytree,

  • descent_info – Pytree,

Returns:

tuple[Pytree, jnp.array], the updated descent state and the current errors

initialize_run(population)[source]

Prepares all provided data and parameters for the reconstruction. Here the final shape/structure of descent_state, measurement_info and descent_info are determined.

Parameters:

population – Pytree, the initial guess as created by self.create_initial_population()

Returns:

tuple[Pytree, Callable], the initial descent state and the step-function of the algorithm.

class frog.classic_algorithms_frog.LSGPA(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, **kwargs)[source]

Bases: LSGPABASE, RetrievePulsesFROG

The Least-Squares Generalized Projection Algorithm. Only available for delay based non-interferometric methods.

  1. Gagnon et al., Appl. Phys. B 92, 25-32, 10.1007/s00340-008-3063-x (2008)

class frog.classic_algorithms_frog.CPCGPA(delay, frequency, trace, nonlinear_method, cross_correlation=False, constraints=False, svd=False, antialias=False, **kwargs)[source]

Bases: CPCGPABASE, RetrievePulsesFROG

The Constrained-PCGP-Algorithm. Only available for delay based non-interferometric methods. Transforms population to time domain during initialization.

    1. Kane and A. B. Vakhtin, Prog. Quantum Electron. 81 (100364), 10.1016/j.pquantelec.2021.100364 (2022)

constraints

if true the operator based constraints are used.

Type:

bool

svd

if true a full SVD is performed instead of a single iteration of the power method

Type:

bool

antialias

if true anti-aliasing is applied to the outer-product-matrix-form

Type:

bool

calculate_gate(gate_pulse, measurement_info)[source]
class frog.classic_algorithms_frog.GeneralizedProjection(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, interferometric=False, **kwargs)[source]

Bases: GeneralizedProjectionBASE, RetrievePulsesFROG

Implements the Generalized Projection Algorithm.

    1. DeLong et al., Opt. Lett. 19, 2152-2154 (1994)

no_steps_descent

the numer of descent steps per iteration

Type:

int

optimize_spectral_phase_directly
Type:

bool

calculate_Z_gradient_individual(signal_t, signal_t_new, tau_arr, measurement_info, pulse_or_gate)[source]

Calculates the Z-error gradient for an individual.

calculate_Z_newton_direction(grad, signal_t_new, signal_t, tau_arr, descent_state, measurement_info, descent_info, full_or_diagonal, pulse_or_gate)[source]

Calculates the Z-error newton direction for a population.

class frog.classic_algorithms_frog.PtychographicIterativeEngine(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, **kwargs)[source]

Bases: PtychographicIterativeEngineBASE, RetrievePulsesFROG

Implements a version of the Ptychographic Iterative Engine (PIE).

A. Maiden et al., Optica 4, 736-745 (2017) T. Schweizer, “Time-Domain Ptychography and its Applications in Ultrafast Science”, PhD Thesis, Bern (2021)

alpha

a regularization parameter

Type:

float

pie_method

specifies the PIE variant. Can be one of None, PIE, ePIE, rPIE. Where None indicates that the pure gradient is used.

Type:

None, str

optimize_spectral_phase_directly
Type:

bool

reverse_transform_grad(signal, tau_arr, measurement_info)[source]

For reconstruction of the gate-pulse the shift has to be undone.

modify_grad_for_gate_pulse(grad_all_m, gate_pulse_shifted, nonlinear_method)[source]

For reconstruction of the gate-pulse the gradient depends on the nonlinear method.

calculate_PIE_descent_direction_m(signal_t, signal_t_new, tau, pie_method, measurement_info, descent_info, pulse_or_gate)[source]

Calculates the PIE direction for pulse or gate-pulse for a given shift.

get_gate_probe_for_hessian(pulse_t, gate_pulse_shifted, nonlinear_method)[source]

For the reconstruction of the gate pulse, the probe depends on the nonlinear method for the hessian calculation.

calculate_PIE_newton_direction(grad, signal_t, tau_arr, measured_trace, local_or_global_state, measurement_info, descent_info, pulse_or_gate, local_or_global)[source]

Calculates the newton direction for a population.

class frog.classic_algorithms_frog.COPRA(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, interferometric=False, **kwargs)[source]

Bases: COPRABASE, RetrievePulsesFROG

Implements a version of the Common Pulse Retrieval Algorithm (COPRA).

    1. Geib et al., Optica 6, 495-505 (2019)

get_Z_gradient_individual(signal_t, signal_t_new, tau_arr, measurement_info, pulse_or_gate)[source]

Calculates the Z-error gradient for an individual.

get_Z_newton_direction(grad, signal_t, signal_t_new, tau_arr, local_or_global_state, measurement_info, descent_info, full_or_diagonal, pulse_or_gate)[source]

Calculates the Z-error newton direction for a population.

class frog.classic_algorithms_frog.LSF(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, interferometric=False, **kwargs)[source]

Bases: LSFBASE, RetrievePulsesFROG

Implements a version of the Linesearch FROG Algorithm (LSF). Despite its name the algorithm is NOT restricted to FROG.

    1. Krook and V. Pasiskevicius, Opt. Express 33, 33258-33269 (2025)

no_sections

number of sections to split the search line into

Type:

int

number_of_disection_iterations

as the name says

Type:

int

direction_mode

can be random or continuous

Type:

str

ratio_points_for_continuous

smaller value means more randomness/eratic

Type:

int

only_allow_improvements

if true, only steps that decrease the error will be accepted

Type:

bool

frog.general_algorithms_frog module

class frog.general_algorithms_frog.DifferentialEvolution(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, interferometric=False, strategy='best1_bin', selection_mechanism='greedy', mutation_rate=0.5, crossover_rate=0.7, **kwargs)[source]

Bases: DifferentialEvolutionBASE, RetrievePulsesFROG

Implements a Differential-Evolution Algorithm. Based on Qiang, J., Mitchell, C., A Unified Differential Evolution Algorithm for Global Optimization, 2014, https://www.osti.gov/servlets/purl/1163659

strategy

the mutation and selection strategy, analogous to scipy’s differential evolution.

Type:

str

mutation_rate

the mutation rate

Type:

float

crossover_rate

the crossover rate

Type:

float

selection_mechanism

the selection mechanism, can be greedy or global, defined in select_population().

Type:

str

temperature

a temperature value for the global selection mechanism

Type:

float

class frog.general_algorithms_frog.Evosax(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, interferometric=False, solver=None, **kwargs)[source]

Bases: EvosaxBASE, RetrievePulsesFROG

Employs the evosax package to perform the optimization.

Robert Tjarko Lange, evosax: JAX-based Evolution Strategies, arXiv preprint arXiv:2212.04180 (2022)

solver

any evosax-solver should work

Type:

evosax-solver

solver_params

user defined parameters for the evosax-solver, if None the default params set in evosax are used

Type:

any

solver_kwargs

some evosax-solver require additional input arguments. These can be supplied via this aattribute.

Type:

dict

class frog.general_algorithms_frog.AutoDiff(delay, frequency, measured_trace, nonlinear_method, cross_correlation=False, interferometric=False, solver=None, **kwargs)[source]

Bases: AutoDiffBASE, RetrievePulsesFROG

Employs the optimistix package to perform the optimization via Automatic-Differentiation.

J. Rader, T. Lyons and P.Kidger, Optimistix: modular optimisation in JAX and Equinox, arXiv:2402.09983 (2024) DeepMind et al., The DeepMind JAX Ecosystem, http://github.com/google-deepmind (2020)

solver

solvers need to be initialized

Type:

optimistix-solver, optax-solver

alternating_optimization

if true, the optimizer alternates between amplitude and phase

Type:

bool

optimize_group_delay

if true, the group delay will be optimized instead of the spectral phase

Type:

bool

Module contents