flip.likelihood

Attributes

Classes

Functions

create_log([log_level])

The create_log function creates a logger object that can be used to log messages.

log_likelihood_gaussian_inverse(vector, covariance_sum)

log_likelihood_gaussian_cholesky(vector, covariance_sum)

Module Contents

flip.likelihood.create_log(log_level='info')[source]

The create_log function creates a logger object that can be used to log messages. The function takes one argument, the log_level, which is set to "info" by default. The function returns a Logger object with the specified logging level.

Parameters:

log_level – Set the logging level

Returns:

A logger object

flip.likelihood.log
flip.likelihood._available_priors = ['gaussian']
flip.likelihood.log_likelihood_gaussian_inverse(vector, covariance_sum)[source]
flip.likelihood.log_likelihood_gaussian_cholesky(vector, covariance_sum)[source]
class flip.likelihood.BaseLikelihood(covariance=None, data=None, parameter_names=None, prior=None, likelihood_properties={})[source]

Bases: object

_default_likelihood_properties
classmethod init_from_covariance(covariance, data, parameter_names, likelihood_properties={}, **kwargs)[source]

The init_from_covariance function is a class method that initializes the likelihood object from a covariance matrix.

Parameters:
  • cls – Create a new instance of the class

  • covariance – Compute the full matrix of the covariance

  • parameter_names – Set the names of the parameters

  • density – Compute the vector and its error

  • density_err – Compute the vector_err

  • velocity – Compute the vector and vector_err

  • velocity_err – Compute the error in the vector

:param : Compute the vector

Returns:

A likelihood object

load_data_vector(model_type, parameter_values_dict)[source]
initialize_prior()[source]
class flip.likelihood.MultivariateGaussianLikelihood(covariance=None, data=None, parameter_names=None, prior=None, likelihood_properties={})[source]

Bases: BaseLikelihood

verify_covariance()[source]
__call__(parameter_values)[source]
class flip.likelihood.MultivariateGaussianLikelihoodInterpolate1D(covariance=None, data=None, parameter_names=None, prior=None, likelihood_properties={}, interpolation_value_name=None, interpolation_value_range=None)[source]

Bases: BaseLikelihood

verify_covariance()[source]
The verify_covariance function is used to ensure that the covariance matrix of each

parameter in the model has been computed. If it has not, then this function will compute it and store it as a full matrix.

Parameters:

self – Bind the method to the object

Returns:

Nothing

__call__(parameter_values)[source]

The __call__ function is the function that is called when you call an instance of a class. For example, if you have a class named ‘Foo’ and create an instance of it like this:

foo = Foo()

then calling foo(x) will actually run the __call__ function in your Foo class with x as its argument.

Parameters:
  • self – Refer to the object itself

  • parameter_values – Pass the values of the parameters to be used in this evaluation

  • interpolation_value – Interpolate the covariance_sum

Returns:

The log likelihood value of the data vector given a set of parameters and an interpolation value

class flip.likelihood.MultivariateGaussianLikelihoodInterpolate2D(covariance=None, data=None, parameter_names=None, prior=None, likelihood_properties={}, interpolation_value_range_0=None, interpolation_value_range_1=None)[source]

Bases: BaseLikelihood

verify_covariance()[source]
__call__(parameter_values, interpolation_value_0, interpolation_value_1)[source]

The __call__ function is the function that will be called when the likelihood object is called. It takes in a list of parameter values, and returns a float value representing the log-likelihood value for those parameters. The __call__ method should not be overwritten by subclasses unless you know what you are doing!

Parameters:
  • self – Refer to the object itself

  • parameter_values – Compute the covariance matrix

  • interpolation_value_0 – Interpolate the covariance matrix along the first dimension

  • interpolation_value_1 – Interpolate the covariance matrix

:param : Compute the covariance sum

Returns:

The log-likelihood function

class flip.likelihood.Prior(parameter_name=None)[source]
class flip.likelihood.GaussianPrior(parameter_name=None, prior_mean=None, prior_standard_deviation=None)[source]

Bases: Prior

__call__(parameter_values_dict)[source]