rebin#
- diffsims.utils.discretise_utils.rebin(x, loc, r, k, mem)[source]#
Bins each location into a grid subject to memory constraints.
- Parameters:
x (list [np.ndarray [float]], of shape [(nx,), (ny,), ...]) – Dictates the range of the box over which to bin atoms.
loc (np.ndarray, (n, 3)) – Atoms to bin.
r (float or [float, float, float]) – Mesh size (in each direction).
k (int) – Integer such that the radius of the atom is <= k*r. Consequently, each atom will appear in approximately 8k^3 bins.
mem (int) – Upper limit of number of bytes permitted for mesh. If not possible then raises a MemoryError.
- Returns:
subList – subList[i0,i1,i2] is a list of indices [j0, j1, …, jn, -1,…] such that the only atoms which are contained in the box: [x[0].min()+i0*r,x[0].min(),+(i0+1)*r] x [x[1].min()+i1*r,x[1].min(),+(i1+1)*r]… are the atoms with locations loc[j0], …, loc[jn].
- Return type:
np.ndarray [int]