Inverse Problem

This module provides a class encapsulating all data needed to define an inverse problem.

The goal is to allow the user to ignore the underlying details of the input data.

Indeed, if one want to work on Niklas’s data, and directly load all data from the raw .mat file, one just has to run:

InverseProblem.from_matfile(path)


Module implementation Details

class volcapy.inverse.inverse_problem.InverseProblem(cells_coords, forward, data_points, data_values)[source]

Numerical implementation of an inverse problem. Needs a forward and an inversion grid as input. Then can perform several inversions.

Attributes
cells_coords: 2D array

Coordinates of the inversion cells. Element i,j should contain j-th coordinate of inversion cell nr i. Note the order of the cells should reflect the order of the columns of the forward.

forward: 2D array

Forward operator.

data_points
data_values

Methods

build_partial_covariance(row_begin, row_end, …)

(DEPRECATED) Prepare a function for returning partial rows of the covariance matrix.

compute_covariance_pushforward(G, sigma0, …)

(DEPRECATED) Compute the matrix product C_m * G^T, which we call the covariance pushforward.

compute_post_covariance()

(DEPRECATED) Compute the full posterior covariance matrix.

from_matfile(path)

Read forward, inversion grid and data from a matlab file.

inverse(out_folder, prior_mean, sigma_d, …)

(DEPRECATED) Perform inversion.

save_squared_distance_mesh(path)

(DEPRECATED) Computes the matrix of squared euclidean distances betwen all couples and saves to disk.

subset(n_cells)

Subset an inverse problem by only keeping n_cells inversion cells selected at random.

subset_data(n_keep[, seed])

Subset an inverse problem by only keeping n_keep data points selected at random.

build_partial_covariance(row_begin, row_end, sigma0, lambda0)[source]

(DEPRECATED) Prepare a function for returning partial rows of the covariance matrix.

Warning: should cast, since returns MemoryView.

compute_covariance_pushforward(G, sigma0, lambda0)[source]

(DEPRECATED) Compute the matrix product C_m * G^T, which we call the covariance pushforward.

Parameters
G: 2-D array

The forward operator.

compute_post_covariance()[source]

(DEPRECATED) Compute the full posterior covariance matrix.

classmethod from_matfile(path)[source]

Read forward, inversion grid and data from a matlab file.

Parameters
path: string

Path to a matlab file containing the data. The file should have the same format as the original file from Niklas (see documentation).

inverse(out_folder, prior_mean, sigma_d, sigma0, lambda0, preload_covariance_pushforward=False, cov_pushforward=None, compute_post_covariance=False)[source]

(DEPRECATED) Perform inversion.

Parameters
out_folder: string

Path to a folder where we will save the resutls.

compute_post_covariance: Boolean

If set to True, then will compute and store the full posterior covariance matrix (huge).

save_squared_distance_mesh(path)[source]

(DEPRECATED) Computes the matrix of squared euclidean distances betwen all couples and saves to disk.

subset(n_cells)[source]

Subset an inverse problem by only keeping n_cells inversion cells selected at random. This is used to make the problem more tractable and allow prototyping calculations on a small computer.

The effect of this method is to directly modify the attributes of the class to adapt them to the smaller problem.

Parameters
n_cells: int

Only keep the first n_cells.

subset_data(n_keep, seed=None)[source]

Subset an inverse problem by only keeping n_keep data points selected at random.

The effect of this method is to directly modify the attributes of the class to adapt them to the smaller problem.

Parameters
n_keep: int

Only keep n_keep data points.

seed: int

Can be used to make choice of test data predictable.

Returns
(rest_forward, rest_data)