Model

digraph inheritance456558ffd0 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "Model" [URL="#geobipy.src.classes.model.Model.Model",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Generic model class with an attached mesh."]; "myObject" -> "Model" [arrowsize=0.5,style="setlinewidth(0.5)"]; "myObject" [URL="../core/myObject.html#geobipy.src.classes.core.myObject.myObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "ABC" -> "myObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

@Model_Class Module describing a Model

class geobipy.src.classes.model.Model.Model(mesh=None, values=None)

Generic model class with an attached mesh.

classmethod fromHdf(grp, index=None, skip_posterior=False)

Reads in the object from a HDF file

property gradient

Compute the gradient

Parameter gradient :math:”nabla_{z}sigma” at the ith layer is computed via

gradient_probability(log=True)

Evaluate the prior for the gradient of the parameter with depth

Parameters:

hmin (float64) – The minimum thickness of any layer.

Returns:

out – The probability given the prior on the gradient of the parameters with depth.

Return type:

numpy.float64

local_inverse_hessian(observation=None)

Generate a localized Hessian matrix using a dataPoint and the current realization of the Model1D.

Parameters:

observation (geobipy.DataPoint, geobipy.Dataset, optional) – The observed data to use when computing the local estimate of the variance.

Returns:

out – Hessian matrix

Return type:

array_like

local_precision(observation=None)

Generate a localized inverse Hessian matrix using a dataPoint and the current realization of the Model1D.

Parameters:

datapoint (geobipy.DataPoint, optional) – The data point to use when computing the local estimate of the variance. If None, only the prior derivative is used.

Returns:

out – Inverse Hessian matrix

Return type:

array_like

local_variance(observation=None)

Generate a localized inverse Hessian matrix using a dataPoint and the current realization of the Model1D.

Parameters:

datapoint (geobipy.DataPoint, optional) – The data point to use when computing the local estimate of the variance. If None, only the prior derivative is used.

Returns:

out – Inverse Hessian matrix

Return type:

array_like

pad(shape)

Copies the properties of a model including all priors or proposals, but pads memory to the given size

Parameters:

size (int, tuple) – Create memory upto this size.

Returns:

out – Padded model

Return type:

geobipy.Model1D

pcolor(**kwargs)

Plot like an image

Parameters:
  • alpha (scalar or array_like, optional) – If alpha is scalar, behaves like standard matplotlib alpha and opacity is applied to entire plot If array_like, each pixel is given an individual alpha value.

  • log ('e' or float, optional) – Take the log of the colour to a base. ‘e’ if log = ‘e’, and a number e.g. log = 10. Values in c that are <= 0 are masked.

  • equalize (bool, optional) – Equalize the histogram of the colourmap so that all colours have an equal amount.

  • nbins (int, optional) – Number of bins to use for histogram equalization.

  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’

  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • flipX (bool, optional) – Flip the X axis

  • flipY (bool, optional) – Flip the Y axis

  • grid (bool, optional) – Plot the grid

  • noColorbar (bool, optional) – Turn off the colour bar, useful if multiple plotting plotting routines are used on the same figure.

  • trim (bool, optional) – Set the x and y limits to the first and last non zero values along each axis.

perturb(*args, **kwargs)

Perturb a model’s structure and parameter values.

Uses a stochastic newtown approach if a datapoint is provided. Otherwise, uses the existing proposal distribution attached to self.par to generate new values.

Parameters:

observation (geobipy.DataPoint, optional) – The datapoint to use to perturb using a stochastic Newton approach.

Returns:

  • remappedModel (geobipy.Model) – The current model remapped onto the perturbed dimension.

  • perturbedModel (geobipy.Model) – The model with perturbed structure and parameter values.

probability(solve_value, solve_gradient)

Evaluate the prior probability for the 1D Model.

Parameters:
  • sPar (bool) – Evaluate the prior on the parameters in the final probability

  • sGradient (bool) – Evaluate the prior on the parameter gradient in the final probability

  • components (bool, optional) – Return all components used in the final probability as well as the final probability

Returns:

  • probability (numpy.float64) – The probability

  • components (array_like, optional) – Return the components of the probability, i.e. the individually evaluated priors as a second return argument if comonents=True on input.

proposal_probabilities(remapped_model, observation=None, structure_only=False, alpha=1.0)

Return the forward and reverse proposal probabilities for the model

Returns the denominator and numerator for the model’s components of the proposal ratio.

(1)\[q(k, \boldsymbol{z} | \boldsymbol{m}^{'})\]

and

(2)\[q(k^{'}, \boldsymbol{z}^{'} | \boldsymbol{m})\]

Each component is dependent on the event that was chosen during perturbation.

Parameters:
  • remappedModel (geobipy.Model1D) – The current model, remapped onto the dimension of self.

  • observation (geobipy.DataPoint) – The perturbed datapoint that was used to generate self.

Returns:

  • forward (float) – The forward proposal probability

  • reverse (float) – The reverse proposal probability

set_priors(values_prior=None, gradient_prior=None, **kwargs)

Setup the priors of a 1D model.

Parameters:
  • halfSpaceValue (float) – Value of the parameter for the halfspace.

  • min_edge (float64) – Minimum depth possible for the model

  • max_edge (float64) – Maximum depth possible for the model

  • max_cells (int) – Maximum number of layers allowable in the model

  • parameterPrior (bool) – Sets a prior on the parameter values

  • gradientPrior (bool) – Sets a prior on the gradient of the parameter values

  • parameterLimits (array_like, optional) – Length 2 array with the bounds on the parameter values to impose.

  • min_width (float64, optional) – Minimum thickness of any layer. If min_width = None, min_width is computed from min_edge, max_edge, and max_cells (recommended).

  • factor (float, optional) – Tuning parameter used in the std of the parameter prior.

  • prng (numpy.random.RandomState(), optional) – Random number generator, if none is given, will use numpy’s global generator.

See also

geobipy.Model1D.perturb

For a description of the perturbation cycle.

set_proposals(proposal=None, **kwargs)

Setup the proposals of a 1D model.

Parameters:
  • halfSpaceValue (float) – Value of the parameter for the halfspace.

  • probabilities (array_like) – Probability of birth, death, perturb, and no change for the model e.g. pWheel = [0.5, 0.25, 0.15, 0.1]

  • parameterProposal (geobipy.Distribution) – The proposal distribution for the parameter.

  • prng (numpy.random.RandomState(), optional) – Random number generator, if none is given, will use numpy’s global generator.

See also

geobipy.Model1D.perturb

For a description of the perturbation cycle.

property summary

Summary of self

update_parameter_posterior(axis=0)

Imposes a model’s parameters with depth onto a 2D Hitmap.

The cells that the parameter-depth profile passes through are accumulated by 1.

Parameters:

Hitmap (geobipy.Hitmap) – The hitmap to add to

update_posteriors(ratio=0.5)

Update any attached posterior distributions.

Parameters:

minimumRatio (float) – Only update the depth posterior if the layer parameter ratio is greater than this number.