Numerics Module#
- nexus.numerics.morse_fit(r, E, p0=None, jackknife=False, cost=<function least_squares>, auxfuncs=None, auxres=None, capture=None)[source]#
- nexus.numerics.morse_fit_fine(r, E, p0=None, rfine=None, both=False, jackknife=False, cost=<function least_squares>, capture=None)[source]#
- nexus.numerics.eos_fit(V, E, type='vinet', p0=None, cost='least_squares', jackknife=False, auxfuncs=None, auxres=None, capture=None)[source]#
- nexus.numerics.jackknife(data, function, args=None, kwargs=None, position=None, capture=None)[source]#
- nexus.numerics.numerics_jackknife(data, function, args=None, kwargs=None, position=None, capture=None)#
- nexus.numerics.jackknife_aux(jsamples, auxfunc, args=None, kwargs=None, position=None, capture=None)[source]#
- nexus.numerics.ndgrid(*args, **kwargs)[source]#
n-dimensional gridding like Matlab’s NDGRID
- Parameters:
- *args
An arbitrary number of numerical sequences, e.g. lists, arrays, or tuples.
The i-th dimension of the i-th output argument has copies of the i-th input argument.
- same_dtypebool,
defaultFalse,kwargs If False (default), the result is an
ndarray.If True, the result is a lists of
ndarrays, possibly with different dtype. This can save space if some*argshave a smaller dtype than others.
Examples
Typical usage
>>> x, y, z = [0, 1], [2, 3, 4], [5, 6, 7, 8] >>> X, Y, Z = ndgrid(x, y, z) # unpacking the returned ndarray into X, Y, Z
Each of X, Y, Z has shape [len(v) for v in x, y, z].
>>> X.shape == Y.shape == Z.shape == (2, 3, 4) True >>> X array([[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]]) >>> Y array([[[2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4]], [[2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4]]]) >>> Z array([[[5, 6, 7, 8], [5, 6, 7, 8], [5, 6, 7, 8]], [[5, 6, 7, 8], [5, 6, 7, 8], [5, 6, 7, 8]]])
With an unpacked argument list:
>>> V = [[0, 1], [2, 3, 4]] >>> ndgrid(*V) # an array of two arrays with shape (2, 3) array([[[0, 0, 0], [1, 1, 1]], [[2, 3, 4], [2, 3, 4]]])
For input vectors of different data types, same_dtype=False makes ndgrid() return a list of arrays with the respective dtype.
>>> ndgrid([0, 1], [1.0, 1.1, 1.2], same_dtype=False) [array([[0, 0, 0], [1, 1, 1]]), array([[ 1. , 1.1, 1.2], [ 1. , 1.1, 1.2]])]
Default is to return a single array.
>>> ndgrid([0, 1], [1.0, 1.1, 1.2]) array([[[ 0. , 0. , 0. ], [ 1. , 1. , 1. ]], [[ 1. , 1.1, 1.2], [ 1. , 1.1, 1.2]]])
- nexus.numerics.equilibration_length(x, tail=0.5, plot=False, xlim=None, bounces=2, random=True, seed_from_hash=True)[source]#
- nexus.numerics.nearest_neighbors(n, points, qpoints=None, return_distances=False, slow=False)[source]#