pycif.plugins.modes.variational — API reference

pycif.plugins.modes.variational — API reference#

Configuration reference: variational plugin

pycif.plugins.modes.variational.execute.execute(self, **kwargs)[source]#

Performs a variational inversion given a minimizer method and a simulator (i.e. a function to minimize and its gradient)

Parameters:

self (Plugin) – definition of the mode set-up

pycif.plugins.modes.variational.sampling.compute_sample(self, controlvect, obsvect, x_sample, y_sample)[source]#

Submit one variational inversion per ensemble member and collect the results.

For each (x, y) pair in x_sample / y_sample, dumps a tailored YAML configuration and control/obs vectors, then submits the run via the platform plugin (or as a subprocess for the last member). After all jobs finish, discards members that did not converge correctly and moves the posterior control vectors into a common output directory.

Parameters:
  • self (Plugin) – mode plugin providing workdir, platform, montecarlo, and the reference YAML configuration.

  • controlvect – control vector plugin (xb is modified per member and restored on return).

  • obsvect – observation vector plugin (yobs is modified per member and restored on return).

  • x_sample (np.ndarray) – ensemble of prior control vectors, shape (nsample + 1, control_dim); row 0 is the reference.

  • y_sample (np.ndarray) – ensemble of perturbed observation vectors, shape (nsample + 1, obs_dim); row 0 is the reference.

Returns:

number of valid (converged) samples, excluding the reference.

Return type:

int

Raises:

Exception – if the reference member (index 0) did not converge, or if a sample terminated with an unhandled exception.