def spatial_hash(coordinates): import scipy, scipy.spatial try: from scipy.spatial import cKDTree as shash except: from scipy.spatial import KDTree as shash return shash(coordinates)
def spatial_hashes(coordinates, sigma_bins): import scipy, scipy.spatial try: from scipy.spatial import cKDTree as shash except: from scipy.spatial import KDTree as shash return tuple([shash(coordinates[ii]) for ii in sigma_bins])