ntrfc.math package

Submodules

ntrfc.math.methods module

ntrfc.math.methods.C_barycentric(R)
ntrfc.math.methods.autocorr(signal)
Param:

signal - numpy-array.

ntrfc.math.methods.autocorrelate(series)

Compute the autocorrelation function of a given time series.

Parameters:

series (array-like) – The 1D time series to be autocorrelated.

Returns:

The autocorrelation function of the input series.

Return type:

array-like

ntrfc.math.methods.calcAnisoEigs(anisotropy_matrix)
ntrfc.math.methods.calcAnisoMatrix(reynoldsstress_tensor)
ntrfc.math.methods.find_nearest(array, value)
ntrfc.math.methods.is_equidistant(arr, tolerance=1e-08)
ntrfc.math.methods.minmax_normalize(series_array)

Normalize a given 1D array to the range [0, 1] using min-max normalization.

Parameters:

series_array (array-like) – The 1D array to be normalized.

Returns:

The normalized 1D array with values in the range [0, 1].

Return type:

array-like

Note

If all values in the input array are the same, the function will return the input array unchanged.

ntrfc.math.methods.reldiff(a, b)

Calculates the relative difference between two values or arrays of values.

Parameters: a (float or numpy array): The first value or array of values to compare. b (float or numpy array): The second value or array of values to compare.

Returns: float or numpy array: The relative difference between a and b. If a and b are both numpy arrays, the output will be a numpy array of the same shape. If one input is a float and the other is a numpy array, the output will be a numpy array of the same shape as the input array.

Notes: The relative difference is defined as the absolute difference between the two values divided by the average of their absolute values. If a and b are equal, the relative difference is 0. If either a or b is zero, the absolute difference between the two values is returned instead of the relative difference.

ntrfc.math.methods.return_intersection(hist_1, hist_2)

Calculate the intersection of two histograms.

Parameters:
  • hist_1 (numpy.ndarray) – The first histogram to be compared.

  • hist_2 (numpy.ndarray) – The second histogram to be compared.

Returns:

The intersection of the two histograms.

Return type:

float

ntrfc.math.methods.zero_crossings(data_series)

ntrfc.math.vectorcalc module

Created on Sun Oct 4 19:01:50 2020

@author: malte

ntrfc.math.vectorcalc.RotFromTwoVecs(vec1, vec2)

Find the rotation matrix that aligns vec1 to vec2 :param vec1: A 3d “source” vector :param vec2: A 3d “destination” vector :return mat: A transform matrix (3x3) which when applied to vec1, aligns it with vec2.

ntrfc.math.vectorcalc.Rx(xAngle)

using radiant :param xAngle: angle in rad :return: rotation matrix

ntrfc.math.vectorcalc.Ry(yAngle)

using radiant :param yAngle: angle in rad :return: rotation matrix

ntrfc.math.vectorcalc.Rz(zAngle)

using radiant :param zAngle: angle in rad :return: rotation matrix

ntrfc.math.vectorcalc.calc_largedistant_idx(x_koords, y_koords)

tested method to find indices of coordinates of a 2d-pointcloud with the biggest distance :param x_koords: array of xcords :param y_koords: array of ycords :return: index_1,index_2 (int)

ntrfc.math.vectorcalc.closest_node_index(node, nodes)
ntrfc.math.vectorcalc.distant_node_index(node, nodes)
ntrfc.math.vectorcalc.ellipsoidVol(sig)

tested method to compute the ellipsoid volume by the sigma-parameters of a parametric ellipsoid :param sig: :return:

ntrfc.math.vectorcalc.eulersFromRPG(R)
ntrfc.math.vectorcalc.findNearest(array, point)
ntrfc.math.vectorcalc.gradToRad(angle)

tested method to translate from grad to rad :param angle: :return:

ntrfc.math.vectorcalc.line_intersection(point_a1, point_a2, point_b1, point_b2)
ntrfc.math.vectorcalc.lineseg_dist(p, a, b)
Parameters:
  • p – point

  • a – line point a

  • b – line point b

Returns:

distance

ntrfc.math.vectorcalc.posVec(vec)
ntrfc.math.vectorcalc.randomOrthMat()
ntrfc.math.vectorcalc.randomUnitVec()

tested method to generate a random unit vector :return:

ntrfc.math.vectorcalc.symToMatrix(symTensor)

tested translates symmetric tensor notation to complete matrix :param symTensor: :return:

ntrfc.math.vectorcalc.unitvec(vec)
ntrfc.math.vectorcalc.unitvec_list(vecs)
ntrfc.math.vectorcalc.vecAbs(vec)

method to calculate the absolute value of a vector :param vec: :return:

ntrfc.math.vectorcalc.vecAbs_list(vecs)

method to calculate the absolute value of a vector :param np.array vec with shape (n,3): :return: array of magnitudes in shape (n)

ntrfc.math.vectorcalc.vecAngle(vec1, vec2)

Returns the angle in radians between vectors ‘v1’ and ‘v2’:

angle_between((1, 0, 0), (0, 1, 0))

1.5707963267948966

angle_between((1, 0, 0), (1, 0, 0))

0.0

angle_between((1, 0, 0), (-1, 0, 0))

3.141592653589793

ntrfc.math.vectorcalc.vecDir(vec)

tested method to compute the direction of a vector :param vec: :return: unit vec

ntrfc.math.vectorcalc.vecProjection(direction, vector)

Calculate the projection of a vector onto a direction vector.

Parameters: direction (list or numpy array): The direction vector onto which the projection will be calculated. vector (list or numpy array): The vector to be projected onto the direction vector.

Returns: projection (numpy array): A vector representing the projection of the input vector onto the direction vector.

Module contents