thztools.FitResult#

class thztools.FitResult(p_opt, _p_err, p_cov, mu_opt, _mu_err, mu_cov, psi_opt, psi_cov, frfun_opt, resnorm, dof, delta, delta_norm, delta_norm_cov, epsilon, epsilon_norm, epsilon_norm_cov, delta_norm_epsilon_norm_cov, r_tls, success, diagnostic)[source]#

Dataclass for the output of fit.

Parameters:
p_optndarray

Optimal fit parameters.

p_errndarray

Uncertainty estimate for p_opt, p_err = np.sqrt(np.diag(p_cov)).

Deprecated since version 0.6.0: This option is deprecated and will be removed in version 0.8.0.

p_covndarray

Covariance matrix estimate for p_opt, determined from the curvature of the cost function at (p_opt, mu_opt). To compute one standard deviation errors on the parameters, use p_err = np.sqrt(np.diag(p_cov)).

mu_optndarray

Optimal estimate of the input waveform.

mu_errndarray

Estimated uncertainty in mu_opt, determined from the curvature of the cost function at (p_opt, mu_opt).

Deprecated since version 0.6.0: This option is deprecated and will be removed in version 0.8.0.

mu_covndarray

Covariance matrix estimate for mu_opt, determined from the curvature of the cost function at (p_opt, mu_opt). To compute one standard deviation errors of the input waveform, use mu_err = np.sqrt(np.diag(mu_cov)).

psi_optndarray

Optimal estimate of the output waveform.

psi_covndarray

Covariance matrix estimate for psi_opt. To compute one standard deviation errors of the output waveform, use psi_err = np.sqrt(np.diag(psi_cov)).

frfun_optcomplex ndarray

Estimated values of the frequency response function at non-negative frequencies.

resnormfloat

Euclidean norm (i.e., sum of the squares) of the normalized total least-squares residuals.

dofint

Number of statistical degrees of freedom, dof = n - n_p - n_a - n_b, where n is the number of samples in each waveform, n_p is the number of fit parameters in the frequency response function, and n_a + n_b is the number of real parameters necessary to specify the frequency response function at the excluded frequencies.

deltandarray

Residuals of the input waveform x, defined as x - mu_opt.

delta_normndarray

Normalized residuals of the input waveform x, defined as delta/noise_model.noise_amp(xdata).

delta_norm_covndarray

Covariance matrix estimate for delta_norm.

epsilonndarray

Residuals of the output waveform y, defined as y - psi_opt, where psi_opt = thztools.apply_frf(frfun, mu, dt=dt, args=p_opt), frfun is the parameterized frequency response function, and p_opt is the array of optimized parameters.

epsilon_normndarray

Normalized residuals of the output waveform y, defined as epsilon/noise_model.noise_amp(ydata).

epsilon_norm_covndarray

Covariance matrix estimate for epsilon_norm.

delta_norm_epsilon_norm_covndarray

Cross-covariance matrix of the normalized residuals delta_norm and epsilon_norm.

r_tlsndarray

Normalized total least-squares residuals.

successbool

True if one of the convergence criteria is satisfied.

diagnosticscipy.optimize.OptimizeResult

Instance of scipy.optimize.OptimizeResult returned by scipy.optimize.least_squares.

Attributes

p_opt

(ndarray) Optimal fit parameters.

p_err

(ndarray) Uncertainty estimate for p_opt, p_err = np.sqrt(np.diag(p_cov)).

p_cov

(ndarray) Covariance matrix estimate for p_opt, determined from the curvature of the cost function at (p_opt, mu_opt). To compute the standard errors for the parameters, use p_err = np.sqrt(np.diag(p_cov)).

mu_opt

(ndarray) Optimal estimate of the input waveform.

mu_err

(ndarray) Estimated uncertainty in mu_opt, determined from the curvature of the cost function at (p_opt, mu_opt).

mu_cov

(ndarray) Covariance matrix estimate for mu_opt, determined from the curvature of the cost function at (p_opt, mu_opt). To compute the standard errors for the input waveform, use mu_err = np.sqrt(np.diag(mu_cov)).

psi_opt

(ndarray) Optimal estimate of the output waveform.

psi_cov

(ndarray) Covariance matrix estimate for psi_opt. To compute the standard errors for the output waveform, use psi_err = np.sqrt(np.diag(psi_cov)).

frfun_opt

(complex ndarray) Estimated values of the frequency response function at non-negative frequencies.

resnorm

(float) Euclidean norm (i.e., sum of the squares) of the normalized total least-squares residuals.

dof

(int) Number of statistical degrees of freedom, dof = n - n_p - n_a - n_b, where n is the number of samples in each waveform, n_p is the number of fit parameters in the frequency response function, and n_a + n_b is the number of real parameters necessary to specify the frequency response function at the excluded frequencies.

delta

(ndarray) Residuals of the input waveform x, defined as x - mu_opt.

delta_norm

(ndarray) Normalized residuals of the input waveform x, defined as delta/noise_model.noise_amp(xdata).

delta_norm_cov

(ndarray) Covariance matrix estimate for delta_norm.

epsilon

(ndarray) Residuals of the output waveform y, defined as y - psi_opt, where psi_opt = thztools.apply_frf(frfun, mu, dt=dt, args=p_opt), frfun is the parameterized frequency response function, and p_opt is the array of optimized parameters.

epsilon_norm

(ndarray) Normalized residuals of the output waveform y, defined as epsilon/noise_model.noise_amp(ydata).

epsilon_norm_cov

(ndarray) Covariance matrix estimate for epsilon_norm.

delta_norm_epsilon_norm_cov

(ndarray) Cross-covariance matrix of the normalized residuals delta_norm and epsilon_norm.

r_tls

(ndarray) Normalized total least-squares residuals.

success

(bool) True if one of the convergence criteria is satisfied.

diagnostic

(scipy.optimize.OptimizeResult) Instance of scipy.optimize.OptimizeResult returned by scipy.optimize.least_squares.

See also

fit

Fit a frequency response function to time-domain data.