square(val)
Returns the squared value of the parameter.
Parameters
val Value to be squared
logSave(val)
Returns the natural logarithm of the value if the value is larger than zero, otherwise return a low number.
Parameters
val Numerical input value.
sqrtAbs(val)
Returns the square root of the absolute of a number.
Parameters
val Numerical input value
Example
>>> sqrtAbs(-4)
2
funcGaussian(x, sigma, mu)
Implementation of the Gauss function.
Parameters
x Position at which the Gaussian is evaluated sigma Width of the Gaussian mu Mean value of the Gaussian
hMax(vec)
Return the maximum value in a vector.
Parameters
vec Numeric input vector
Usage
vec.max() -> maximum value
hMax(vec, max_value)
For each element in a vector replace its value by the maximum of the element value and an input value.
Parameters
vec Numeric input vector max_value Maximum value
Usage
vec.max(max_value) -> all values in vec are larger (or equal) than max_value
v=hArray(range(5))
v.max(3) -> [3,4]
hMaxDiff(vec)
Return the maximum difference between values in a vector.
Parameters
vec Numeric input vector
Usage
vec.max() -> maximum value
hMin(vec)
Return the minimum value in a vector.
Parameters
vec Numeric input vector
Usage
vec.max() -> minimum value
hMin(vec, min_value)
For each element in a vector replace its value by the minimum of the element value and an in input value.
Parameters
vec Numeric input vector min_value Minimum value
Usage
vec.min(min_value) -> all values in vec are smaller (or equal) than min_value
Example
>>> v=hArray(range(5))
>>> v.min(3)
[0,1,2,3]
hMax(vec)
Return the maximum value in a vector.
Parameters
vec Numeric input vector
Usage
vec.max() -> maximum value
hMax(vec, max_value)
For each element in a vector replace its value by the maximum of the element value and an input value.
Parameters
vec Numeric input vector max_value Maximum value
Usage
vec.max(max_value) -> all values in vec are larger (or equal) than max_value
v=hArray(range(5))
v.max(3) -> [3,4]
hMin(vec)
Return the minimum value in a vector.
Parameters
vec Numeric input vector
Usage
vec.max() -> minimum value
hMin(vec, min_value)
For each element in a vector replace its value by the minimum of the element value and an in input value.
Parameters
vec Numeric input vector min_value Minimum value
Usage
vec.min(min_value) -> all values in vec are smaller (or equal) than min_value
Example
>>> v=hArray(range(5))
>>> v.min(3)
[0,1,2,3]
hMinimum(vec0, vec1)
For each element in a vector replace its value by the minimum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector
hMinimum(vec0, vec1, vec2)
For each element in a vector replace its value by the minimum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector vec2 Numeric input vector
hMinimum(vec0, vec1)
For each element in a vector replace its value by the minimum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector
hMinimum(vec0, vec1, vec2)
For each element in a vector replace its value by the minimum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector vec2 Numeric input vector
hMinimumAndMaximum(vec0, vec1, vec2, vec3)
For each element in two input vectors get the minimum and maximum in the output vectors
Parameters
vec0 Numeric input vector vec1 Numeric input vector vec2 Numeric input vector vec3 Numeric input vector
hMaximum(vec0, vec1, vec2)
For each element in a vector replace its value by the maximum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector vec2 Numeric input vector
hMaximum(vec0, vec1)
For each element in a vector replace its value by the maximum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector
hMaximum(vec0, vec1, vec2)
For each element in a vector replace its value by the maximum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector vec2 Numeric input vector
hMaximum(vec0, vec1)
For each element in a vector replace its value by the maximum of the element value in the vector itself and the element value in the second vector
Parameters
vec0 Numeric input vector vec1 Numeric input vector
hMaxPos(vec)
Return the position of the maximum value in a vector.
Parameters
vec Numeric input vector
Usage
vec.maxpos() -> i # position of maximum value
hMinPos(vec)
Return the position of the minimum value in a vector.
Parameters
vec Numeric input vector
Usage
vec.maxpos() -> i # position of minimum value
hAbs(vec)
Take the abs of all the elements in the vector.
Parameters
vec Numeric input and output vector
hAbs(vecout, vecin)
Take the abs of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hCos(vec)
Take the cos of all the elements in the vector.
Parameters
vec Numeric input and output vector
hCos(vecout, vecin)
Take the cos of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hCosh(vec)
Take the cosh of all the elements in the vector.
Parameters
vec Numeric input and output vector
hCosh(vecout, vecin)
Take the cosh of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hExp(vec)
Take the exp of all the elements in the vector.
Parameters
vec Numeric input and output vector
hExp(vecout, vecin)
Take the exp of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hLog(vec)
Take the log of all the elements in the vector.
Parameters
vec Numeric input and output vector
hLog(vecout, vecin)
Take the log of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hLog10(vec)
Take the log10 of all the elements in the vector.
Parameters
vec Numeric input and output vector
hLog10(vecout, vecin)
Take the log10 of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hLogSave(vec)
Take the logSave of all the elements in the vector.
Parameters
vec Numeric input and output vector
hLogSave(vecout, vecin)
Take the logSave of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSqrtAbs(vec)
Take the sqrtAbs of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSqrtAbs(vecout, vecin)
Take the sqrtAbs of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSin(vec)
Take the sin of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSin(vecout, vecin)
Take the sin of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSinh(vec)
Take the sinh of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSinh(vecout, vecin)
Take the sinh of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSqrt(vec)
Take the sqrt of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSqrt(vecout, vecin)
Take the sqrt of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSquare(vec)
Take the square of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSquare(vecout, vecin)
Take the square of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hTan(vec)
Take the tan of all the elements in the vector.
Parameters
vec Numeric input and output vector
hTan(vecout, vecin)
Take the tan of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hTanh(vec)
Take the tanh of all the elements in the vector.
Parameters
vec Numeric input and output vector
hTanh(vecout, vecin)
Take the tanh of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hAbs(vec)
Take the abs of all the elements in the vector.
Parameters
vec Numeric input and output vector
hAbs(vecout, vecin)
Take the abs of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hCos(vec)
Take the cos of all the elements in the vector.
Parameters
vec Numeric input and output vector
hCos(vecout, vecin)
Take the cos of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hCosh(vec)
Take the cosh of all the elements in the vector.
Parameters
vec Numeric input and output vector
hCosh(vecout, vecin)
Take the cosh of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hExp(vec)
Take the exp of all the elements in the vector.
Parameters
vec Numeric input and output vector
hExp(vecout, vecin)
Take the exp of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hLog(vec)
Take the log of all the elements in the vector.
Parameters
vec Numeric input and output vector
hLog(vecout, vecin)
Take the log of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hLog10(vec)
Take the log10 of all the elements in the vector.
Parameters
vec Numeric input and output vector
hLog10(vecout, vecin)
Take the log10 of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hLogSave(vec)
Take the logSave of all the elements in the vector.
Parameters
vec Numeric input and output vector
hLogSave(vecout, vecin)
Take the logSave of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSqrtAbs(vec)
Take the sqrtAbs of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSqrtAbs(vecout, vecin)
Take the sqrtAbs of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSin(vec)
Take the sin of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSin(vecout, vecin)
Take the sin of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSinh(vec)
Take the sinh of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSinh(vecout, vecin)
Take the sinh of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSqrt(vec)
Take the sqrt of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSqrt(vecout, vecin)
Take the sqrt of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hSquare(vec)
Take the square of all the elements in the vector.
Parameters
vec Numeric input and output vector
hSquare(vecout, vecin)
Take the square of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hTan(vec)
Take the tan of all the elements in the vector.
Parameters
vec Numeric input and output vector
hTan(vecout, vecin)
Take the tan of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hTanh(vec)
Take the tanh of all the elements in the vector.
Parameters
vec Numeric input and output vector
hTanh(vecout, vecin)
Take the tanh of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
hAcos(vec)
Take the acos of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.acos() -> acos operation on vec.
hAcos(vecout, vecin)
Take the acos of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.acos(vec1) -> return result of acos operation on vec1 in vec2.
hAsin(vec)
Take the asin of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.asin() -> asin operation on vec.
hAsin(vecout, vecin)
Take the asin of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.asin(vec1) -> return result of asin operation on vec1 in vec2.
hAtan(vec)
Take the atan of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.atan() -> atan operation on vec.
hAtan(vecout, vecin)
Take the atan of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.atan(vec1) -> return result of atan operation on vec1 in vec2.
hCeil(vec)
Take the ceil of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.ceil() -> ceil operation on vec.
hCeil(vecout, vecin)
Take the ceil of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.ceil(vec1) -> return result of ceil operation on vec1 in vec2.
hFloor(vec)
Take the floor of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.floor() -> floor operation on vec.
hFloor(vecout, vecin)
Take the floor of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.floor(vec1) -> return result of floor operation on vec1 in vec2.
hRound(vec)
Take the round of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.round() -> round operation on vec.
hRound(vecout, vecin)
Take the round of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.round(vec1) -> return result of round operation on vec1 in vec2.
hAcos(vec)
Take the acos of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.acos() -> acos operation on vec.
hAcos(vecout, vecin)
Take the acos of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.acos(vec1) -> return result of acos operation on vec1 in vec2.
hAsin(vec)
Take the asin of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.asin() -> asin operation on vec.
hAsin(vecout, vecin)
Take the asin of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.asin(vec1) -> return result of asin operation on vec1 in vec2.
hAtan(vec)
Take the atan of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.atan() -> atan operation on vec.
hAtan(vecout, vecin)
Take the atan of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.atan(vec1) -> return result of atan operation on vec1 in vec2.
hCeil(vec)
Take the ceil of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.ceil() -> ceil operation on vec.
hCeil(vecout, vecin)
Take the ceil of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.ceil(vec1) -> return result of ceil operation on vec1 in vec2.
hFloor(vec)
Take the floor of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.floor() -> floor operation on vec.
hFloor(vecout, vecin)
Take the floor of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.floor(vec1) -> return result of floor operation on vec1 in vec2.
hRound(vec)
Take the round of all the elements in the vector.
Parameters
vec Numeric input and output vector
Usage
vec.round() -> round operation on vec.
hRound(vecout, vecin)
Take the round of all the elements in the vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Numeric input vector
Usage
vec2.round(vec1) -> return result of round operation on vec1 in vec2.
hPow(vec1, exponent)
Raises the values in the vector to a power N
Parameters
vec1 Numeric input and output vector exponent Value containing the power
Usage
vec.pow(N) -> [vec_0**N, vec_1**N, ....]
Example
a=hArray(float,5,fill=[0,1,2,3,4])
a.pow(3)
a # -> hArray(float, [5L], fill=[0,1,8,27,64]) # len=5 slice=[0:5])
hMulTo(vec1, vec2)
Performs a Mul between the two vectors, returning the output in the second vector (non-standard behaviour). If the first vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input vector vec2 Vector containing the second operand and output vector
Usage
hMulTo(vecA,vecB) -> vecB=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
hAddTo(vecA,vecB) -> vecB=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
hSubTo(vecA,vecB) -> vecB=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
hDivTo(vecA,vecB) -> vecB=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
::
#Example is for adding operation, mul, div, sub are similar
a1=hArray(int,[3,5],fill=range(5))
#a1->hArray(int, [3L, 5L], fill=[0,1,2,3,4,0,1,2,3,4,0,1,2,3,4]) # len=15 slice=[0:15])
a2=hArray(int,[5],fill=0)
a1[...].addto(a2)
#a2 -> hArray(int, [5L], fill=[0,3,6,9,12]) # len=5 slice=[0:5])
hAddTo(vec1, vec2)
Performs a Add between the two vectors, returning the output in the second vector (non-standard behaviour). If the first vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input vector vec2 Vector containing the second operand and output vector
Usage
hMulTo(vecA,vecB) -> vecB=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
hAddTo(vecA,vecB) -> vecB=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
hSubTo(vecA,vecB) -> vecB=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
hDivTo(vecA,vecB) -> vecB=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
::
#Example is for adding operation, mul, div, sub are similar
a1=hArray(int,[3,5],fill=range(5))
#a1->hArray(int, [3L, 5L], fill=[0,1,2,3,4,0,1,2,3,4,0,1,2,3,4]) # len=15 slice=[0:15])
a2=hArray(int,[5],fill=0)
a1[...].addto(a2)
#a2 -> hArray(int, [5L], fill=[0,3,6,9,12]) # len=5 slice=[0:5])
hDivTo(vec1, vec2)
Performs a Div between the two vectors, returning the output in the second vector (non-standard behaviour). If the first vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input vector vec2 Vector containing the second operand and output vector
Usage
hMulTo(vecA,vecB) -> vecB=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
hAddTo(vecA,vecB) -> vecB=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
hSubTo(vecA,vecB) -> vecB=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
hDivTo(vecA,vecB) -> vecB=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
::
#Example is for adding operation, mul, div, sub are similar
a1=hArray(int,[3,5],fill=range(5))
#a1->hArray(int, [3L, 5L], fill=[0,1,2,3,4,0,1,2,3,4,0,1,2,3,4]) # len=15 slice=[0:15])
a2=hArray(int,[5],fill=0)
a1[...].addto(a2)
#a2 -> hArray(int, [5L], fill=[0,3,6,9,12]) # len=5 slice=[0:5])
hSubTo(vec1, vec2)
Performs a Sub between the two vectors, returning the output in the second vector (non-standard behaviour). If the first vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input vector vec2 Vector containing the second operand and output vector
Usage
hMulTo(vecA,vecB) -> vecB=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
hAddTo(vecA,vecB) -> vecB=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
hSubTo(vecA,vecB) -> vecB=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
hDivTo(vecA,vecB) -> vecB=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
::
#Example is for adding operation, mul, div, sub are similar
a1=hArray(int,[3,5],fill=range(5))
#a1->hArray(int, [3L, 5L], fill=[0,1,2,3,4,0,1,2,3,4,0,1,2,3,4]) # len=15 slice=[0:15])
a2=hArray(int,[5],fill=0)
a1[...].addto(a2)
#a2 -> hArray(int, [5L], fill=[0,3,6,9,12]) # len=5 slice=[0:5])
hMul(vec1, vec2)
Performs a Mul between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hMul(vec1, scalar1)
Performs a Mul between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hMul(vec, vec1, vec2)
Performs a mul between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a mul between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
hMul(vec, vec1, scalar1)
Performs a mul between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hMul(vec,vec1,scalar) -> vec = vec1 mul scalar
vec.Mul(vec1,scalar) -> vec = vec1 mul scalar
hAdd(vec1, vec2)
Performs a Add between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hAdd(vec1, scalar1)
Performs a Add between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hAdd(vec, vec1, vec2)
Performs a add between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a add between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
hAdd(vec, vec1, scalar1)
Performs a add between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hAdd(vec,vec1,scalar) -> vec = vec1 add scalar
vec.Add(vec1,scalar) -> vec = vec1 add scalar
hDiv(vec1, vec2)
Performs a Div between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hDiv(vec1, scalar1)
Performs a Div between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hDiv(vec, vec1, vec2)
Performs a div between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a div between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
hDiv(vec, vec1, scalar1)
Performs a div between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hDiv(vec,vec1,scalar) -> vec = vec1 div scalar
vec.Div(vec1,scalar) -> vec = vec1 div scalar
hSub(vec1, vec2)
Performs a Sub between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hSub(vec1, scalar1)
Performs a Sub between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hSub(vec, vec1, vec2)
Performs a sub between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a sub between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
hSub(vec, vec1, scalar1)
Performs a sub between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hSub(vec,vec1,scalar) -> vec = vec1 sub scalar
vec.Sub(vec1,scalar) -> vec = vec1 sub scalar
hMulVec(vec1, vec2)
Performs a Mul (in-place) between the two vectors, which is returned in the first vector. If the first vector is shorter it will be wrapped unitl the end of the second vector is reached. Can, e.g., be used to calculate sums/products of vectors.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
hMul(vecA,vecB) = vecA.mul(vecB)
Example
v1=hArray(float,[3],fill=0)
v2=hArray(float,[3,3],fill=range(9))
v1.addvec(v2)
hAddVec(vec1, vec2)
Performs a Add (in-place) between the two vectors, which is returned in the first vector. If the first vector is shorter it will be wrapped unitl the end of the second vector is reached. Can, e.g., be used to calculate sums/products of vectors.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
hMul(vecA,vecB) = vecA.mul(vecB)
Example
v1=hArray(float,[3],fill=0)
v2=hArray(float,[3,3],fill=range(9))
v1.addvec(v2)
hDivVec(vec1, vec2)
Performs a Div (in-place) between the two vectors, which is returned in the first vector. If the first vector is shorter it will be wrapped unitl the end of the second vector is reached. Can, e.g., be used to calculate sums/products of vectors.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
hMul(vecA,vecB) = vecA.mul(vecB)
Example
v1=hArray(float,[3],fill=0)
v2=hArray(float,[3,3],fill=range(9))
v1.addvec(v2)
hSubVec(vec1, vec2)
Performs a Sub (in-place) between the two vectors, which is returned in the first vector. If the first vector is shorter it will be wrapped unitl the end of the second vector is reached. Can, e.g., be used to calculate sums/products of vectors.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
hMul(vecA,vecB) = vecA.mul(vecB)
Example
v1=hArray(float,[3],fill=0)
v2=hArray(float,[3,3],fill=range(9))
v1.addvec(v2)
hMul(vec1, vec2)
Performs a Mul between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hMul(vec1, scalar1)
Performs a Mul between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hMul(vec, vec1, vec2)
Performs a mul between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a mul between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
hMul(vec, vec1, scalar1)
Performs a mul between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hMul(vec,vec1,scalar) -> vec = vec1 mul scalar
vec.Mul(vec1,scalar) -> vec = vec1 mul scalar
hAdd(vec1, vec2)
Performs a Add between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hAdd(vec1, scalar1)
Performs a Add between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hAdd(vec, vec1, vec2)
Performs a add between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a add between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
hAdd(vec, vec1, scalar1)
Performs a add between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hAdd(vec,vec1,scalar) -> vec = vec1 add scalar
vec.Add(vec1,scalar) -> vec = vec1 add scalar
hDiv(vec1, vec2)
Performs a Div between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hDiv(vec1, scalar1)
Performs a Div between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hDiv(vec, vec1, vec2)
Performs a div between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a div between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
hDiv(vec, vec1, scalar1)
Performs a div between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hDiv(vec,vec1,scalar) -> vec = vec1 div scalar
vec.Div(vec1,scalar) -> vec = vec1 div scalar
hSub(vec1, vec2)
Performs a Sub between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hSub(vec1, scalar1)
Performs a Sub between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hSub(vec, vec1, vec2)
Performs a sub between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a sub between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
hSub(vec, vec1, scalar1)
Performs a sub between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hSub(vec,vec1,scalar) -> vec = vec1 sub scalar
vec.Sub(vec1,scalar) -> vec = vec1 sub scalar
hMul(vec1, vec2)
Performs a Mul between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hMul(vec1, scalar1)
Performs a Mul between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hMul(vec, vec1, vec2)
Performs a mul between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a mul between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
hMul(vec, vec1, scalar1)
Performs a mul between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hMul(vec,vec1,scalar) -> vec = vec1 mul scalar
vec.Mul(vec1,scalar) -> vec = vec1 mul scalar
hAdd(vec1, vec2)
Performs a Add between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hAdd(vec1, scalar1)
Performs a Add between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hAdd(vec, vec1, vec2)
Performs a add between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a add between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
hAdd(vec, vec1, scalar1)
Performs a add between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hAdd(vec,vec1,scalar) -> vec = vec1 add scalar
vec.Add(vec1,scalar) -> vec = vec1 add scalar
hDiv(vec1, vec2)
Performs a Div between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hDiv(vec1, scalar1)
Performs a Div between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hDiv(vec, vec1, vec2)
Performs a div between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a div between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
hDiv(vec, vec1, scalar1)
Performs a div between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hDiv(vec,vec1,scalar) -> vec = vec1 div scalar
vec.Div(vec1,scalar) -> vec = vec1 div scalar
hSub(vec1, vec2)
Performs a Sub between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hSub(vec1, scalar1)
Performs a Sub between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hSub(vec, vec1, vec2)
Performs a sub between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a sub between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
hSub(vec, vec1, scalar1)
Performs a sub between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hSub(vec,vec1,scalar) -> vec = vec1 sub scalar
vec.Sub(vec1,scalar) -> vec = vec1 sub scalar
hMulAdd(vec, vec1, vec2)
Performs a mul between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a mul between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hMulAdd2. To repeatedly add to the output vector, use hMulAddSum.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
See also
hMulAdd(vec, vec1, val)
Performs a mul between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hMul(vec,vec1,val) -> vec = vec1 mul val
vec.Mul(vec1,val) -> vec = vec1 mul val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hAddAdd(vec, vec1, vec2)
Performs a add between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a add between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hAddAdd2. To repeatedly add to the output vector, use hAddAddSum.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
See also
hAddAdd(vec, vec1, val)
Performs a add between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hAdd(vec,vec1,val) -> vec = vec1 add val
vec.Add(vec1,val) -> vec = vec1 add val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hDivAdd(vec, vec1, vec2)
Performs a div between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a div between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hDivAdd2. To repeatedly add to the output vector, use hDivAddSum.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
See also
hDivAdd(vec, vec1, val)
Performs a div between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hDiv(vec,vec1,val) -> vec = vec1 div val
vec.Div(vec1,val) -> vec = vec1 div val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hSubAdd(vec, vec1, vec2)
Performs a sub between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a sub between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hSubAdd2. To repeatedly add to the output vector, use hSubAddSum.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
See also
hSubAdd(vec, vec1, val)
Performs a sub between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hSub(vec,vec1,val) -> vec = vec1 sub val
vec.Sub(vec1,val) -> vec = vec1 sub val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hMulAdd(vec, vec1, vec2)
Performs a mul between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a mul between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hMulAdd2. To repeatedly add to the output vector, use hMulAddSum.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
See also
hMulAdd(vec, vec1, val)
Performs a mul between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hMul(vec,vec1,val) -> vec = vec1 mul val
vec.Mul(vec1,val) -> vec = vec1 mul val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hAddAdd(vec, vec1, vec2)
Performs a add between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a add between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hAddAdd2. To repeatedly add to the output vector, use hAddAddSum.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
See also
hAddAdd(vec, vec1, val)
Performs a add between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hAdd(vec,vec1,val) -> vec = vec1 add val
vec.Add(vec1,val) -> vec = vec1 add val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hDivAdd(vec, vec1, vec2)
Performs a div between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a div between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hDivAdd2. To repeatedly add to the output vector, use hDivAddSum.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
See also
hDivAdd(vec, vec1, val)
Performs a div between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hDiv(vec,vec1,val) -> vec = vec1 div val
vec.Div(vec1,val) -> vec = vec1 div val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hSubAdd(vec, vec1, vec2)
Performs a sub between the last two vectors, and add the result to the first vector which can be of different types.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a sub between the last two vectors, and add the result to the first vector which can be of different types. Looping will be done over the first argument, i.e. the input/output vector. If the second operand vector is shorter it will be applied multiple times.
To loop slices over the second argument (i.e., vec1) use hSubAdd2. To repeatedly add to the output vector, use hSubAddSum.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
See also
hSubAdd(vec, vec1, val)
Performs a sub between the input vector and a scalar, and add the result to the first vector which can be of different type. Looping will be done over the first argument, i.e. the output vector. If the second operand vector is shorter it will be applied multiple times.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand val Scalar value
Description
To loop slicec over the second argument (i.e., vec1) use hMulAdd2, hDivAdd2, hSubAdd2, hAddAdd2. To repeatedly add to the output vector, use hMulAddSum`.
Usage
hSub(vec,vec1,val) -> vec = vec1 sub val
vec.Sub(vec1,val) -> vec = vec1 sub val
See also
hMulAdd2(), hDivAdd2(), hSubAdd2(), hAddAdd2(), hMulAddSum(), hDivAddSum(), hSubAddSum(), hAddAddSum()
hMulAdd2(vec, vec1, vec2)
Performs a mul between the last two vectors, and add the result to the first vector which can be of different type.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the second argument, i.e. vec1. If the second operand vector (vec2) is shorter it will be applied multiple times. To loop over the first argument (i.e., vec) use hMulAdd. To repeatedly add to the output vector, use hMulAddSum.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
See also
hAddAdd2(vec, vec1, vec2)
Performs a add between the last two vectors, and add the result to the first vector which can be of different type.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the second argument, i.e. vec1. If the second operand vector (vec2) is shorter it will be applied multiple times. To loop over the first argument (i.e., vec) use hAddAdd. To repeatedly add to the output vector, use hAddAddSum.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
See also
hDivAdd2(vec, vec1, vec2)
Performs a div between the last two vectors, and add the result to the first vector which can be of different type.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the second argument, i.e. vec1. If the second operand vector (vec2) is shorter it will be applied multiple times. To loop over the first argument (i.e., vec) use hDivAdd. To repeatedly add to the output vector, use hDivAddSum.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
See also
hSubAdd2(vec, vec1, vec2)
Performs a sub between the last two vectors, and add the result to the first vector which can be of different type.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the second argument, i.e. vec1. If the second operand vector (vec2) is shorter it will be applied multiple times. To loop over the first argument (i.e., vec) use hSubAdd. To repeatedly add to the output vector, use hSubAddSum.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
See also
hMulAddSum(vec, vec1, vec2)
Performs a mul between the last two vectors, and add the result to the first vector which can be of different type. Wrap and repeatedly add to input array if shorter.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the first argument, i.e. the output vector. If the output vector is shorter than the first operand vector it will be wrapped, i.e. the additional slices in vec1 will repeatedly be added to the output vector. Also the second operand will be wrapped. To not loop over the first argument (i.e., vec) use hMulAdd.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
See also
hAddAddSum(vec, vec1, vec2)
Performs a add between the last two vectors, and add the result to the first vector which can be of different type. Wrap and repeatedly add to input array if shorter.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the first argument, i.e. the output vector. If the output vector is shorter than the first operand vector it will be wrapped, i.e. the additional slices in vec1 will repeatedly be added to the output vector. Also the second operand will be wrapped. To not loop over the first argument (i.e., vec) use hAddAdd.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
See also
hDivAddSum(vec, vec1, vec2)
Performs a div between the last two vectors, and add the result to the first vector which can be of different type. Wrap and repeatedly add to input array if shorter.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the first argument, i.e. the output vector. If the output vector is shorter than the first operand vector it will be wrapped, i.e. the additional slices in vec1 will repeatedly be added to the output vector. Also the second operand will be wrapped. To not loop over the first argument (i.e., vec) use hDivAdd.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
See also
hSubAddSum(vec, vec1, vec2)
Performs a sub between the last two vectors, and add the result to the first vector which can be of different type. Wrap and repeatedly add to input array if shorter.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Slice looping will be done over the first argument, i.e. the output vector. If the output vector is shorter than the first operand vector it will be wrapped, i.e. the additional slices in vec1 will repeatedly be added to the output vector. Also the second operand will be wrapped. To not loop over the first argument (i.e., vec) use hSubAdd.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
See also
hMul(vec1, vec2)
Performs a Mul between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hMul(vec1, scalar1)
Performs a Mul between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hMul(vec, vec1, vec2)
Performs a mul between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a mul between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hMul(vec,vec1,vec2) -> vec = vec1 mul vec2
vec.Mul(vec1,vec2) -> vec = vec1 mul vec2
hMul(vec, vec1, scalar1)
Performs a mul between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hMul(vec,vec1,scalar) -> vec = vec1 mul scalar
vec.Mul(vec1,scalar) -> vec = vec1 mul scalar
hAdd(vec1, vec2)
Performs a Add between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hAdd(vec1, scalar1)
Performs a Add between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hAdd(vec, vec1, vec2)
Performs a add between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a add between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hAdd(vec,vec1,vec2) -> vec = vec1 add vec2
vec.Add(vec1,vec2) -> vec = vec1 add vec2
hAdd(vec, vec1, scalar1)
Performs a add between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hAdd(vec,vec1,scalar) -> vec = vec1 add scalar
vec.Add(vec1,scalar) -> vec = vec1 add scalar
hDiv(vec1, vec2)
Performs a Div between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hDiv(vec1, scalar1)
Performs a Div between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hDiv(vec, vec1, vec2)
Performs a div between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a div between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hDiv(vec,vec1,vec2) -> vec = vec1 div vec2
vec.Div(vec1,vec2) -> vec = vec1 div vec2
hDiv(vec, vec1, scalar1)
Performs a div between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hDiv(vec,vec1,scalar) -> vec = vec1 div scalar
vec.Div(vec1,scalar) -> vec = vec1 div scalar
hSub(vec1, vec2)
Performs a Sub between the two vectors, which is returned in the first vector. If the second vector is shorter it will be applied multiple times.
Parameters
vec1 Numeric input and output vector vec2 Vector containing the second operands
Usage
vecA *= vecB -> vecA=[ vecA[0]*vecB[0], vecA[1]*vecB[1], ..., vecA[n]*vecB[n] ]
vecA += vecB -> vecA=[ vecA[0]+vecB[0], vecA[1]+vecB[1], ..., vecA[n]+vecB[n] ]
vecA -= vecB -> vecA=[ vecA[0]-vecB[0], vecA[1]-vecB[1], ..., vecA[n]-vecB[n] ]
vecA /= vecB -> vecA=[ vecA[0]/vecB[0], vecA[1]/vecB[1], ..., vecA[n]/vecB[n] ]
Example
>>> hMul(vecA,vecB) = vecA.mul(vecB)
hSub(vec1, scalar1)
Performs a Sub between the vector and a scalar (applied to each element), which is returned in the first vector.
Parameters
vec1 Numeric input and output vector scalar1 Value containing the second operand
hSub(vec, vec1, vec2)
Performs a sub between the last two vectors, which is returned in the first vector.
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand vec2 Vector containing the second operand
Description
Performs a sub between the last two vectors, which is returned in the first vector. If the second operand vector is shorter it will be applied multiple times.
Usage
hSub(vec,vec1,vec2) -> vec = vec1 sub vec2
vec.Sub(vec1,vec2) -> vec = vec1 sub vec2
hSub(vec, vec1, scalar1)
Performs a sub between the vector and a scalar, where the result is returned in the first vector (with automatic casting).
Parameters
vec Output vector containing the result of operation vec1 Vector containing the first operand scalar1 Scalar value containing the second operand
Usage
hSub(vec,vec1,scalar) -> vec = vec1 sub scalar
vec.Sub(vec1,scalar) -> vec = vec1 sub scalar
hMulSelf(vec, val)
Performs a mul operation (i.e., val +/-* vec) in place between a scalar and a vector, where the scalar is the first argument.
Parameters
vec Input and output vector val Scalar value
Description
It does not really make sense for add and mul, but is useful to get the inverse of a vector.
Usage
hMul(vec,val) -> vec = val mul vec
vec.Mul(val) -> vec = val mul vec
See also
Example
>>> vec=Vector([1.,2.,4.])
>>> vec.divself(1)
[1.0,0.5,0.25]
hAddSelf(vec, val)
Performs a add operation (i.e., val +/-* vec) in place between a scalar and a vector, where the scalar is the first argument.
Parameters
vec Input and output vector val Scalar value
Description
It does not really make sense for add and mul, but is useful to get the inverse of a vector.
Usage
hAdd(vec,val) -> vec = val add vec
vec.Add(val) -> vec = val add vec
See also
Example
>>> vec=Vector([1.,2.,4.])
>>> vec.divself(1)
[1.0,0.5,0.25]
hDivSelf(vec, val)
Performs a div operation (i.e., val +/-* vec) in place between a scalar and a vector, where the scalar is the first argument.
Parameters
vec Input and output vector val Scalar value
Description
It does not really make sense for add and mul, but is useful to get the inverse of a vector.
Usage
hDiv(vec,val) -> vec = val div vec
vec.Div(val) -> vec = val div vec
See also
Example
>>> vec=Vector([1.,2.,4.])
>>> vec.divself(1)
[1.0,0.5,0.25]
hSubSelf(vec, val)
Performs a sub operation (i.e., val +/-* vec) in place between a scalar and a vector, where the scalar is the first argument.
Parameters
vec Input and output vector val Scalar value
Description
It does not really make sense for add and mul, but is useful to get the inverse of a vector.
Usage
hSub(vec,val) -> vec = val sub vec
vec.Sub(val) -> vec = val sub vec
See also
Example
>>> vec=Vector([1.,2.,4.])
>>> vec.divself(1)
[1.0,0.5,0.25]
hPowerLawMul(vec, xvec, amplitude, exponent)
Creates a power law of the form amplitude*x_i^/alpha and multiplies or adds it (here Mul) to a vector, where the x_i’s are given in a second vector
Parameters
vec Numeric output vector containing the powerlaw xvec The x values to be potentiated. amplitude Amplitude of the powerlaw exponent Exponent of the powerlaw
Description
If the second vector is shorter, it will wrap around.
Usage
`` vec.powerlawmul(xvec,A,alpha) -> vec=[vec_0*A*xvec_0^alpha,vec_1*A*xvec_1^alpha,...,vec_n*A*xvec_n^alpha ]``
`` vec.powerlawadd(xvec,A,alpha) -> vec=[vec_0+A*xvec_0^alpha,vec_1+A*xvec_1^alpha,...,vec_n+A*xvec_n^alpha ]``
See also
hPowerlawMul(), hPowerlawAdd(), hLinearFunctionMul(), hLinearFunctionAdd(), hLogLinearFunctionMul(), hLogLinearFunctionAdd()
Example
ary=hArray(float,5,fill=1); x=hArray(range(5)); ary.powerlawmul(x,0.5,2)
#ary -> hArray(float, [5L], fill=[0,0.5,2,4.5,8]) # len=5 slice=[0:5]
hPowerLawAdd(vec, xvec, amplitude, exponent)
Creates a power law of the form amplitude*x_i^/alpha and multiplies or adds it (here Add) to a vector, where the x_i’s are given in a second vector
Parameters
vec Numeric output vector containing the powerlaw xvec The x values to be potentiated. amplitude Amplitude of the powerlaw exponent Exponent of the powerlaw
Description
If the second vector is shorter, it will wrap around.
Usage
`` vec.powerlawmul(xvec,A,alpha) -> vec=[vec_0*A*xvec_0^alpha,vec_1*A*xvec_1^alpha,...,vec_n*A*xvec_n^alpha ]``
`` vec.powerlawadd(xvec,A,alpha) -> vec=[vec_0+A*xvec_0^alpha,vec_1+A*xvec_1^alpha,...,vec_n+A*xvec_n^alpha ]``
See also
hPowerlawMul(), hPowerlawAdd(), hLinearFunctionMul(), hLinearFunctionAdd(), hLogLinearFunctionMul(), hLogLinearFunctionAdd()
Example
ary=hArray(float,5,fill=1); x=hArray(range(5)); ary.powerlawmul(x,0.5,2)
#ary -> hArray(float, [5L], fill=[0,0.5,2,4.5,8]) # len=5 slice=[0:5]
hLinearFunctionMul(vec, xvec, a, m)
Creates a linear function of the form a*x_i+b and multiplies or adds it (here Mul) to a vector, where the x_i’s are given in a second vector
Parameters
vec Numeric output vector containing the powerlaw xvec The x values to be potentiated. a Offset along y-axis of function m Slope of linear function
Description
If the second vector is shorter, it will wrap around.
Usage
`` vec.linearfunctionmul(xvec,a,m) -> vec=[vec_0*(a+xvec_0*m),vec_1*(a+xvec_1*m),...,vec_n*(a+xvec_n*m)]``
`` vec.linearfunctionadd(xvec,a,m) -> vec=[vec_0+a+xvec_0*m,vec_1+a+xvec_1*m,...,vec_n+a+xvec_n*m]``
See also
hPowerlawMul(), hPowerlawAdd(), hLinearFunctionMul(), hLinearFunctionAdd(), hLogLinearFunctionMul(), hLogLinearFunctionAdd()
Example
ary=hArray(float,5,fill=1); x=hArray(range(5)); ary.powerlawmul(x,0.5,2)
#ary -> hArray(float, [5L], fill=[0,0.5,2,4.5,8]) # len=5 slice=[0:5]
hLinearFunctionAdd(vec, xvec, a, m)
Creates a linear function of the form a*x_i+b and multiplies or adds it (here Add) to a vector, where the x_i’s are given in a second vector
Parameters
vec Numeric output vector containing the powerlaw xvec The x values to be potentiated. a Offset along y-axis of function m Slope of linear function
Description
If the second vector is shorter, it will wrap around.
Usage
`` vec.linearfunctionmul(xvec,a,m) -> vec=[vec_0*(a+xvec_0*m),vec_1*(a+xvec_1*m),...,vec_n*(a+xvec_n*m)]``
`` vec.linearfunctionadd(xvec,a,m) -> vec=[vec_0+a+xvec_0*m,vec_1+a+xvec_1*m,...,vec_n+a+xvec_n*m]``
See also
hPowerlawMul(), hPowerlawAdd(), hLinearFunctionMul(), hLinearFunctionAdd(), hLogLinearFunctionMul(), hLogLinearFunctionAdd()
Example
ary=hArray(float,5,fill=1); x=hArray(range(5)); ary.powerlawmul(x,0.5,2)
#ary -> hArray(float, [5L], fill=[0,0.5,2,4.5,8]) # len=5 slice=[0:5]
hLogLinearFunctionMul(vec, xvec, a, m)
Creates a log linear function of the form a*log(x_i)+b and multiplies or adds it (here Mul) to a vector, where the x_i’s are given in a second vector
Parameters
vec Numeric output vector containing the powerlaw xvec The x values to be potentiated. a Offset along y-axis of function m Slope of linear function
Description
This is quite useful for plotting a log linear graph of a powerlaw: log10(a* u^lpha) = (ln(a)+lpha*ln( u))/ln(10.)
If the second vector is shorter, it will wrap around.
Usage
`` vec.linearfunctionmul(xvec,a,m) -> vec=[vec_0*(a+xvec_0*m),vec_1*(a+xvec_1*m),...,vec_n*(a+xvec_n*m)]``
`` vec.linearfunctionadd(xvec,a,m) -> vec=[vec_0+a+xvec_0*m,vec_1+a+xvec_1*m,...,vec_n+a+xvec_n*m]``
See also
hPowerlawMul(), hPowerlawAdd(), hLinearFunctionMul(), hLinearFunctionAdd(), hLogLinearFunctionMul(), hLogLinearFunctionAdd()
Example
ary=hArray(float,5,fill=1); x=hArray(range(5)); ary.powerlawmul(x,0.5,2)
#ary -> hArray(float, [5L], fill=[0,0.5,2,4.5,8]) # len=5 slice=[0:5]
hLogLinearFunctionAdd(vec, xvec, a, m)
Creates a log linear function of the form a*log(x_i)+b and multiplies or adds it (here Add) to a vector, where the x_i’s are given in a second vector
Parameters
vec Numeric output vector containing the powerlaw xvec The x values to be potentiated. a Offset along y-axis of function m Slope of linear function
Description
This is quite useful for plotting a log linear graph of a powerlaw: log10(a* u^lpha) = (ln(a)+lpha*ln( u))/ln(10.)
If the second vector is shorter, it will wrap around.
Usage
`` vec.linearfunctionmul(xvec,a,m) -> vec=[vec_0*(a+xvec_0*m),vec_1*(a+xvec_1*m),...,vec_n*(a+xvec_n*m)]``
`` vec.linearfunctionadd(xvec,a,m) -> vec=[vec_0+a+xvec_0*m,vec_1+a+xvec_1*m,...,vec_n+a+xvec_n*m]``
See also
hPowerlawMul(), hPowerlawAdd(), hLinearFunctionMul(), hLinearFunctionAdd(), hLogLinearFunctionMul(), hLogLinearFunctionAdd()
Example
ary=hArray(float,5,fill=1); x=hArray(range(5)); ary.powerlawmul(x,0.5,2)
#ary -> hArray(float, [5L], fill=[0,0.5,2,4.5,8]) # len=5 slice=[0:5]
hInverse(vec)
Take the inverse of the values in a vector, i.e. 1/vec
Parameters
vec Input and output vector
Usage
hInverse(vec) -> 1/vec
vec.inverse(val) -> 1/vec
See also
hMulSelf(), hDivSelf(), hSubSelf(), hAddSelf()
Example
>>> vec=Vector([1.,2.,4.])
>>> vec.inverse()
[1.0,0.5,0.25]
hFmod(vec, param)
Perform a fmod with a scalar parameter on the elements of a numeric vector and return the result in the same numeric vector.
Parameters
vec Numeric input and output vector param Scalar parameter of function Fmod
hFmod(vec, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the first numeric vector and return the result in the same vector.
Parameters
vec Numeric input and output vector vecpar Parameter vector
Usage
hFmod(vec, vecpar) -> vec = fmod(vec, vecpar)
vec.Fmod(vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vecout, vecin, param)
Perform a fmod with scalar parameter on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric input vector param Scalar parameter of function Fmod
Usage
hFmod(vec, vecin, param) -> vec = fmod(vecin, param)
vec.Fmod(vecin, param) -> vec = fmod(vecin, param)
hFmod(vecout, vecin, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric inpuit vector vecpar Parameter vector
Usage
hFmod(vec, vecin, vecpar) -> vec = fmod(vecin, vecpar)
vec.Fmod(vecin, vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vec, param)
Perform a fmod with a scalar parameter on the elements of a numeric vector and return the result in the same numeric vector.
Parameters
vec Numeric input and output vector param Scalar parameter of function Fmod
hFmod(vec, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the first numeric vector and return the result in the same vector.
Parameters
vec Numeric input and output vector vecpar Parameter vector
Usage
hFmod(vec, vecpar) -> vec = fmod(vec, vecpar)
vec.Fmod(vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vecout, vecin, param)
Perform a fmod with scalar parameter on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric input vector param Scalar parameter of function Fmod
Usage
hFmod(vec, vecin, param) -> vec = fmod(vecin, param)
vec.Fmod(vecin, param) -> vec = fmod(vecin, param)
hFmod(vecout, vecin, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric inpuit vector vecpar Parameter vector
Usage
hFmod(vec, vecin, vecpar) -> vec = fmod(vecin, vecpar)
vec.Fmod(vecin, vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vec, param)
Perform a fmod with a scalar parameter on the elements of a numeric vector and return the result in the same numeric vector.
Parameters
vec Numeric input and output vector param Scalar parameter of function Fmod
hFmod(vec, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the first numeric vector and return the result in the same vector.
Parameters
vec Numeric input and output vector vecpar Parameter vector
Usage
hFmod(vec, vecpar) -> vec = fmod(vec, vecpar)
vec.Fmod(vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vecout, vecin, param)
Perform a fmod with scalar parameter on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric input vector param Scalar parameter of function Fmod
Usage
hFmod(vec, vecin, param) -> vec = fmod(vecin, param)
vec.Fmod(vecin, param) -> vec = fmod(vecin, param)
hFmod(vecout, vecin, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric inpuit vector vecpar Parameter vector
Usage
hFmod(vec, vecin, vecpar) -> vec = fmod(vecin, vecpar)
vec.Fmod(vecin, vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vec, param)
Perform a fmod with a scalar parameter on the elements of a numeric vector and return the result in the same numeric vector.
Parameters
vec Numeric input and output vector param Scalar parameter of function Fmod
hFmod(vec, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the first numeric vector and return the result in the same vector.
Parameters
vec Numeric input and output vector vecpar Parameter vector
Usage
hFmod(vec, vecpar) -> vec = fmod(vec, vecpar)
vec.Fmod(vecpar) -> vec = fmod(vecin, vecpar)
hFmod(vecout, vecin, param)
Perform a fmod with scalar parameter on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric input vector param Scalar parameter of function Fmod
Usage
hFmod(vec, vecin, param) -> vec = fmod(vecin, param)
vec.Fmod(vecin, param) -> vec = fmod(vecin, param)
hFmod(vecout, vecin, vecpar)
Perform a fmod with a scalar parameter from a vector on the elements of the second numeric vector and return the result in the first numeric vector.
Parameters
vecout Numeric output vector vecin Numeric inpuit vector vecpar Parameter vector
Usage
hFmod(vec, vecin, vecpar) -> vec = fmod(vecin, vecpar)
vec.Fmod(vecin, vecpar) -> vec = fmod(vecin, vecpar)
hPhase(frequency, time)
Returns the interferometer phase in radians for a given frequency and time.
Parameters
frequency Frequency in Hz time Time in seconds
hPhaseToComplex(phase)
Coverts a real phase to a complex number (with amplitude of unity)
Parameters
phase Phase of complex number
hPhaseToComplex(vec, phasevec)
Converts a vector of real phase to a vector of corresponding complex numbers (with amplitude of unity).
Parameters
vec Output vector returning complex numbers phasevec Input vector with real phases
Description
If input vector is shorter it will be repeated until the output vector is filled.
Usage
hPhaseToComplex(outvec,phase) -> outvec = [exp(i*phase_1),exp(i*phase_2),...,exp(i*phase_n)]
outvec.phasetocomplex(phase) -> outvec = [exp(i*phase_1),exp(i*phase_2),...,exp(i*phase_n)]
hPhaseToComplex(phase)
Coverts a real phase to a complex number (with amplitude of unity)
Parameters
phase Phase of complex number
hPhaseToComplex(vec, phasevec)
Converts a vector of real phase to a vector of corresponding complex numbers (with amplitude of unity).
Parameters
vec Output vector returning complex numbers phasevec Input vector with real phases
Description
If input vector is shorter it will be repeated until the output vector is filled.
Usage
hPhaseToComplex(outvec,phase) -> outvec = [exp(i*phase_1),exp(i*phase_2),...,exp(i*phase_n)]
outvec.phasetocomplex(phase) -> outvec = [exp(i*phase_1),exp(i*phase_2),...,exp(i*phase_n)]
hComplexToPhase(z)
Extract the phase of a complex number (i.e. get phi from z = r exp(i phi) )
Parameters
z Complex number to extract phase from
hComplexToPhase(phasevec, vec)
Converts a vector of real phase to a vector of corresponding complex numbers (with amplitude of unity).
Parameters
phasevec Output vector returning (real) phases vec Input vector with complex numbers
Description
If input vector is shorter it will be repeated until the output vector is filled.
Usage
hComplexToPhase(outvec, complex_in) -> outvec = [arg(z_0), arg(z_1),..., arg(z_{n-1}]
outvec.complextophase(complex_in) -> outvec = [arg(z_0), arg(z_1),..., arg(z_{n-1})]
hComplexToPhase(z)
Extract the phase of a complex number (i.e. get phi from z = r exp(i phi) )
Parameters
z Complex number to extract phase from
hComplexToPhase(phasevec, vec)
Converts a vector of real phase to a vector of corresponding complex numbers (with amplitude of unity).
Parameters
phasevec Output vector returning (real) phases vec Input vector with complex numbers
Description
If input vector is shorter it will be repeated until the output vector is filled.
Usage
hComplexToPhase(outvec, complex_in) -> outvec = [arg(z_0), arg(z_1),..., arg(z_{n-1}]
outvec.complextophase(complex_in) -> outvec = [arg(z_0), arg(z_1),..., arg(z_{n-1})]
hPhaseWrap(phase)
Extract the phase of a complex number (i.e. get phi from z = r exp(i phi) )
Parameters
phase Phase to wrap into (-pi, pi]
hPhaseWrap(wrappedvec, vec)
Converts a vector of real phase to a vector of corresponding complex numbers (with amplitude of unity).
Parameters
wrappedvec Output vector returning wrapped phases vec Input vector with phases
Description
If input vector is shorter it will be repeated until the output vector is filled.
Usage
hPhaseWrap(outvec, phase_in) -> outvec = [wrap(phi_0), wrap(phi_1),..., wrap(phi_{n-1}]
outvec.phasewrap(phase_in) -> outvec = [wrap(phi_0), wrap(phi_1),..., wrap(phi_{n-1})]
hPhaseWrap(phase)
Extract the phase of a complex number (i.e. get phi from z = r exp(i phi) )
Parameters
phase Phase to wrap into (-pi, pi]
hPhaseWrap(wrappedvec, vec)
Converts a vector of real phase to a vector of corresponding complex numbers (with amplitude of unity).
Parameters
wrappedvec Output vector returning wrapped phases vec Input vector with phases
Description
If input vector is shorter it will be repeated until the output vector is filled.
Usage
hPhaseWrap(outvec, phase_in) -> outvec = [wrap(phi_0), wrap(phi_1),..., wrap(phi_{n-1}]
outvec.phasewrap(phase_in) -> outvec = [wrap(phi_0), wrap(phi_1),..., wrap(phi_{n-1})]
hAmplitudePhaseToComplex(amplitude, phase)
Coverts a real phase and amplitude to a complex number.
Parameters
amplitude Amplitude of complex number phase Phase of complex number
hAmplitudePhaseToComplex(vec, ampphase)
Coverts a vector of real phases and amplitudes to a vector of corresponding complex numbers.
Parameters
vec Output vector returning complex numbers ampphase Input vector with real amplitudes and phases (2 numbers per entry: [amp_0, phase_0, amp_1, phase_1, ...])
Description
If input vector is shorter it will be repeated until output vector is filled.
Usage
hAmplitudePhaseToComplex(vec,ampphase) -> vec = [ampphase_0,0*exp(i*ampphase_0,1),ampphase_1,0*exp(i*ampphase_1,1),...,ampphase_n,0*exp(i*ampphase_n,1)]
vec.amplitudephasetocomplex(ampphase) -> vec = [ampphase_0,0*exp(i*ampphase_0,1),ampphase_1,0*exp(i*ampphase_1,1),...,ampphase_n,0*exp(i*ampphase_n,1)]
hAmplitudePhaseToComplex(amplitude, phase)
Coverts a real phase and amplitude to a complex number.
Parameters
amplitude Amplitude of complex number phase Phase of complex number
hAmplitudePhaseToComplex(vec, ampphase)
Coverts a vector of real phases and amplitudes to a vector of corresponding complex numbers.
Parameters
vec Output vector returning complex numbers ampphase Input vector with real amplitudes and phases (2 numbers per entry: [amp_0, phase_0, amp_1, phase_1, ...])
Description
If input vector is shorter it will be repeated until output vector is filled.
Usage
hAmplitudePhaseToComplex(vec,ampphase) -> vec = [ampphase_0,0*exp(i*ampphase_0,1),ampphase_1,0*exp(i*ampphase_1,1),...,ampphase_n,0*exp(i*ampphase_n,1)]
vec.amplitudephasetocomplex(ampphase) -> vec = [ampphase_0,0*exp(i*ampphase_0,1),ampphase_1,0*exp(i*ampphase_1,1),...,ampphase_n,0*exp(i*ampphase_n,1)]
hConj(vec)
Calculate the complex conjugate of all elements in the complex vector.
Parameters
vec Numeric input and output vector
hCrossCorrelateComplex(vec1, vec2, fftw)
Multiplies the elements of the first vector with the complex conjugate of the elements in the second and returns the results in the first.
Parameters
vec1 Complex input and output vector vec2 Second complex vector fftw Was the FFT calculated with FFTw definition? Then muliply one fft vector by -1,1,-1,...
Description
If the complex input vectors are the Fourier transformed data of two (real) vector f1 and f2, then vec1*conj(vec2) will be the Fourier transform of the crosscorrelation between f1 and f2. Hence, in order to calculate a cross correlation between f1 and f2, first do vec1.fftw(f1) and vec2.fftw(f2), then vec1.crosscorrelatecomplex(vec2,True) and FFT back through floatvec.invfft(vec1).
For zero lag (e.g. autocorrelation), the cross-correlation will peak in the middle of the float vector.
If the real input vector has length N then the complex FFT vectors have dimension N/2+1.
There is a difference in defintion between ffts (here fftw and fftcasa). If the fftw definition is used, then one of the FFT data vectors still needs to be multiplied by -1,1,-1,... to get the peak of the crosscorrelation for lag = 0 in the middle of floatvec. This makes sense since the lag can be positive or negative.
Note:
If the second vector is shorter than the first one, the second vector will simply wrap around and begin from the start until the end of the first vector is reached. If the first vector is shorter, then the calculation will simply stop.
Usage
fftvec1.crosscorrelatecomplex(fftvec2,True) -> fftvec1 return FFT(w) of cross correlation between
See also
hFFTw(), hInvFFTw(), hSaveInvFFTw(), :class:`tasks(), pulsecal(), CrossCorrelateAntennas`()
Example
::
file=open('/Users/falcke/LOFAR/usg/data/lofar/oneshot_level4_CS017_19okt_no-9.h5')
file['BLOCKSIZE']=131072
file['SELECTED_DIPOLES']=[f for f in file['DIPOLE_NAMES'] if int(f)%2==1] # select uneven antenna IDs
timeseries_data=file['TIMESERIES_DATA']
timeseries_data_cut=hArray(float,[48,64]) # just look at the region with a pulse
timeseries_data_cut[...].copy(timeseries_data[...,65806:65870])
fftdata=hArray(complex,[48,64/2+1])
fftdata[...].fftw(timeseries_data_cut[...])
fftdata[1:,...].crosscorrelatecomplex(fftdata[0],True) # to make sure the reference data is not overwritten start at index 1
fftdata[0:1,...].crosscorrelatecomplex(fftdata[0],True) # only now do the autocorrelation
crosscorrelation=hArray(properties=timeseries_data_cut)
crosscorrelation[...].invfftw(fftdata[...])
crosscorrelation /= 64
crosscorrelation.abs()
crosscorrelation[...].runningaverage(15,hWEIGHTS.GAUSSIAN)
crosscorrelation[0:4,...].plot()
hArg(vecout, vecin)
Take the arg of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.arg(vec1) -> vec2 = [arg(vec1_0), arg(vec1_1), ... , arg(vec1_n)]
See also
hVectorLength()
hArg(vecout)
Take the arg of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.arg(vec1) -> vec2 = [arg(vec1_0), arg(vec1_1), ... , arg(vec1_n)]
hImag(vecout, vecin)
Take the imag of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.imag(vec1) -> vec2 = [imag(vec1_0), imag(vec1_1), ... , imag(vec1_n)]
See also
hVectorLength()
hImag(vecout)
Take the imag of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.imag(vec1) -> vec2 = [imag(vec1_0), imag(vec1_1), ... , imag(vec1_n)]
hNorm(vecout, vecin)
Take the norm of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.norm(vec1) -> vec2 = [norm(vec1_0), norm(vec1_1), ... , norm(vec1_n)]
See also
hVectorLength()
hNorm(vecout)
Take the norm of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.norm(vec1) -> vec2 = [norm(vec1_0), norm(vec1_1), ... , norm(vec1_n)]
hReal(vecout, vecin)
Take the real of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.real(vec1) -> vec2 = [real(vec1_0), real(vec1_1), ... , real(vec1_n)]
See also
hVectorLength()
hReal(vecout)
Take the real of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.real(vec1) -> vec2 = [real(vec1_0), real(vec1_1), ... , real(vec1_n)]
hArg(vecout, vecin)
Take the arg of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.arg(vec1) -> vec2 = [arg(vec1_0), arg(vec1_1), ... , arg(vec1_n)]
See also
hVectorLength()
hArg(vecout)
Take the arg of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.arg(vec1) -> vec2 = [arg(vec1_0), arg(vec1_1), ... , arg(vec1_n)]
hImag(vecout, vecin)
Take the imag of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.imag(vec1) -> vec2 = [imag(vec1_0), imag(vec1_1), ... , imag(vec1_n)]
See also
hVectorLength()
hImag(vecout)
Take the imag of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.imag(vec1) -> vec2 = [imag(vec1_0), imag(vec1_1), ... , imag(vec1_n)]
hNorm(vecout, vecin)
Take the norm of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.norm(vec1) -> vec2 = [norm(vec1_0), norm(vec1_1), ... , norm(vec1_n)]
See also
hVectorLength()
hNorm(vecout)
Take the norm of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.norm(vec1) -> vec2 = [norm(vec1_0), norm(vec1_1), ... , norm(vec1_n)]
hReal(vecout, vecin)
Take the real of all the elements in the complex vector and return results in a second vector.
Parameters
vecout Numeric output vector vecin Complex input vector
Description
If the input vector is shorter than the output vector it will wrap around and start from the beginning until the output vector is fully processed.
Input and output vector can be identical.
The following functions are available for getting real values from complex numbers:
norm magnitude (length) squared of a complex number, i.e. c * conj(c) abs amplitude of a complex number, i.e. c * conj(c) arg phase angle of a complex number (in radians) imag imaginary part of a complex number real real part of a complex number
Usage
vec2.real(vec1) -> vec2 = [real(vec1_0), real(vec1_1), ... , real(vec1_n)]
See also
hVectorLength()
hReal(vecout)
Take the real of all the elements in the complex vector and return results in the same vector.
Parameters
vecout Complex in and output vector
Usage
vec2.real(vec1) -> vec2 = [real(vec1_0), real(vec1_1), ... , real(vec1_n)]
hRandomizePeaks(vec, lower_limit, upper_limit)
Set all values which are above or below a certain limit to random value between those limits
Parameters
vec Input vector. lower_limit Lower limit. upper_limit Upper limit.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hRandomizePhase(), hSetAmplitude()
Example
>>> c=hArray(float,[10],fill=range(10))
hArray(float, [10], fill=[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]) # len=10 slice=[0:10])
>>> c.randomizepeaks(3,7)
hArray(float, [10], fill=[3.87583674531, 3.18817846486, 5.71545886747, 3.0, 4.0, 5.0, 6.0, 7.0, 5.71718562335, 6.73877158376]) # len=10 slice=[0:10])
hRandomizePhase(vec, indexlist, amplitude)
Randomize the phases of certain elements in a complec vector and set the amplitude.
Parameters
vec Vector in which to randomize the phase. indexlist Index list containing the positions of the elements to be set, (e.g. [0,2,4,...] will set every second element). amplitude Amplitude to assign to the indexed elements.
Description
The elements are specified in an indexlist.
(NOT QUITE CORRECT: SPECIFY PROPER WEIGHTING TO RAND GENERATOR)
Usage
vec.randomizephase(indexlist,amplitude) -> elements in vec at positions provided in indexlist are set to a complex number with random phase and amplitude 'amplitude'
See also
Example
>>> c=hArray(complex,[10],fill=range(10))
hArray(complex, [10], fill=[0j, (1+0j), (2+0j), (3+0j), (4+0j), (5+0j), (6+0j), (7+0j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
>>> c.randomizephase(hArray([1,3,5,7]),1.)
hArray(complex, [10], fill=[0j, (0.661930692225-0.749565046337j), (2+0j), (-0.930855778945-0.365386807102j), (4+0j), (-0.893076729911+0.449904383721j), (6+0j), (0.0594003866703+0.998234238074j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
>>> c.abs()
hArray(complex, [10], fill=[0j, (1+0j), (2+0j), (1+0j), (4+0j), (1+0j), (6+0j), (1+0j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
hRandomizePhase(vec, indexlist, amplitude_vec)
Randomize the phases of certain elements in a complec vector and set the amplitude from a vector.
Parameters
vec Vector in which to randomize the phase. indexlist Index list containing the positions of the elements to be set, (e.g. [0,2,4,...] will set every second element). amplitude_vec Amplitude to assign to the indexed elements.
Description
The elements are specified in an indexlist.
(NOT QUITE CORRECT: SPECIFY PROPPER WEIGHTING TO RAND GENERATOR)
Usage
vec.randomizephase(indexlist,amplitude) -> elements in vec at positions provided in indexlist are set to a complex number with random phase and an amplitude picked from the amplitude vector at the same location.
See also
Example
>>> baseline=hArray(float,[10],fill=range(90,100))
>>> c=hArray(complex,[10],fill=range(10))
hArray(complex, [10], fill=[0j, (1+0j), (2+0j), (3+0j), (4+0j), (5+0j), (6+0j), (7+0j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
>>> c.randomizephase(hArray([1,3]),baseline)
hArray(complex, [10], fill=[(0,0),(-21.2026,-88.4955),(2,0),(3.61145,92.9299),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0)]) # len=10 slice=[0:10])
>>> c.abs()
hArray(complex, [10], fill=[(0,0),(91,0),(2,0),(93,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0)]) # len=10 slice=[0:10])
hRandomizePhase(vec, indexlist, amplitude)
Randomize the phases of certain elements in a complec vector and set the amplitude.
Parameters
vec Vector in which to randomize the phase. indexlist Index list containing the positions of the elements to be set, (e.g. [0,2,4,...] will set every second element). amplitude Amplitude to assign to the indexed elements.
Description
The elements are specified in an indexlist.
(NOT QUITE CORRECT: SPECIFY PROPER WEIGHTING TO RAND GENERATOR)
Usage
vec.randomizephase(indexlist,amplitude) -> elements in vec at positions provided in indexlist are set to a complex number with random phase and amplitude 'amplitude'
See also
Example
>>> c=hArray(complex,[10],fill=range(10))
hArray(complex, [10], fill=[0j, (1+0j), (2+0j), (3+0j), (4+0j), (5+0j), (6+0j), (7+0j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
>>> c.randomizephase(hArray([1,3,5,7]),1.)
hArray(complex, [10], fill=[0j, (0.661930692225-0.749565046337j), (2+0j), (-0.930855778945-0.365386807102j), (4+0j), (-0.893076729911+0.449904383721j), (6+0j), (0.0594003866703+0.998234238074j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
>>> c.abs()
hArray(complex, [10], fill=[0j, (1+0j), (2+0j), (1+0j), (4+0j), (1+0j), (6+0j), (1+0j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
hRandomizePhase(vec, indexlist, amplitude_vec)
Randomize the phases of certain elements in a complec vector and set the amplitude from a vector.
Parameters
vec Vector in which to randomize the phase. indexlist Index list containing the positions of the elements to be set, (e.g. [0,2,4,...] will set every second element). amplitude_vec Amplitude to assign to the indexed elements.
Description
The elements are specified in an indexlist.
(NOT QUITE CORRECT: SPECIFY PROPPER WEIGHTING TO RAND GENERATOR)
Usage
vec.randomizephase(indexlist,amplitude) -> elements in vec at positions provided in indexlist are set to a complex number with random phase and an amplitude picked from the amplitude vector at the same location.
See also
Example
>>> baseline=hArray(float,[10],fill=range(90,100))
>>> c=hArray(complex,[10],fill=range(10))
hArray(complex, [10], fill=[0j, (1+0j), (2+0j), (3+0j), (4+0j), (5+0j), (6+0j), (7+0j), (8+0j), (9+0j)]) # len=10 slice=[0:10])
>>> c.randomizephase(hArray([1,3]),baseline)
hArray(complex, [10], fill=[(0,0),(-21.2026,-88.4955),(2,0),(3.61145,92.9299),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0)]) # len=10 slice=[0:10])
>>> c.abs()
hArray(complex, [10], fill=[(0,0),(91,0),(2,0),(93,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0)]) # len=10 slice=[0:10])
hSetAmplitude(vecout, vecin)
Set the amplitude of complex numbers to the values provided in a second vector
Parameters
vecout Complex output vector vecin Numeric input vector with amplitudes.
Description
The function calculates c.setamplitude(newamplitude) for each element c -> c/|c|*newamplitude.
If the input vector is shorter than output vector it will wrap around and start from the beginning until the output vector is fully processed.
hSetAmplitude(vecout, amp)
Set the amplitude of complex numbers to a particular value
Parameters
vecout Complex output vector amp Amplitude
Description
The function calculates c.setamplitude(amp) for each element c -> c/|c|*amp.
hSetAmplitude(vecout, vecin)
Set the amplitude of complex numbers to the values provided in a second vector
Parameters
vecout Complex output vector vecin Numeric input vector with amplitudes.
Description
The function calculates c.setamplitude(newamplitude) for each element c -> c/|c|*newamplitude.
If the input vector is shorter than output vector it will wrap around and start from the beginning until the output vector is fully processed.
hSetAmplitude(vecout, amp)
Set the amplitude of complex numbers to a particular value
Parameters
vecout Complex output vector amp Amplitude
Description
The function calculates c.setamplitude(amp) for each element c -> c/|c|*amp.
hNegate(vec)
Multiplies each element in the vector with -1 in place, i.e. the input vector is also the output vector.
Parameters
vec Numeric input vector
hProduct(vec)
Multiplies all elements in the vector with each other and return the result.
Parameters
vec Numeric input vector
Usage
hProduct(vec) -> vec[0]*vec[1]*vec[2]* ... * vec[N]
hSum(vec)
Performs a sum over the values in a vector and returns the value.
Parameters
vec Numeric input vector
hSumAbs(vec)
Performs a sum over the absolute values in a vector and returns the value.
Parameters
vec Numeric input vector
hSumSquare(vec)
Performs a sum over the square values in a vector and returns the value.
Parameters
vec Numeric input vector
hMulSum(vec1, vec2)
Piecewise multiplication of the elements in a vector and summing of the results.
Parameters
vec1 Numeric input vector vec2 Numeric input vector
Usage
hMulSum(Vector([a,b,c,...]),Vector([x,y,z,...]) -> a*x + b*y + c*z + ....
hDiffSum(vec1, vec2)
Piecewise subtraction of the elements beteen two vector and summing of the results.
Parameters
vec1 Numeric input vector vec2 Numeric input vector
Usage
hDiffSum(Vector([a,b,c,...]),Vector([x,y,z,...]) -> a-x + b-y + c-z + ....
hDifferentiate(vec1, vec2)
Calculate the first-difference of a vector (difference of subsequent elements) and store in a second vector
Parameters
vec1 Numeric input vector of length N vec2 Numeric output vector of length N-1
Usage
hDifferentiate(Vector([a,b,c,...]), outputVector) -> [b-a,c-b,...]
Will stop if the end of either input or output vector is reached.
See Also:
`` hDiffSum, hDiff``
hDiffSquaredSum(vec1, vec2)
Piecewise subtraction of the elements in a vector and summing of the square of the results.
Parameters
vec1 Numeric input vector vec2 Numeric input vector
Usage
hDiffSquaredSum(Vector([a,b,c,...]),Vector([x,y,z,...]) -> (a-x)**2 + (b-y)**2 + (c-z)**2 + ....
hMeanDiffSquaredSum(vec1, vec2)
Mean of the piecewise subtraction of the elements in a vector and summing of the square of the results.
Parameters
vec1 Numeric input vector 1 vec2 Numeric input vector 2
Usage
hMeanDiffSquaredSum(Vector([a,b,c,...]),Vector([x,y,z,...]) -> ((a-x)**2 + (b-y)**2 + (c-z)**2 + ....)/N
hChiSquared(v1, v2)
Calculate the of two vectors.
Parameters
v1 Numeric input vector 1 v2 Numeric input vector 2
Description
Calculate the of two vectors, i.e.,
.
Usage
hChiSquared(Vector([a,b,c,...]),Vector([x,y,z,...]) -> (a-x)**2/x + (b-y)**2/y + (c-z)**2/z + ....
hMeanChiSquared(v1, v2)
Calculate the mean of two vectors.
Parameters
v1 Numeric input vector (observed values) v2 Numeric input vector (expected values) - must not be zero
Description
Calculate the mean of two vectors., i.e.
where is the length of the vector.
Usage
hChiSquared(Vector([a,b,c,...]),Vector([x,y,z,...]) -> ((a-x)**2/x + (b-y)**2/y + (c-z)**2/z + ....)/N
hDotProduct(vecin1, vecin2)
Dot product of two vectors
Parameters
vecin1 Numeric input vector 1 vecin2 Numeric input vector 2
Usage
hDotProduct(Vector([a,b,c]), Vector([x,y,z])) -> a*x + b*y + c*z
hCrossProduct(vecout, vecin1, vecin2)
Cross product of two 3-dimensional vectors
Parameters
vecout Numeric output vector vecin1 Numeric input vector 1 vecin2 Numeric input vector 2
Usage
hCrossProduct(Vector([a,b,c]), Vector([r,s,t]), Vector([x,y,z]))
-> [s*z - t*y, t*x - r*z, r*y - s*z]
hRandom(vec, minimum, maximum)
Fills a vector with random values between minimum and maximum limits.
Parameters
vec Output vector which will be filled with random numbers. minimum Random numbers will not go below that value. maximum Random numbers will not exceed that value.
Example
>>> hRandom(vector,-1,1)
[-0.5,0.3,0.1, ...]
>>> vector.random(-1,1)
[-0.5,0.3,0.1, ...]
hRandomComplex(vec, minimum, maximum)
Fills a vector with random values between minimum and maximum limits.
Parameters
vec Output vector which will be filled with random numbers. minimum Random numbers will not go below that value. maximum Random numbers will not exceed that value.
Example
>>> hRandom(vector,-1,1)
[-0.5,0.3,0.1, ...]
>>> vector.random(-1,1)
[-0.5,0.3,0.1, ...]
hMean(vec)
Returns the mean value of all elements in a vector.
Parameters
vec Numeric input vector
See also
hMeanAbove(), hMeanSquare(), hMeanAbs(), hMeanChiSquared()
hMean(outvec, invec)
Calculates a mean vector of an array of vectors
Parameters
outvec Numeric output vector of length Nel containing the mean values invec Numeric input vector of size Nvec*Nel
Description
Assume you have a 2D array of dimensions [Nvec,Nel], i.e. Nvec vectors of length Nel, then return the mean vector of all vectors in the input array. Input and output vectors can be of different types (with all consequences of rounding, of course!).
See also
hMeanAbove(), hMeanSquare(), hMeanAbs(), hMeanChiSquared()
Example
v1=hArray(float,[3],fill=0)
v2=hArray(float,[3,3],fill=range(9))
v1.mean(v2) # v1 -> hArray(float, [3L], fill=[3,4,5]) # len=3 slice=[0:3])
hMean(vec)
Returns the mean value of all elements in a vector.
Parameters
vec Numeric input vector
See also
hMeanAbove(), hMeanSquare(), hMeanAbs(), hMeanChiSquared()
hMean(outvec, invec)
Calculates a mean vector of an array of vectors
Parameters
outvec Numeric output vector of length Nel containing the mean values invec Numeric input vector of size Nvec*Nel
Description
Assume you have a 2D array of dimensions [Nvec,Nel], i.e. Nvec vectors of length Nel, then return the mean vector of all vectors in the input array. Input and output vectors can be of different types (with all consequences of rounding, of course!).
See also
hMeanAbove(), hMeanSquare(), hMeanAbs(), hMeanChiSquared()
Example
v1=hArray(float,[3],fill=0)
v2=hArray(float,[3,3],fill=range(9))
v1.mean(v2) # v1 -> hArray(float, [3L], fill=[3,4,5]) # len=3 slice=[0:3])
hMeanAbove(vec, threshold)
Returns the mean value of all elements in a vector which are above a certain threshold.
Parameters
vec Numeric input vector threshold Threshold value
See also
hMeanAbs(vec)
Returns the mean value of the absolue values of all elements in a vector.
Parameters
vec Numeric input vector
See also
hMeanSquare(vec)
Returns the mean value of the square values of all elements in a vector.
Parameters
vec Numeric input vector
See also
hSort(vec)
Sorts a vector in place.
Parameters
vec Numeric input vector
Description
Warning
The vector will be sorted in place. Hence, if you want to keep the data in its original order, you need to copy the data first to a scratch vector and then call this function with the scratch vector!
hSortMedian(vec)
Sorts a vector in place and returns the median value of the elements.
Parameters
vec Numeric input vector
Description
Warning
The vector will be sorted first. Hence, if you want to keep the data in its original order, you need to copy the data first to a scratch vector and then call this function with the scratch vector!
hMedian(vec)
Returns the median value of the elements.
Parameters
vec Numeric input vector
hRMS(vec)
Calculate the root mean square.
Parameters
vec Vector.
hStdDev(vec, mean)
Calculates the standard deviation around a mean value.
Parameters
vec Numeric input vector mean The mean value of the vector calculated beforehand
hStdDev(vec)
Calculates the standard deviation of a vector of values.
Parameters
vec Numeric input vector
hStdDevBelow(vec, mean)
Calculates the standard deviation using only the values below the mean value.
Parameters
vec Numeric input vector mean The mean value of the vector calculated beforehand
hStdDevAbove(vec, mean)
Calculates the standard deviation using only the values below the mean value.
Parameters
vec Numeric input vector mean The mean value of the vector calculated beforehand
hMeanGreaterThanThreshold(vec, threshold)
Calculates the mean of all values which are GreaterThan a certain threshold value.
Parameters
vec Numeric input vector threshold The threshold above which elements are taken into account
hMeanGreaterEqualThreshold(vec, threshold)
Calculates the mean of all values which are GreaterEqual a certain threshold value.
Parameters
vec Numeric input vector threshold The threshold above which elements are taken into account
hMeanLessThanThreshold(vec, threshold)
Calculates the mean of all values which are LessThan a certain threshold value.
Parameters
vec Numeric input vector threshold The threshold above which elements are taken into account
hMeanLessEqualThreshold(vec, threshold)
Calculates the mean of all values which are LessEqual a certain threshold value.
Parameters
vec Numeric input vector threshold The threshold above which elements are taken into account
hMeanThreshold(vec, mean, rms, nsigma)
Calculates the mean of all values which are below or above the mean plus standard deviations
Parameters
vec Numeric input vector mean The mean of the values in the input vector provided as input. rms The rms value of the vector - also calculated beforehand. nsigma Only consider values that are below (positive) or above (negative) mean+nsigma+sigma the mean
Description
This simply call hMeanGreaterThanThreshold or hMeanLessThanThreshold with a threshold value of mean+nsigma*rms.
See also
hMeanInverse(vec)
Calculates the mean of the inverse of all values and then return the inverse of that value.
Parameters
vec Numeric input vector
Description
This is useful to calculate the mean value of very spiky data. Large spikes will appear as zero and hence will not have a strong effect on the average (or the sum) if only a small number of channels are affected, while a single very large spike could well dominate the normal average. Only works well if all values are positive (or negative). If the mean is around zero it becomes unstable, of course.
Usage
vec.meaninverse() -> N/sum(1/vec_0+1/vec_1+...+1/vec_N)
hMinStdDev(vecin, blocklen)
Find the minimum standard deviation of a vector within blocks of a certain length.
Parameters
vecin Numeric input vector blocklen Length of the blocks for which to calculate the RMS
Description
Subdivide the input vector into smaller blocks of len blocklen and calculate for each block the standard deviation. The standard deviation of the block with the smallest value will be returned. All blocks have the same length with a possible exception of the last block, which is ignored if it is shorter.
Used to find the RMS in the cleanest part of a spiky data set.
Usage
vec.minstddev(blocklen) -> minium rms (float)
hMinStdDevS(vec,blocklen) -> minium rms (float)
hMinStdDevBlock(vecin, blocklen, minrms, minmean)
Find the block of the smallest standard deviation in a vector and return mean and RMS.
Parameters
vecin Numeric input vector blocklen Length of the blocks for which to calculate the RMS minrms Standard deviation in block with minimum standard devitation (RMS) minmean Average value of values in block with minimum standard devitation (RMS)
Description
Subdivide the input vector into smaller blocks of len blocklen and calculate for each block the standard deviation. The block number of the block with the smallest standard deviation will be returned. The values of mean and standard deviation will be returned in the variables minrms and minmean. In Python both variables should be vectors, since scalars are not returned (in this case also blocklen needs to be a vector).
All blocks have the same length with a possible exception of the last block, which is ignored if it is shorter.
Used to find the the cleanest part of a spiky data set.
Usage
vec.minstddevblock(blocklen,minrms,minmean) -> block number of minimum rms (int)
hMinStdDevBlock(vec,blocklen,minrms,minmean) -> block number of minimum rms (int)
hStdDev(vec, mean)
Calculates the standard deviation around a mean value.
Parameters
vec Numeric input vector mean The mean value of the vector calculated beforehand
hStdDev(vec)
Calculates the standard deviation of a vector of values.
Parameters
vec Numeric input vector
hCount(vec, val)
Count the samples that are equal to a certain value and return the number of samples found.
Parameters
vec Numeric input vector to search through. val The value to find an count.
hFind(vec, value)
Find the first sample that equals the input values and return its position.
Parameters
vec Input vector to search through. value Value to search for.
Description
Return -1 if value is not found.
See also
findgreaterthan(), findgreaterequal(), findlessthan(), findlessequal(), findbetween(), findoutside(), findoutsideorequal(), findbetweenorequal()
hFind(vecout, vecin, value)
Find the samples whose values equal a certain value and return the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector matching the values vecin Numeric input vector to search through value The value to search
hFind(vec, value)
Find the first sample that equals the input values and return its position.
Parameters
vec Input vector to search through. value Value to search for.
Description
Return -1 if value is not found.
See also
findgreaterthan(), findgreaterequal(), findlessthan(), findlessequal(), findbetween(), findoutside(), findoutsideorequal(), findbetweenorequal()
hFind(vecout, vecin, value)
Find the samples whose values equal a certain value and return the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector matching the values vecin Numeric input vector to search through value The value to search
hCountBetween(vec, lower_limit, upper_limit)
Count the samples that are Between a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through lower_limit Lower limit to search for. upper_limit Upper limit to search for.
hCountBetweenOrEqual(vec, lower_limit, upper_limit)
Count the samples that are BetweenOrEqual a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through lower_limit Lower limit to search for. upper_limit Upper limit to search for.
hCountOutside(vec, lower_limit, upper_limit)
Count the samples that are Outside a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through lower_limit Lower limit to search for. upper_limit Upper limit to search for.
hCountOutsideOrEqual(vec, lower_limit, upper_limit)
Count the samples that are OutsideOrEqual a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through lower_limit Lower limit to search for. upper_limit Upper limit to search for.
hFindBetween(vec, lower_limit, upper_limit)
Find the first sample that is Between the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetween(vecout, vec, lower_limit, upper_limit)
Find the samples that are Between upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetweenOrEqual(vec, lower_limit, upper_limit)
Find the first sample that is BetweenOrEqual the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetweenOrEqual(vecout, vec, lower_limit, upper_limit)
Find the samples that are BetweenOrEqual upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutside(vec, lower_limit, upper_limit)
Find the first sample that is Outside the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutside(vecout, vec, lower_limit, upper_limit)
Find the samples that are Outside upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutsideOrEqual(vec, lower_limit, upper_limit)
Find the first sample that is OutsideOrEqual the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutsideOrEqual(vecout, vec, lower_limit, upper_limit)
Find the samples that are OutsideOrEqual upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetween(vec, lower_limit, upper_limit)
Find the first sample that is Between the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetween(vecout, vec, lower_limit, upper_limit)
Find the samples that are Between upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetweenOrEqual(vec, lower_limit, upper_limit)
Find the first sample that is BetweenOrEqual the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindBetweenOrEqual(vecout, vec, lower_limit, upper_limit)
Find the samples that are BetweenOrEqual upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutside(vec, lower_limit, upper_limit)
Find the first sample that is Outside the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutside(vecout, vec, lower_limit, upper_limit)
Find the samples that are Outside upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutsideOrEqual(vec, lower_limit, upper_limit)
Find the first sample that is OutsideOrEqual the two input values and return its position.
Parameters
vec Input vector to search through. lower_limit Lower limit to search for. upper_limit Upper limit to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOutsideOrEqual(vecout, vec, lower_limit, upper_limit)
Find the samples that are OutsideOrEqual upper and lower threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are between the limits. vec Numeric input vector to search through lower_limit The lower limit of values to find. upper_limit The upper limit of values to find.
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindSequenceBetween(vecout, vecin, lower_limit, upper_limit, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are Between the two threshold values.
Parameters
vecout Output vector - contains a list of 3 tuples of position, length, and mean value for each sequence found. vecin Numeric input vector to search through lower_limit Threshold value - lower_limit if values Between this, they can belong to a sequence. upper_limit Threshold value - upper-limit if values are Between this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual(), hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(-1024,1024); data[...] += Vector([-128.,256., 385.,-50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,-4096,4096,5099,3096])
>>> nsigma=5
>>> datapeaks=hArray(int,[4,256,2],name='Location of peaks')
>>> datamean=data[...].mean()
>>> datathreshold2 = data[...].stddev(datamean)
>>> datathreshold2 *= nsigma
>>> datathreshold1 = datathreshold2*(-1)
>>> datathreshold1 += datamean
>>> datathreshold2 += datamean
>>> maxgap=Vector(int,len(datamean),fill=10)
>>> minlength=Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequenceoutside(data[...],datathreshold1,datathreshold2,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindSequenceBetweenOrEqual(vecout, vecin, lower_limit, upper_limit, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are BetweenOrEqual the two threshold values.
Parameters
vecout Output vector - contains a list of 3 tuples of position, length, and mean value for each sequence found. vecin Numeric input vector to search through lower_limit Threshold value - lower_limit if values BetweenOrEqual this, they can belong to a sequence. upper_limit Threshold value - upper-limit if values are BetweenOrEqual this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual(), hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(-1024,1024); data[...] += Vector([-128.,256., 385.,-50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,-4096,4096,5099,3096])
>>> nsigma=5
>>> datapeaks=hArray(int,[4,256,2],name='Location of peaks')
>>> datamean=data[...].mean()
>>> datathreshold2 = data[...].stddev(datamean)
>>> datathreshold2 *= nsigma
>>> datathreshold1 = datathreshold2*(-1)
>>> datathreshold1 += datamean
>>> datathreshold2 += datamean
>>> maxgap=Vector(int,len(datamean),fill=10)
>>> minlength=Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequenceoutside(data[...],datathreshold1,datathreshold2,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindSequenceOutside(vecout, vecin, lower_limit, upper_limit, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are Outside the two threshold values.
Parameters
vecout Output vector - contains a list of 3 tuples of position, length, and mean value for each sequence found. vecin Numeric input vector to search through lower_limit Threshold value - lower_limit if values Outside this, they can belong to a sequence. upper_limit Threshold value - upper-limit if values are Outside this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual(), hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(-1024,1024); data[...] += Vector([-128.,256., 385.,-50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,-4096,4096,5099,3096])
>>> nsigma=5
>>> datapeaks=hArray(int,[4,256,2],name='Location of peaks')
>>> datamean=data[...].mean()
>>> datathreshold2 = data[...].stddev(datamean)
>>> datathreshold2 *= nsigma
>>> datathreshold1 = datathreshold2*(-1)
>>> datathreshold1 += datamean
>>> datathreshold2 += datamean
>>> maxgap=Vector(int,len(datamean),fill=10)
>>> minlength=Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequenceoutside(data[...],datathreshold1,datathreshold2,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindSequenceOutsideOrEqual(vecout, vecin, lower_limit, upper_limit, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are OutsideOrEqual the two threshold values.
Parameters
vecout Output vector - contains a list of 3 tuples of position, length, and mean value for each sequence found. vecin Numeric input vector to search through lower_limit Threshold value - lower_limit if values OutsideOrEqual this, they can belong to a sequence. upper_limit Threshold value - upper-limit if values are OutsideOrEqual this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual(), hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(-1024,1024); data[...] += Vector([-128.,256., 385.,-50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,-4096,4096,5099,3096])
>>> nsigma=5
>>> datapeaks=hArray(int,[4,256,2],name='Location of peaks')
>>> datamean=data[...].mean()
>>> datathreshold2 = data[...].stddev(datamean)
>>> datathreshold2 *= nsigma
>>> datathreshold1 = datathreshold2*(-1)
>>> datathreshold1 += datamean
>>> datathreshold2 += datamean
>>> maxgap=Vector(int,len(datamean),fill=10)
>>> minlength=Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequenceoutside(data[...],datathreshold1,datathreshold2,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hMaxInSequences(vecout, vecin, indexlist, nsequences)
Find the Max in a list of sequences provided by an indexlist of start/end values.
Parameters
vecout Numeric output vector containing the maxima of each sequence vecin Numeric input vector containing the values indexlist Integer list containing 2-tuples with begin and end index for each sequence nsequences The maximum number of sequences to take (all if <0 or >vector length).
Usage
maxima.maxinsequences(datavector,indexlist,npeaks) -> return maxima in each sequence indicated by indexlist
indexlist=Vector(int,[npeaks,2],fill=[seq0_start,seq0_end,seq1_start,seq1_end, ...])
See also
hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences(), hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> npeaks=3
>>> datavector = hArray(float,[10],fill=range(10))
>>> indexlist = hArray(int,[npeaks,2],fill=[0,2,3,5,5,9])
>>> maxima = hArray(float,[npeaks])
>>> maxima.maxinsequences(datavector,indexlist,npeaks)
>>> maxima
hArray(float, [3], fill=[1,4,8]) # len=3 slice=[0:3])
hMinInSequences(vecout, vecin, indexlist, nsequences)
Find the Min in a list of sequences provided by an indexlist of start/end values.
Parameters
vecout Numeric output vector containing the maxima of each sequence vecin Numeric input vector containing the values indexlist Integer list containing 2-tuples with begin and end index for each sequence nsequences The maximum number of sequences to take (all if <0 or >vector length).
Usage
maxima.maxinsequences(datavector,indexlist,npeaks) -> return maxima in each sequence indicated by indexlist
indexlist=Vector(int,[npeaks,2],fill=[seq0_start,seq0_end,seq1_start,seq1_end, ...])
See also
hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences(), hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> npeaks=3
>>> datavector = hArray(float,[10],fill=range(10))
>>> indexlist = hArray(int,[npeaks,2],fill=[0,2,3,5,5,9])
>>> maxima = hArray(float,[npeaks])
>>> maxima.maxinsequences(datavector,indexlist,npeaks)
>>> maxima
hArray(float, [3], fill=[1,4,8]) # len=3 slice=[0:3])
hSumInSequences(vecout, vecin, indexlist, nsequences)
Find the Sum in a list of sequences provided by an indexlist of start/end values.
Parameters
vecout Numeric output vector containing the maxima of each sequence vecin Numeric input vector containing the values indexlist Integer list containing 2-tuples with begin and end index for each sequence nsequences The maximum number of sequences to take (all if <0 or >vector length).
Usage
maxima.maxinsequences(datavector,indexlist,npeaks) -> return maxima in each sequence indicated by indexlist
indexlist=Vector(int,[npeaks,2],fill=[seq0_start,seq0_end,seq1_start,seq1_end, ...])
See also
hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences(), hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> npeaks=3
>>> datavector = hArray(float,[10],fill=range(10))
>>> indexlist = hArray(int,[npeaks,2],fill=[0,2,3,5,5,9])
>>> maxima = hArray(float,[npeaks])
>>> maxima.maxinsequences(datavector,indexlist,npeaks)
>>> maxima
hArray(float, [3], fill=[1,4,8]) # len=3 slice=[0:3])
hMeanInSequences(vecout, vecin, indexlist, nsequences)
Find the Mean in a list of sequences provided by an indexlist of start/end values.
Parameters
vecout Numeric output vector containing the maxima of each sequence vecin Numeric input vector containing the values indexlist Integer list containing 2-tuples with begin and end index for each sequence nsequences The maximum number of sequences to take (all if <0 or >vector length).
Usage
maxima.maxinsequences(datavector,indexlist,npeaks) -> return maxima in each sequence indicated by indexlist
indexlist=Vector(int,[npeaks,2],fill=[seq0_start,seq0_end,seq1_start,seq1_end, ...])
See also
hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences(), hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> npeaks=3
>>> datavector = hArray(float,[10],fill=range(10))
>>> indexlist = hArray(int,[npeaks,2],fill=[0,2,3,5,5,9])
>>> maxima = hArray(float,[npeaks])
>>> maxima.maxinsequences(datavector,indexlist,npeaks)
>>> maxima
hArray(float, [3], fill=[1,4,8]) # len=3 slice=[0:3])
hStdDevInSequences(vecout, vecin, indexlist, nsequences)
Find the StdDev in a list of sequences provided by an indexlist of start/end values.
Parameters
vecout Numeric output vector containing the maxima of each sequence vecin Numeric input vector containing the values indexlist Integer list containing 2-tuples with begin and end index for each sequence nsequences The maximum number of sequences to take (all if <0 or >vector length).
Usage
maxima.maxinsequences(datavector,indexlist,npeaks) -> return maxima in each sequence indicated by indexlist
indexlist=Vector(int,[npeaks,2],fill=[seq0_start,seq0_end,seq1_start,seq1_end, ...])
See also
hMaxInSequences(), hMinInSequences(), hSumInSequences(), hMeanInSequences(), hStdDevInSequences(), hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> npeaks=3
>>> datavector = hArray(float,[10],fill=range(10))
>>> indexlist = hArray(int,[npeaks,2],fill=[0,2,3,5,5,9])
>>> maxima = hArray(float,[npeaks])
>>> maxima.maxinsequences(datavector,indexlist,npeaks)
>>> maxima
hArray(float, [3], fill=[1,4,8]) # len=3 slice=[0:3])
hFindGreaterThan(vec, threshold)
Find the first sample that is GreaterThan the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterThan(vecout, vec, threshold)
Find the samples that are GreaterThan a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterEqual(vec, threshold)
Find the first sample that is GreaterEqual the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterEqual(vecout, vec, threshold)
Find the samples that are GreaterEqual a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessThan(vec, threshold)
Find the first sample that is LessThan the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessThan(vecout, vec, threshold)
Find the samples that are LessThan a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessEqual(vec, threshold)
Find the first sample that is LessEqual the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessEqual(vecout, vec, threshold)
Find the samples that are LessEqual a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterThan(vec, threshold)
Find the first sample that is GreaterThan the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterThan(vecout, vec, threshold)
Find the samples that are GreaterThan a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterEqual(vec, threshold)
Find the first sample that is GreaterEqual the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterEqual(vecout, vec, threshold)
Find the samples that are GreaterEqual a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessThan(vec, threshold)
Find the first sample that is LessThan the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessThan(vecout, vec, threshold)
Find the samples that are LessThan a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessEqual(vec, threshold)
Find the first sample that is LessEqual the threshold value and return its position.
Parameters
vec Input vector to search through. threshold Threshold value to search for.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindLessEqual(vecout, vec, threshold)
Find the samples that are LessEqual a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold The threshold value
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindGreaterThanVec(vecout, vec, threshold)
Find the samples that are GreaterThan the corresponding threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold Vector with threshold values
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindGreaterThanVec(), hFindGreaterEqualVec(), hFindLessThanVec(), hFindLessEqualVec()
hFindGreaterEqualVec(vecout, vec, threshold)
Find the samples that are GreaterEqual the corresponding threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold Vector with threshold values
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindGreaterThanVec(), hFindGreaterEqualVec(), hFindLessThanVec(), hFindLessEqualVec()
hFindLessThanVec(vecout, vec, threshold)
Find the samples that are LessThan the corresponding threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold Vector with threshold values
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindGreaterThanVec(), hFindGreaterEqualVec(), hFindLessThanVec(), hFindLessEqualVec()
hFindLessEqualVec(vecout, vec, threshold)
Find the samples that are LessEqual the corresponding threshold values and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through threshold Vector with threshold values
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindGreaterThanVec(), hFindGreaterEqualVec(), hFindLessThanVec(), hFindLessEqualVec()
hFindGreaterThanAbs(vecout, vecin, threshold)
Find the samples whose absolute values are GreaterThan a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are above threshold vecin Numeric input vector to search through threshold The threshold value
hFindGreaterEqualAbs(vecout, vecin, threshold)
Find the samples whose absolute values are GreaterEqual a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are above threshold vecin Numeric input vector to search through threshold The threshold value
hFindLessThanAbs(vecout, vecin, threshold)
Find the samples whose absolute values are LessThan a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are above threshold vecin Numeric input vector to search through threshold The threshold value
hFindLessEqualAbs(vecout, vecin, threshold)
Find the samples whose absolute values are LessEqual a certain threshold value and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in input vector which are above threshold vecin Numeric input vector to search through threshold The threshold value
hCountGreaterThan(vec, threshold)
Count the samples that are GreaterThan a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountGreaterEqual(vec, threshold)
Count the samples that are GreaterEqual a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountLessThan(vec, threshold)
Count the samples that are LessThan a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountLessEqual(vec, threshold)
Count the samples that are LessEqual a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountGreaterThanAbs(vec, threshold)
Find the samples whose absolute values are GreaterThan a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountGreaterEqualAbs(vec, threshold)
Find the samples whose absolute values are GreaterEqual a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountLessThanAbs(vec, threshold)
Find the samples whose absolute values are LessThan a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hCountLessEqualAbs(vec, threshold)
Find the samples whose absolute values are LessEqual a certain threshold value and returns the number of samples found.
Parameters
vec Numeric input vector to search through threshold The threshold value
hFindSequenceGreaterThan(vecout, vecin, threshold, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are GreaterThan a threshold value
Parameters
vecout Output vector - contains a list of 2 tuples of position and length for each sequence found. vecin Numeric input vector to search through threshold Threshold value - if values are GreaterThan this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
Usage
npeaks=indexlist.findsequencegreaterthan(vecin,threshold,maxgap,minlength)
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(0,1024); data[...] += Vector([128.,256., 385.,50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,4096,4096,5099,3096])
>>> datapeaks = hArray(int,[4,256,2], name='Location of peaks')
>>> datamean = data[...].mean()
>>> datathreshold = data[...].stddev(datamean)
>>> datathreshold *= 5
>>> datathreshold += datamean
>>> maxgap = Vector(int,len(datamean),fill=10)
>>> minlength = Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequencegreaterthan(data[...],datathreshold,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindSequenceGreaterEqual(vecout, vecin, threshold, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are GreaterEqual a threshold value
Parameters
vecout Output vector - contains a list of 2 tuples of position and length for each sequence found. vecin Numeric input vector to search through threshold Threshold value - if values are GreaterEqual this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
Usage
npeaks=indexlist.findsequencegreaterthan(vecin,threshold,maxgap,minlength)
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(0,1024); data[...] += Vector([128.,256., 385.,50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,4096,4096,5099,3096])
>>> datapeaks = hArray(int,[4,256,2], name='Location of peaks')
>>> datamean = data[...].mean()
>>> datathreshold = data[...].stddev(datamean)
>>> datathreshold *= 5
>>> datathreshold += datamean
>>> maxgap = Vector(int,len(datamean),fill=10)
>>> minlength = Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequencegreaterthan(data[...],datathreshold,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindSequenceLessThan(vecout, vecin, threshold, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are LessThan a threshold value
Parameters
vecout Output vector - contains a list of 2 tuples of position and length for each sequence found. vecin Numeric input vector to search through threshold Threshold value - if values are LessThan this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
Usage
npeaks=indexlist.findsequencegreaterthan(vecin,threshold,maxgap,minlength)
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(0,1024); data[...] += Vector([128.,256., 385.,50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,4096,4096,5099,3096])
>>> datapeaks = hArray(int,[4,256,2], name='Location of peaks')
>>> datamean = data[...].mean()
>>> datathreshold = data[...].stddev(datamean)
>>> datathreshold *= 5
>>> datathreshold += datamean
>>> maxgap = Vector(int,len(datamean),fill=10)
>>> minlength = Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequencegreaterthan(data[...],datathreshold,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindSequenceLessEqual(vecout, vecin, threshold, maxgap, minlength)
Find and return a list containing slice indices (i.e., beginning and end+1 position) of sequences of (almost) consecutive values in a vector which are LessEqual a threshold value
Parameters
vecout Output vector - contains a list of 2 tuples of position and length for each sequence found. vecin Numeric input vector to search through threshold Threshold value - if values are LessEqual this, they can belong to a sequence. maxgap The maximum gap (in between sample numbers) between two samples to still belong to one sequence. 0=no gaps allowed, i.e. consecutive. minlength The minimum length of a sequence.
Usage
npeaks=indexlist.findsequencegreaterthan(vecin,threshold,maxgap,minlength)
See also
hFind(), hFindSequenceGreaterThan(), hFindSequenceGreaterEqual(), hFindSequenceLessThan(), hFindSequenceLessEqual(), hFindSequenceBetween(), hFindSequenceOutside(), hFindSequenceOutsideOrEqual(), hFindSequenceBetweenOrEqual()
Example
>>> # Make a test time series data set for 4 antennas and some peaks at various locations
>>> data=hArray(float,[4,512],name='Random series with peaks')
>>> data.random(0,1024); data[...] += Vector([128.,256., 385.,50.])
>>> for i in range(4):
... data[i,[2,3,32,64,65,67],...] = Vector([4096.,5097,4096,4096,5099,3096])
>>> datapeaks = hArray(int,[4,256,2], name='Location of peaks')
>>> datamean = data[...].mean()
>>> datathreshold = data[...].stddev(datamean)
>>> datathreshold *= 5
>>> datathreshold += datamean
>>> maxgap = Vector(int,len(datamean),fill=10)
>>> minlength = Vector(int,len(datamean),fill=1)
>>> npeaks=datapeaks[...].findsequencegreaterthan(data[...],datathreshold,maxgap,minlength)
>>> npeaks
Vec(int,4)=[3,3,3,3]
>>> datapeaks
hArray(int,[4, 256, 2], name='Location of peaks') # len=2048, slice=[0:512], vec -> [2,4,32,33,64,68,0,0,...]
hFindOdd(vec)
Find the first sample that is odd and return its position.
Parameters
vec Input vector to search through.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindOdd(), hFindEven()
hFindOdd(vecout, vec)
Find the samples that are odd and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindEven(vec)
Find the first sample that is even and return its position.
Parameters
vec Input vector to search through.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindOdd(), hFindEven()
hFindEven(vecout, vec)
Find the samples that are even and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindOdd(vec)
Find the first sample that is odd and return its position.
Parameters
vec Input vector to search through.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindOdd(), hFindEven()
hFindOdd(vecout, vec)
Find the samples that are odd and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hFindEven(vec)
Find the first sample that is even and return its position.
Parameters
vec Input vector to search through.
Description
Return -1 if not found.
See also
hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven(), hFindOdd(), hFindEven()
hFindEven(vecout, vec)
Find the samples that are even and returns the number of samples found and the positions of the samples in a second vector.
Parameters
vecout Output vector - contains a list of positions in the input vector which satisfy the threshold condition. vec Numeric input vector to search through
See also
hFind(), hFindGreaterThan(), hFindGreaterEqual(), hFindLessThan(), hFindLessEqual(), hFindBetween(), hFindOutside(), hFindOutsideOrEqual(), hFindBetweenOrEqual(), hFindOdd(), hFindEven()
hCountOdd(vec)
Counts the samples that are odd and returns the number of samples found.
Parameters
vec Numeric input vector to search through
hCountEven(vec)
Counts the samples that are even and returns the number of samples found.
Parameters
vec Numeric input vector to search through
hDownsample(vecout, vecin)
Downsample the input vector to a smaller output vector.
Parameters
vecout Downsampled output vector vecin Numeric input vector
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
hDownsample(vec, downsample_factor)
Downsample the input vector by a certain factor and return a new vector.
Parameters
vec Numeric input vector downsample_factor Factor by which to reduce original size
Description
Downsample the input vector to a new smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
hDownsample(vecout, vecrms, vecin)
Downsample the input vector to a smaller output vector.
Parameters
vecout Downsampled output vector vecrms Output vector containing the RMS in each bin. vecin Numeric input vector
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
As a second output the root mean square (RMS, standard deviation) of the mean in each downsampled bin is returned.
hDownsample(vecout, vecin)
Downsample the input vector to a smaller output vector.
Parameters
vecout Downsampled output vector vecin Numeric input vector
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
hDownsample(vec, downsample_factor)
Downsample the input vector by a certain factor and return a new vector.
Parameters
vec Numeric input vector downsample_factor Factor by which to reduce original size
Description
Downsample the input vector to a new smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
hDownsample(vecout, vecrms, vecin)
Downsample the input vector to a smaller output vector.
Parameters
vecout Downsampled output vector vecrms Output vector containing the RMS in each bin. vecin Numeric input vector
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
As a second output the root mean square (RMS, standard deviation) of the mean in each downsampled bin is returned.
hInterpolate2P(vec, startvalue, endvalue)
Interpolate a vector between two end points, which are part also start and end points of the new vector (adds to output vector!)
Parameters
vec Interpolated output vector startvalue Starting value of the output vector endvalue End value of the output vector
Description
Note, the interpolated data is added to the output vector, so the array needs to be initialized with zero.
Example
v=hArray(float, [10])
v.interpolate2p(0.,9.) #-> [0,1,2,3,4,5,6,7,8,9]
v.interpolate2psubpiece(0.,10.) #-> [0,1,2,3,4,5,6,7,8,9]
hInterpolate2PSubpiece(vec, startvalue, endvalue)
Interpolate a vector between two end points, where the 2nd end point marks the last element of the output vector plus one.
Parameters
vec Interpolated output vector startvalue Starting value of the output vector endvalue End value of the output vector
Description
Note, the interpolated data is added to the output vector, so the array needs to be initialized with zero. Useful for piecing interpolations together (adds to output vector!)
Example
>>> v = hArray(float, [10])
>>> v.interpolate2p(0.,9.) #-> [0,1,2,3,4,5,6,7,8,9]
>>> v.interpolate2psubpiece(0.,10.) #-> [0,1,2,3,4,5,6,7,8,9]
hDownsample(vecout, vecin)
Downsample the input vector to a smaller output vector.
Parameters
vecout Downsampled output vector vecin Numeric input vector
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
hDownsample(vec, downsample_factor)
Downsample the input vector by a certain factor and return a new vector.
Parameters
vec Numeric input vector downsample_factor Factor by which to reduce original size
Description
Downsample the input vector to a new smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
hDownsample(vecout, vecrms, vecin)
Downsample the input vector to a smaller output vector.
Parameters
vecout Downsampled output vector vecrms Output vector containing the RMS in each bin. vecin Numeric input vector
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
As a second output the root mean square (RMS, standard deviation) of the mean in each downsampled bin is returned.
hUpsample(vecout, vecin)
Upsample the input vector to a larger output vector by linear interpolation and add to output vector.
Parameters
vecout Upsampled output vector vecin Shorter vector to be upsampled.
Description
Note, the interpolated data is added to the output vector, so the array needs to be initialized with zero.
Example
>>> x = hArray(float, [31])
>>> v = hArray(float, [10])
>>> v.interpolate2p(0.,9.) #-> [0,1,2,3,4,5,6,7,8,9]
>>> x.upsample(v)
hDownsampleSpikyData(vecout, vecrms, vecin, nsigma)
Downsample the input vector to a smaller output vector trying to exclude spikes in the data.
Parameters
vecout Downsampled output vector vecrms Output vector containgin the RMS in each bin. vecin Numeric input vector. nsigma Only consider values for averaging that are nsigma above (positive) or below (negative) the mean.
Description
Downsample the input vector to a smaller output vector, by replacing subsequent blocks of values by their mean value. The block size is automatically chosen such that the input vector fits exactly into the output vector. All blocks have the same length with a possible exception of the last block.
As a second output the root mean square (RMS, standard deviation) of the mean in each downsampled bin is returned.
The mean here is taken only of data that is below
(negative) or above (positive) the RMS in the bin.
hFindLowerBound(vec, value)
Finds the location (i.e., returns integer) in a monotonically increasing vector, where the input search value is just above or equal to the value in the vector.
Parameters
vec Sorted numeric input vector value value to search for
Description
Finds – through a binary search and interpolation – the location in a monotonically increasing vector, where the search value is just above or equal to the value in the vector.
This requires random access iterators, in order to have an optimal search result.
hFlatWeights(len)
Returns vector of weights of length len with constant weights normalized to give a sum of unity. Can be used by hRunningAverageT.
Parameters
len Lengths of weights vector
hLinearWeights(len)
Returns vector of weights of length len with linearly rising and decreasing weights centered at len/2.
Parameters
len Lengths of weights vector
Description
The vector is normalized to give a sum of unity. Can be used by hRunningAverage.
See also
hGaussianWeights(len)
Returns vector of wieghts with Gaussian distribution.
Parameters
len Lengths of weights vector
Description
Returns vector of weights of length len with a Gaussian
distribution centered at len/2 and
len/4 (i.e. the Gaussian extends over
in both directions).
hGaussianWeights(len, nsigma)
Returns vector of wieghts with Gaussian distribution.
Parameters
len Lengths of weights vector nsigma Number of sigma for falloff
Description
Returns vector of weights of length len with a Gaussian
distribution centered at len/2 and
len/nsigma (i.e. the Gaussian extends over
in both directions).
hGaussianWeights(len)
Returns vector of wieghts with Gaussian distribution.
Parameters
len Lengths of weights vector
Description
Returns vector of weights of length len with a Gaussian
distribution centered at len/2 and
len/4 (i.e. the Gaussian extends over
in both directions).
hGaussianWeights(len, nsigma)
Returns vector of wieghts with Gaussian distribution.
Parameters
len Lengths of weights vector nsigma Number of sigma for falloff
Description
Returns vector of weights of length len with a Gaussian
distribution centered at len/2 and
len/nsigma (i.e. the Gaussian extends over
in both directions).
hWeights(len, type)
Create a normalized weight vector.
Parameters
len Length of weight vector type Type of weight vector
hRunningAverage(vec, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
vec Input and Output vector weights Weight vector
Description
Will return a vector where each element is replaced by the sum of its neighbours multiplied with the weights vector. The middle of the weightsvector (usually its peak) is at len(weights)/2. It is assumed that the wights are normalized (i.e. sum(weights)=1).
hRunningAverage(odata, idata, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
odata Output vector idata Input vector weights Weight vector
hRunningAverage(odata, idata, len, type)
Overloaded function to automatically calculate weights.
Parameters
odata Output vector idata Input vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have the same value. LINEAR Linearly rising, peaking at the center (i.e., /\). GAUSSIAN Gaussian distribution falling off to at the ends.
Example
>>> in_array.runningaverage(array_out,7,hWEIGHTS.GAUSSIAN)
>>> x = hArray([0.,1.,0.,3.,1.,3.,0.,2.,1.])
>>> x.runningaverage(3,hWEIGHTS.FLAT)
>>> x
[0.333333,0.333333,1.33333,1.33333,2.33333,1.33333,1.66667,1,1.33333]
hRunningAverage(odata, len, type)
Calculate the running average of an input vector using different weighting schemes.
Parameters
odata Output vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have weight the same value LINEAR Linearly rising, peaking at the center (i.e., /\) GAUSSIAN Gaussian distribution falling off to at the ends
Example
>>> in_array.runningaverage(7,hWEIGHTS.GAUSSIAN)
hRunningAverage(vec, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
vec Input and Output vector weights Weight vector
Description
Will return a vector where each element is replaced by the sum of its neighbours multiplied with the weights vector. The middle of the weightsvector (usually its peak) is at len(weights)/2. It is assumed that the wights are normalized (i.e. sum(weights)=1).
hRunningAverage(odata, idata, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
odata Output vector idata Input vector weights Weight vector
hRunningAverage(odata, idata, len, type)
Overloaded function to automatically calculate weights.
Parameters
odata Output vector idata Input vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have the same value. LINEAR Linearly rising, peaking at the center (i.e., /\). GAUSSIAN Gaussian distribution falling off to at the ends.
Example
>>> in_array.runningaverage(array_out,7,hWEIGHTS.GAUSSIAN)
>>> x = hArray([0.,1.,0.,3.,1.,3.,0.,2.,1.])
>>> x.runningaverage(3,hWEIGHTS.FLAT)
>>> x
[0.333333,0.333333,1.33333,1.33333,2.33333,1.33333,1.66667,1,1.33333]
hRunningAverage(odata, len, type)
Calculate the running average of an input vector using different weighting schemes.
Parameters
odata Output vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have weight the same value LINEAR Linearly rising, peaking at the center (i.e., /\) GAUSSIAN Gaussian distribution falling off to at the ends
Example
>>> in_array.runningaverage(7,hWEIGHTS.GAUSSIAN)
hRunningAverage(vec, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
vec Input and Output vector weights Weight vector
Description
Will return a vector where each element is replaced by the sum of its neighbours multiplied with the weights vector. The middle of the weightsvector (usually its peak) is at len(weights)/2. It is assumed that the wights are normalized (i.e. sum(weights)=1).
hRunningAverage(odata, idata, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
odata Output vector idata Input vector weights Weight vector
hRunningAverage(odata, idata, len, type)
Overloaded function to automatically calculate weights.
Parameters
odata Output vector idata Input vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have the same value. LINEAR Linearly rising, peaking at the center (i.e., /\). GAUSSIAN Gaussian distribution falling off to at the ends.
Example
>>> in_array.runningaverage(array_out,7,hWEIGHTS.GAUSSIAN)
>>> x = hArray([0.,1.,0.,3.,1.,3.,0.,2.,1.])
>>> x.runningaverage(3,hWEIGHTS.FLAT)
>>> x
[0.333333,0.333333,1.33333,1.33333,2.33333,1.33333,1.66667,1,1.33333]
hRunningAverage(odata, len, type)
Calculate the running average of an input vector using different weighting schemes.
Parameters
odata Output vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have weight the same value LINEAR Linearly rising, peaking at the center (i.e., /\) GAUSSIAN Gaussian distribution falling off to at the ends
Example
>>> in_array.runningaverage(7,hWEIGHTS.GAUSSIAN)
hRunningAverage(vec, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
vec Input and Output vector weights Weight vector
Description
Will return a vector where each element is replaced by the sum of its neighbours multiplied with the weights vector. The middle of the weightsvector (usually its peak) is at len(weights)/2. It is assumed that the wights are normalized (i.e. sum(weights)=1).
hRunningAverage(odata, idata, weights)
Calculate the running average of an input vector using a weight vector.
Parameters
odata Output vector idata Input vector weights Weight vector
hRunningAverage(odata, idata, len, type)
Overloaded function to automatically calculate weights.
Parameters
odata Output vector idata Input vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have the same value. LINEAR Linearly rising, peaking at the center (i.e., /\). GAUSSIAN Gaussian distribution falling off to at the ends.
Example
>>> in_array.runningaverage(array_out,7,hWEIGHTS.GAUSSIAN)
>>> x = hArray([0.,1.,0.,3.,1.,3.,0.,2.,1.])
>>> x.runningaverage(3,hWEIGHTS.FLAT)
>>> x
[0.333333,0.333333,1.33333,1.33333,2.33333,1.33333,1.66667,1,1.33333]
hRunningAverage(odata, len, type)
Calculate the running average of an input vector using different weighting schemes.
Parameters
odata Output vector len Length of weight vector type Type of weight vector
Description
Available Weights:
FLAT All have weight the same value LINEAR Linearly rising, peaking at the center (i.e., /\) GAUSSIAN Gaussian distribution falling off to at the ends
Example
>>> in_array.runningaverage(7,hWEIGHTS.GAUSSIAN)
hSquareAdd(outvec, vecin)
Calculates the square of the input vector and add it to the values in the output vector
Parameters
outvec Vector containing a copy of the input values converted to a new type vecin Input vector containing complex values. (Looping parameter)
Description
Calculate for each element
in the input vector
and add the result to the output vector. Note that (unlike for
hSpectralPower) for complex numbers the result can also be negative!
The fact that the result is added to the output vector allows one to call the function multiple times and get a summed spectrum. If you need it only once, just fill the vector with zeros.
The number of loops (if used with an hArray) is here determined by the second parameter!
If the vectors have different lengths, the shortest one is taken to determine for how many elements this is calculated.
See also
hSpectralPower(), hSpectralPower2()
Example
>>> spectrum = hArray(float,[1,128])
>>> cplxfft = hArray(complex,[10,128],fill=1+0j)
>>> spectrum[...].squareadd(cplxfft[...])
hSquareAdd(out, in)
Calculates the square of the absolute value and add it to output vector.
Parameters
out Numpy vector in Input vector
Description
Calculate for each element
in the input vector
and add the result to the output vector.
hSquareAdd(outvec, vecin)
Calculates the square of the input vector and add it to the values in the output vector
Parameters
outvec Vector containing a copy of the input values converted to a new type vecin Input vector containing complex values. (Looping parameter)
Description
Calculate for each element
in the input vector
and add the result to the output vector. Note that (unlike for
hSpectralPower) for complex numbers the result can also be negative!
The fact that the result is added to the output vector allows one to call the function multiple times and get a summed spectrum. If you need it only once, just fill the vector with zeros.
The number of loops (if used with an hArray) is here determined by the second parameter!
If the vectors have different lengths, the shortest one is taken to determine for how many elements this is calculated.
See also
hSpectralPower(), hSpectralPower2()
Example
>>> spectrum = hArray(float,[1,128])
>>> cplxfft = hArray(complex,[10,128],fill=1+0j)
>>> spectrum[...].squareadd(cplxfft[...])
hSquareAdd(out, in)
Calculates the square of the absolute value and add it to output vector.
Parameters
out Numpy vector in Input vector
Description
Calculate for each element
in the input vector
and add the result to the output vector.
hSquareAddTransposed(out, in, dimsize)
Calculates the square of the absolute value and add it to output vector while shifting last dimension to first.
Parameters
out Numpy vector in Input vector dimsize Size of last dimension in input vector
Description
Calculate for each element
in the input vector
and add the result to the output vector.
In addition this routine shifts the last dimension (e.g. fastest running index) of size dimsize to
the first dimension (e.g. slowest running index).
hAbsSquareAdd(outvec, vecin)
Calculates the square of the absolute value of a complex number and add to output vector
Parameters
outvec Vector containing a copy of the input values converted to a new type vecin Input vector containing complex values. (Looping parameter)
Description
Calculate for each element
in the input vector
and add the result to the output vector.
The fact that the result is added to the output vector allows one to call the function multiple times and get a summed spectrum. If you need it only once, just fill the vector with zeros.
The number of loops (if used with an hArray) is here determined by the second parameter!
Example
>>> spectrum = hArray(float,[1,128])
>>> cplxfft = hArray(complex,[10,128],fill=1+0j)
>>> spectrum[...].spectralpower(cplxfft[...])
hAbsSquareAdd(out, in)
Calculates the square of the absolute value and add it to output vector.
Parameters
out Numpy vector in Input vector
Description
Calculate for each element
in the input vector
and add the result to the output vector.
hAbsSquareAdd(outvec, vecin)
Calculates the square of the absolute value of a complex number and add to output vector
Parameters
outvec Vector containing a copy of the input values converted to a new type vecin Input vector containing complex values. (Looping parameter)
Description
Calculate for each element
in the input vector
and add the result to the output vector.
The fact that the result is added to the output vector allows one to call the function multiple times and get a summed spectrum. If you need it only once, just fill the vector with zeros.
The number of loops (if used with an hArray) is here determined by the second parameter!
Example
>>> spectrum = hArray(float,[1,128])
>>> cplxfft = hArray(complex,[10,128],fill=1+0j)
>>> spectrum[...].spectralpower(cplxfft[...])
hAbsSquareAdd(out, in)
Calculates the square of the absolute value and add it to output vector.
Parameters
out Numpy vector in Input vector
Description
Calculate for each element
in the input vector
and add the result to the output vector.
hEqual(vec0, vec1)
Compares two vectors for equality
Parameters
vec0 Primary vector. vec1 Secondary vector.
hAlmostEqual(vec0, vec1, decimal)
Compares two vectors for equality up to a given number of decimal places.
Parameters
vec0 Primary vector. vec1 Secondary vector. decimal Desired number of decimal places for equality.
hMaskToStep(step, mask)
Calculate steps to skip masked entries
Parameters
step Array with steps to skip masked entries. mask Array with mask defining which frequency channels are to be skipped. Expected array of lenght Nf (where Nf is the number of frequency channels) containing zeros (for channels to be included) and ones (for channels to be masked and not used for imaging).
hCountZero(vec)
Count the number of zero elements
Parameters
vec Vector.
hCountNonZero(vec)
Count the number of non-zero elements
Parameters
vec Vector.
hShiftedAbsSquareAdd(target, source, shifts)
Add absolute value squared at shifted position
Parameters
target source shifts
hIsFinite(vec)
Returns true if all values are finite
Parameters
vec Vector.
hIsFiniteComplex(vec)
Returns true if both the real and imaginary part of all values are finite
Parameters
vec Vector.
hIsNormal(vec)
Returns true if all values are finite and not denormalised
Parameters
vec Vector.
hAtan2(out, y, x)
Calculate atan2 of both vectors and store in output
Parameters
out Vector. y Vector. x Vector.
hMaxSNR(snr, mean, rms, max, maxpos, vec, signal_start, signal_end)
Calculate the signal to noise ratio of the maximum.
Parameters
snr Signal to noise ratio of maximum. mean Mean of noise window. rms RMS of noise window. max Maximum of signal window. maxpos Position of maximum with respect to signal_start. vec Vector. signal_start Start of signal part where to look for maximum. signal_end End of signal part where to look for maximum.
hIntegratedPulsePower(power, noise_power, vec, signal_start, signal_end)
Calculate integrated pulse power
Parameters
power Integrated pulse power. noise_power Integrated noise power per sample. vec Vector. signal_start Start of signal window. signal_end End of signal window.
hModulus(vec, m)
Calculate modulus of vector
Parameters
vec Vector. m Vector.
hTestSlice(vec0, vec1, vec2)
Test slicing
Parameters
vec0 Vector. vec1 Vector. vec2 Vector.