pygimli.math#

Math functions and matrices.

Overview#

Functions

angle(p1, p2, p3)

C++ signature :

besselI0(x)

Caluculate modified Bessel function of the first kind See Abramowitz: Handbook of math.

besselI1(x)

Caluculate modified Bessel function of the first kind See Abramowitz: Handbook of math.

besselK0(x)

Caluculate modified Bessel function of the second kind See Abramowitz: Handbook of math.

besselK1(x)

Caluculate modified Bessel function of the second kind See Abramowitz: Handbook of math.

cos(a)

C++ signature :

cot(a)

C++ signature :

createCm05(*args, **kwargs)

det(A)

Return determinant for Matrix A.

dot(A, B, c, ret)

C++ signature :

exp(a)

C++ signature :

exp10(a)

C++ signature :

imag(A)

C++ signature :

log(a)

C++ signature :

log10(a)

C++ signature :

logMean(spec, model[, axis])

Compute log-mean (log-weighted mean) value of distribution.

max(v)

C++ signature :

median(a)

C++ signature :

min(v)

C++ signature :

pow(v, p)

Power function.

rand(vec [[, min, max])

C++ signature :

randn(vec)

C++ signature :

real(A)

C++ signature :

rms(a)

C++ signature :

round(v, tol)

C++ signature :

rrms(a, b)

C++ signature :

sign(a)

C++ signature :

sin(a)

C++ signature :

sqrt(a)

C++ signature :

sum(c)

Templates argue with python bindings

symlog(x[, tol, linearSpread])

Symmetric bi-logarithmic transformation (as used in matplotlib).

symlogInv(y[, tol, linearSpread])

Inverse symlog transformation.

toComplex(re, im)

C++ signature :

unique(a)

C++ signature :

Functions#

pygimli.math.angle((object)p1, (object)p2, (object)p3) object :#
C++ signature :

double angle(GIMLI::Pos,GIMLI::Pos,GIMLI::Pos)

angle( (object)z) -> object :

C++ signature :

GIMLI::Vector<double> angle(GIMLI::Vector<std::complex<double> >)

angle( (object)b, (object)a) -> object :

C++ signature :

GIMLI::Vector<double> angle(GIMLI::Vector<double>,GIMLI::Vector<double>)

pygimli.math.besselI0((object)x) object :#

Caluculate modified Bessel function of the first kind See Abramowitz: Handbook of math. functions; DLLEXPORT double besselI0(double x);

C++ signature :

double besselI0(double)

pygimli.math.besselI1((object)x) object :#

Caluculate modified Bessel function of the first kind See Abramowitz: Handbook of math. functions DLLEXPORT double besselI1(double x);

C++ signature :

double besselI1(double)

pygimli.math.besselK0((object)x) object :#

Caluculate modified Bessel function of the second kind See Abramowitz: Handbook of math. functions DLLEXPORT double besselK0(double x);

C++ signature :

double besselK0(double)

Examples using pygimli.math.besselK0

Geoelectrics in 2.5D

Geoelectrics in 2.5D
pygimli.math.besselK1((object)x) object :#

Caluculate modified Bessel function of the second kind See Abramowitz: Handbook of math. functions DLLEXPORT double besselK1(double x);

C++ signature :

double besselK1(double)

Examples using pygimli.math.besselK1

Geoelectrics in 2.5D

Geoelectrics in 2.5D
pygimli.math.cos((object)a) object :#
C++ signature :

GIMLI::Vector<double> cos(GIMLI::Vector<double>)

pygimli.math.cot((object)a) object :#
C++ signature :

GIMLI::Vector<double> cot(GIMLI::Vector<double>)

cot( (object)a) -> object :

C++ signature :

double cot(double)

pygimli.math.createCm05(*args, **kwargs)#
pygimli.math.det((object)A) object :#

Return determinant for Matrix A. This function is a stub. Only Matrix dimensions of 2 and 3 are considered.

C++ signature :

double det(GIMLI::Matrix3<double>)

det( (object)A) -> object :

Return determinant for Matrix A. This function is a stub. Only Matrix dimensions of 2 and 3 are considered.

C++ signature :

double det(GIMLI::Matrix3<double>)

det( (object)A) -> object :

Return determinant for Matrix A. This function is a stub. Only Matrix dimensions of 2 and 3 are considered.

C++ signature :

double det(GIMLI::Matrix<double>)

pygimli.math.dot((object)A, (object)B, (object)c, (object)ret) object :#
C++ signature :

void* dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,double,GIMLI::ElementMatrix<double> {lvalue})

dot( (object)A, (object)B, (object)c, (object)ret) -> object :

C++ signature :

void* dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,GIMLI::Pos,GIMLI::ElementMatrix<double> {lvalue})

dot( (object)A, (object)B, (object)c, (object)ret) -> object :

C++ signature :

void* dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,GIMLI::Matrix<double>,GIMLI::ElementMatrix<double> {lvalue})

dot( (object)A, (object)B, (object)c, (object)ret) -> object :

C++ signature :

void* dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,GIMLI::FEAFunction,GIMLI::ElementMatrix<double> {lvalue})

dot( (object)A, (object)B, (object)c) -> object :

C++ signature :

GIMLI::ElementMatrix<double> dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,double)

dot( (object)A, (object)B, (object)c) -> object :

C++ signature :

GIMLI::ElementMatrix<double> dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,GIMLI::Pos)

dot( (object)A, (object)B, (object)c) -> object :

C++ signature :

GIMLI::ElementMatrix<double> dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,GIMLI::Matrix<double>)

dot( (object)A, (object)B [, (object)c]) -> object :

C++ signature :

GIMLI::ElementMatrix<double> dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double> [,GIMLI::FEAFunction])

dot( (object)A, (object)B, (object)ret) -> object :

C++ signature :

void* dot(GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double>,GIMLI::ElementMatrix<double> {lvalue})

dot( (object)v1, (object)v2) -> object :

C++ signature :

double dot(GIMLI::Vector<double>,GIMLI::Vector<double>)

pygimli.math.exp((object)a) object :#
C++ signature :

GIMLI::Vector<double> exp(GIMLI::Vector<double>)

pygimli.math.exp10((object)a) object :#
C++ signature :

GIMLI::Vector<double> exp10(GIMLI::Vector<double>)

exp10( (object)a) -> object :

C++ signature :

double exp10(double)

pygimli.math.imag((object)A) object :#
C++ signature :

GIMLI::SparseMapMatrix<double, unsigned long> imag(GIMLI::SparseMapMatrix<std::complex<double>, unsigned long>)

imag( (object)A) -> object :

C++ signature :

GIMLI::SparseMatrix<double> imag(GIMLI::SparseMatrix<std::complex<double> >)

imag( (object)cv) -> object :

C++ signature :

GIMLI::Matrix<double> imag(GIMLI::Matrix<std::complex<double> >)

imag( (object)A) -> object :

C++ signature :

GIMLI::Matrix<double> imag(GIMLI::Matrix<std::complex<double> >)

imag( (object)cv) -> object :

C++ signature :

GIMLI::Vector<double> imag(GIMLI::Vector<std::complex<double> >)

pygimli.math.log((object)a) object :#
C++ signature :

GIMLI::Vector<double> log(GIMLI::Vector<double>)

log( (object)type, (object)msg) -> object :

C++ signature :

void* log(GIMLI::LogType,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

log( (object)type, (object)vs) -> object :

C++ signature :

void* log(GIMLI::LogType,char const*)

log( (object)type, (object)vs, (object)vs) -> object :

C++ signature :

void* log(GIMLI::LogType,char const*,char const*)

log( (object)type, (object)vs) -> object :

C++ signature :

void* log(GIMLI::LogType,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

pygimli.math.log10((object)a) object :#
C++ signature :

GIMLI::Vector<double> log10(GIMLI::Vector<double>)

pygimli.math.logMean(spec, model, axis=0)[source]#

Compute log-mean (log-weighted mean) value of distribution.

specarray

abscissa values (spectral axis)

modelarray|array-2d

matrix of density values

axisint [0]

axis to sum over

pygimli.math.max((object)v) object :#
C++ signature :

int max(std::vector<int, std::allocator<int> >)

max( (object)v) -> object :

C++ signature :

std::complex<double> max(GIMLI::Vector<std::complex<double> >)

max( (object)v) -> object :

C++ signature :

unsigned long max(GIMLI::Vector<unsigned long>)

max( (object)v) -> object :

C++ signature :

double max(GIMLI::Vector<double>)

max( (object)a, (object)b) -> object :

C++ signature :

unsigned long max(unsigned long,unsigned long)

max( (object)a, (object)b) -> object :

C++ signature :

int max(int,unsigned long)

pygimli.math.median((object)a) object :#
C++ signature :

double median(GIMLI::Vector<double>)

pygimli.math.min((object)v) object :#
C++ signature :

std::complex<double> min(GIMLI::Vector<std::complex<double> >)

min( (object)v) -> object :

C++ signature :

double min(GIMLI::Vector<double>)

min( (object)a, (object)b) -> object :

C++ signature :

unsigned long min(unsigned long,unsigned long)

pygimli.math.pow(v, p)[source]#

Power function.

pow(v, int) is misinterpreted as pow(v, rvec(int)), so we need to fix this

Examples using pygimli.math.pow

Polyfit

Polyfit
pygimli.math.rand((object)vec[, (object)min=0.0[, (object)max=1.0]]) object :#
C++ signature :

void* rand(GIMLI::Vector<double> {lvalue} [,double=0.0 [,double=1.0]])

pygimli.math.randn((object)vec) object :#
C++ signature :

void* randn(GIMLI::Vector<double> {lvalue})

randn( (object)n) -> object :

Create a array of len n with normal distributed randomized values.

C++ signature :

GIMLI::Vector<double> randn(unsigned long)

pygimli.math.real((object)A) object :#
C++ signature :

GIMLI::SparseMapMatrix<double, unsigned long> real(GIMLI::SparseMapMatrix<std::complex<double>, unsigned long>)

real( (object)A) -> object :

C++ signature :

GIMLI::SparseMatrix<double> real(GIMLI::SparseMatrix<std::complex<double> >)

real( (object)cv) -> object :

C++ signature :

GIMLI::Matrix<double> real(GIMLI::Matrix<std::complex<double> >)

real( (object)A) -> object :

C++ signature :

GIMLI::Matrix<double> real(GIMLI::Matrix<std::complex<double> >)

real( (object)cv) -> object :

C++ signature :

GIMLI::Vector<double> real(GIMLI::Vector<std::complex<double> >)

pygimli.math.rms((object)a) object :#
C++ signature :

double rms(GIMLI::Vector<double>)

rms( (object)a, (object)b) -> object :

C++ signature :

double rms(GIMLI::Vector<double>,GIMLI::Vector<double>)

pygimli.math.round((object)v, (object)tol) object :#
C++ signature :

GIMLI::Vector<double> round(GIMLI::Vector<double>,double)

pygimli.math.rrms((object)a, (object)b) object :#
C++ signature :

double rrms(GIMLI::Vector<double>,GIMLI::Vector<double>)

pygimli.math.sign((object)a) object :#
C++ signature :

GIMLI::Vector<double> sign(GIMLI::Vector<double>)

sign( (object)a) -> object :

C++ signature :

double sign(double)

pygimli.math.sin((object)a) object :#
C++ signature :

GIMLI::Vector<double> sin(GIMLI::Vector<double>)

pygimli.math.sqrt((object)a) object :#
C++ signature :

GIMLI::Vector<double> sqrt(GIMLI::Vector<double>)

pygimli.math.sum((object)c) object :#

Templates argue with python bindings

C++ signature :

std::complex<double> sum(GIMLI::Vector<std::complex<double> >)

sum( (object)r) -> object :

C++ signature :

double sum(GIMLI::Vector<double>)

sum( (object)i) -> object :

C++ signature :

long sum(GIMLI::Vector<long>)

pygimli.math.symlog(x, tol=1e-12, linearSpread=0)[source]#

Symmetric bi-logarithmic transformation (as used in matplotlib).

Transforms a signed values in a logarithmic way preserving the sign. All absolute values below a certain threshold are treated zero or linearly distributed (if linearSpread>0).

\[f(x) = sign(x) * (log10(1 + abs(x)/tol) + s/2)\]
Parameters:
  • x (iterable) – array to be transformed

  • tol (float [None]) – tolerance for minimum values to be treated zero (or linear)

  • linearSpread (float) – define how wide linear transformation is done (0-not, 1-one decade)

Returns:

y – transformed array of same size

Return type:

np.array

pygimli.math.symlogInv(y, tol=1e-12, linearSpread=0)[source]#

Inverse symlog transformation.

\[f(y) = sign(y) * (10^(abs(y)-s/2) - 1) * tol\]
Parameters:
  • y (iterable) – array to be transformed

  • tol (float [None]) – tolerance for minimum values to be treated zero (or linear)

  • linearSpread (float) – define how wide linear transformation is done (0-not, 1-one decade)

Returns:

x – transformed array of same size

Return type:

np.array

pygimli.math.toComplex((object)re, (object)im) object :#
C++ signature :

GIMLI::Vector<std::complex<double> > toComplex(GIMLI::Vector<double>,GIMLI::Vector<double>)

toComplex( (object)re [, (object)im=0.0]) -> object :

C++ signature :

GIMLI::Vector<std::complex<double> > toComplex(GIMLI::Vector<double> [,double=0.0])

toComplex( (object)re, (object)im) -> object :

C++ signature :

GIMLI::Vector<std::complex<double> > toComplex(double,GIMLI::Vector<double>)

pygimli.math.unique((object)a) object :#
C++ signature :

std::vector<long, std::allocator<long> > unique(std::vector<long, std::allocator<long> >)

unique( (object)a) -> object :

Returning a copy of the vector and replacing all consecutive occurrences of a value by a single instance of that value. e.g. [0 1 1 2 1 1] -> [0 1 2 1]. To remove all double values from the vector use an additionally sorting. e.g. unique(sort(v)) gets you [0 1 2].

C++ signature :

GIMLI::Vector<double> unique(GIMLI::Vector<double>)

unique( (object)a) -> object :

Returning a copy of the vector and replacing all consecutive occurrences of a value by a single instance of that value. e.g. [0 1 1 2 1 1] -> [0 1 2 1]. To remove all double values from the vector use an additionally sorting. e.g. unique(sort(v)) gets you [0 1 2].

C++ signature :

GIMLI::Vector<long> unique(GIMLI::Vector<long>)