proxtoolbox.Utilities

Created on Thu Jan 28 14:10:51 2016

@author: rebecca

The “Utilities”-module contains various …

proxtoolbox.Utilities.Laplace_matrix(n)[source]

Discrete Laplace operator with Neumann boundary conditions

This method calculates the Laplacian for a 2-dim. signal (usually an image) of size n x n. The resulting matrix has size (n*n)x(n*n).

Parameters:
n : int - Dimension of input signal of size n x n
Returns:
L : sparse array - Discrete Laplace operator of size (n*n)x(n*n)
proxtoolbox.Utilities.procrustes(X, Y, scaling=True, reflection='best')[source]

A port of MATLAB’s procrustes function to Numpy.

Procrustes analysis determines a linear transformation (translation, reflection, orthogonal rotation and scaling) of the points in Y to best conform them to the points in matrix X, using the sum of squared errors as the goodness of fit criterion.

d, Z, [tform] = procrustes(X, Y)
Parameters:
X, Y

matrices of target and input coordinates. they must have equal numbers of points (rows), but Y may have fewer dimensions (columns) than X.

scaling

if False, the scaling component of the transformation is forced to 1

reflection

if ‘best’ (default), the transformation solution may or may not include a reflection component, depending on which fits the data best. setting reflection to True or False forces a solution with reflection or no reflection respectively.

Returns:
d

the residual sum of squared errors, normalized according to a measure of the scale of X, ((X - X.mean(0))**2).sum()

Z

the matrix of transformed Y-values

tform

a dict specifying the rotation, translation and scaling that maps X –> Y