nifty7.library.adjust_variances module

do_adjust_variances(position, A, minimizer, xi_key='xi', samples=[])[source]

Adjusts the variance of xi_key to be represented by amplitude_operator.

Solves a constant likelihood optimization of the form phi = A * position[xi_key] under the constraint that phi remains constant.

The field indexed by xi_key is desired to be a Gaussian white Field, thus variations that are more easily represented by A will be absorbed in A.

Parameters
  • position (Field, MultiField) – Contains the initial values for amplitude_operator and the key xi_key, to be adjusted.

  • A (Operator) – Gives the amplitude when evaluated at position.

  • minimizer (Minimizer) – Used to solve the optimization problem.

  • xi_key (String) – Key of the Field containing undesired variations. This Field is contained in position.

  • samples (Field, MultiField, optional) – Residual samples of position. If samples are supplied then phi remains only approximately constant. Default: [].

Returns

The new position after variances have been adjusted.

Return type

MultiField

make_adjust_variances_hamiltonian(a, xi, position, samples=[], scaling=None, ic_samp=None)[source]

Creates a Hamiltonian for constant likelihood optimizations.

Constructs a Hamiltonian to solve constant likelihood optimizations of the form phi = a * xi under the constraint that phi remains constant.

xi is desired to be a Gaussian white Field, thus variations that are more easily represented by a should be absorbed in a.

Parameters
  • a (Operator) – Gives the amplitude when evaluated at position.

  • xi (Operator) – Field Adapter selecting a part of position. xi is desired to be a Gaussian white Field.

  • position (Field, MultiField) – Contains the initial values for the operators a and xi, to be adjusted

  • samples (Field, MultiField) – Residual samples of position.

  • scaling (Float) – Optional rescaling of the Likelihood.

  • ic_samp (Controller) – Iteration Controller for Hamiltonian.

Returns

A Hamiltonian that can be used for further minimization.

Return type

StandardHamiltonian