Math Tools

pydiana.tools.math_tools.calc_Chi2Mean(values, err_values)[source]
Function that compute the Chi2 of mean :

sum_i ( (values[i]-mean)/err_value[i] ) / (len(values)-1)

Parameters:
  • (array-like) (err_values) --

  • (array-like) --

Returns:

result (float)

Return type:

value of Chi2 of mean

pydiana.tools.math_tools.moving_average(x, w, keep_shape=False)[source]

Perform moving average :type x: :param x: :type x: 1D array or list of numbers that need to be averaged :type w: int :param w: :type w: number of points to consider in the moving average :type keep_shape: bool :param keep_shape: :type keep_shape: if true result array is extended of "w-1" values in order to return an array of the same size as x

Returns:

array with the moving average of x

pydiana.tools.math_tools.sortmultivec(*vecs, lead=0)[source]

Function for sorting multiple vectors with respect to one of the vectors provided

Parameters:
  • *vecs (all the vectors to be sorted) --

  • lead (Integer with the index of the vector with respect to which make the sorting (starting from 0).) --

Returns:

Matrix with the sorted vectors as rows