sandy.functions module
- sandy.functions.contains(item, xmin, xmax)
Check if item is included in a given domain.
- Inputs:
- item :
(scalar or iterable) x-value(s) to check
- xmin :
(scalar) lower bound of the domain
- xmax :
(scalar) upper bound of the domain
- Outputs:
- mask:
(boolean array/scalar) True if item is included, otherwise False
- sandy.functions.div0(a, b, value=0)
Ignore division by zero.
- Inputs:
- a :
(array or scalar) numerator
- b :
(array or scalar) denominator
- value :
(scalar) standard replacer when division by zero is found (default is zero)
- Outputs:
- c :
(array or scalar) a/b
..Example:
div0( [-1, 0, 1], 0 ) -> [0, 0, 0]
- sandy.functions.find_nearest(my_array, my_value, opt='below')
Find the nearest value in an array.
- sandy.functions.gls(x, Cx, G, y, Cy)
Run GLS adjustment.
- sandy.functions.isnum(item, rais=True)
Return true if input item is a scalar number, otherwise false. Raise error if input rais is true.
- sandy.functions.log10(x, value=0)
Ignore division by zero.
- Inputs:
- a :
numerator
- b :
denominator
- value :
standard replacer when division by zero is found
- Outputs:
c: a/b
..Example:
div0( [-1, 0, 1], 0 ) -> [0, 0, 0]
- sandy.functions.printProgress(iteration, total, prefix='', suffix='', decimals=1, barLength=100)
Call in a loop to create terminal progress bar @params:
iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : prefix string (Str) suffix - Optional : suffix string (Str) decimals - Optional : positive number of decimals in percent complete (Int) barLength - Optional : character length of bar (Int)
- sandy.functions.split_by_n(seq, n)
- sandy.functions.uniform_loggrid(xmin, xmax, npoints=100)
Given lower and upper limits, produce a grid with a number of points npoints that define equivalent intervals in log scale.
- Parameters:
- xminfloat
lower bound of the grid structure
- xmaxfloat
upper bound of the grid structure
- npointsint, optional, default 100
- Returns:
- numpy array
grid equally spaced in logarithmic scale
- sandy.functions.union_grid(*xgrids)
Return union grid from a list of grids.
- Inputs:
xgrids
:: (list) input grids
- Outputs:
ug
:: (
records.Grid
instance) sorted union grid in 1D-array
- sandy.functions.zero_interp(xx_old, arr, xx_new)
Reshape array on its first dimension by using zero interpolation. If some x-values of the new grid exceed the bounds of the old grid, set the corresponing interpolated array to zero in those positions.
- Inputs:
- xx_old :
old array of tabulated x-values.
- xx_new :
new array of tabulated x-values.
- Outputs:
- arr_new :
array reshaped according to xx_new.
- sandy.functions.zero_interp_1d(xx_old, arr, xx_new)
Reshape array on its first dimension by using zero interpolation. If some x-values of the new grid exceed the bounds of the old grid, set the corresponing interpolated array to zero in those positions.
- Inputs:
- xx_old :
old array of tabulated x-values.
- xx_new :
new array of tabulated x-values.
- Outputs:
- arr_new :
array reshaped according to xx_new.
- sandy.functions.zero_interp_2d(xx_old, arr, xx_new)
Reshape array on its first dimension by using zero interpolation. If some x-values of the new grid exceed the bounds of the old grid, set the corresponing interpolated array to zero in those positions.
- Inputs:
- xx_old :
old array of tabulated x-values.
- xx_new :
new array of tabulated x-values.
- Outputs:
- arr_new :
array reshaped according to xx_new.