API reference#

This page provides an auto-generated summary of comet_maths’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.

Interpolation#

interpolation.interpolation.Interpolator([...])

Class to provide a set of interpolation methods for the interpolation of data.

interpolation.interpolation.Interpolator.interpolate_1d(...)

Interpolates 1D data to defined coordinates x in 1D

interpolation.interpolation.Interpolator.interpolate_1d_along_example(...)

Method for interpolating between datapoints by following an example.

interpolation.interpolation.interpolate_1d(...)

Interpolates 1D data to defined coordinates x in 1D

interpolation.interpolation.default_unc_methods(method)

Function providing for each analytical interpolation method, the default methods that are compared to determine the model uncertainty for this interpolation method.

interpolation.interpolation.model_error_analytical_methods(...)

Function to calculate the interpolation model uncertainty by calculating the standard deviation between various interpolation methods.

interpolation.interpolation.gaussian_process_regression(...)

Function to perform interpolation using Gaussian process regression

interpolation.interpolation.gpr_basics(x_i, ...)

Function to perform basic gaussian process regression

interpolation.interpolation.interpolate_1d_along_example(...)

Method for interpolating between datapoints by following an example.

Linear Algebra#

linear_algebra.matrix_calculation.calculate_Jacobian(fun, x)

Calculate the local Jacobian of function y=f(x) for a given value of x

linear_algebra.matrix_calculation.calculate_corr(MC_y)

Calculate the correlation matrix between the MC-generated samples of output quantities.

linear_algebra.matrix_calculation.nearestPD_cholesky(A)

Find the nearest positive-definite matrix

linear_algebra.matrix_calculation.isPD(B)

Returns true when input is positive-definite, via Cholesky

linear_algebra.matrix_conversion.correlation_from_covariance(...)

Convert covariance matrix to correlation matrix

linear_algebra.matrix_conversion.uncertainty_from_covariance(...)

Convert covariance matrix to uncertainty

linear_algebra.matrix_conversion.convert_corr_to_cov(corr, u)

Convert correlation matrix to covariance matrix

linear_algebra.matrix_conversion.convert_cov_to_corr(cov, u)

Convert covariance matrix to correlation matrix

linear_algebra.matrix_conversion.calculate_flattened_corr(...)

Combine correlation matrices for different input quantities, with a correlation matrix that gives the correlation between the input quantities into a full (flattened) correlation matrix combining the two.

linear_algebra.matrix_conversion.separate_flattened_corr(...)

Separate a full (flattened) correlation matrix into a list of correlation matrices for each output variable and a correlation matrix between the output variables.

linear_algebra.matrix_conversion.expand_errcorr_dims(...)

Function to expand the provided correlation matrix (which defines the correlation along 1 or more dimensions), to higher dimensions, so that the total correlation matrix can be calculated.

linear_algebra.matrix_conversion.change_order_errcorr_dims(...)

Function to flip the order of the underlying dimensions for an err_corr for matrices that describe the combination of 2 dimensions

Generating MC Samples#

generate_sample.generate_sample.generate_sample(...)

Generate correlated MC sample of input quantity with given uncertainties and correlation matrix.

generate_sample.generate_sample.generate_error_sample(...)

Generate the errors of a correlated MC sample of input quantity with given uncertainties and correlation matrix.

generate_sample.generate_sample.generate_sample_shape(...)

function to determine the shape of the Monte Carlo (MC) sample

generate_sample.generate_sample.generate_sample_same(...)

Generate MC sample of input quantity with zero uncertainties.

generate_sample.generate_sample.generate_sample_random(...)

Generate MC sample of input quantity with random uncertainties.

generate_sample.generate_sample.generate_sample_systematic(...)

Generate correlated MC sample of input quantity with systematic uncertainties.

generate_sample.generate_sample.generate_sample_correlated(...)

Generate correlated MC sample of input quantity with given uncertainties and correlation matrix.

generate_sample.generate_sample.generate_sample_corr(...)

Generate correlated MC sample of input quantity with a given covariance matrix.

generate_sample.generate_sample.generate_sample_cov(...)

Generate correlated MC sample of input quantity with a given covariance matrix.

generate_sample.generate_sample.correlate_sample_corr(...)

Method to correlate independent sample of input quantities using correlation matrix and Cholesky decomposition.

generate_sample.probability_density_function.generate_sample_pdf(...)

Function to generate samples from standard probability functions (with zero as mean and 1 as width)