This module implements testing procedures for retrieval algorithms.

pypret.pulse_error.best_constant_phase(E, E0)[source]

Finds c with |c| = 1 so that sum(abs2(c * y1 - y2)) is minimal.

Uses an analytic solution.

pypret.pulse_error.optimal_rms_error(w, E, E0)[source]

Calculates the RMS error of two arrays, ignoring scaling, constant and linear phase of one of them.

Formally it calculates the minimal error:

R = sqrt(|rho * exp(i*(x*a + b)) * y1 - y2|^2 / |y2|^2)

with respect to rho, a and b. If additionally conjugation = True then the error for conjugate(y1) is calculated and the best transformation of y1 is also returned.

pypret.pulse_error.pulse_error(E, E0, ft, dot_ambiguity=False, spectral_shift_ambiguity=False)[source]

Calculates the normalized rms error between two pulse spectra while taking into account the retrieval ambiguities.

One step in optimal_rms_error (the determination of the initial bracket) could probably be more efficient, see [Dorrer2002]). We use the less elegant but maybe more straightforward way of simply sampling the range for a bracket that encloses a minimum.

  • E0 (E,) – Complex-valued arrays that contain the spectra of the pulses. E will be matched against E0.
  • ft (FourierTransform instance) – Performs Fourier transforms on the pulse grid.
  • dot_ambiguity (bool, optional) – Takes the direction of time ambiguity into account. Default is False.
  • spectral_shift_ambiguity (bool, optional) – Takes the spectral shift ambiguity into account. Default is False.