def test_self_consistent(): from dials.algorithms.profile_model.modeller import SingleSampler scan_range = (2, 12) nz = 2 sampler = SingleSampler(scan_range, nz) for i in range(len(sampler)): coord = sampler.coord(i) index = sampler.nearest(0, coord) assert index == i
def test_self_consistent(): from dials.algorithms.profile_model.modeller import SingleSampler width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = SingleSampler(scan_range, nz) for i in range(len(sampler)): coord = sampler.coord(i) index = sampler.nearest(0, coord) assert (index == i)
def tst_self_consistent(self): from dials.algorithms.profile_model.modeller import SingleSampler width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = SingleSampler(scan_range, nz) for i in range(len(sampler)): coord = sampler.coord(i) index = sampler.nearest(coord) assert(index == i) print 'OK'
def test_nearest(): from dials.algorithms.profile_model.modeller import SingleSampler scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = SingleSampler(scan_range, nz) for i in range(1000): x = random.uniform(0, 1000) y = random.uniform(0, 1000) z = random.uniform(*scan_range) k = int(math.floor((z - scan_range[0]) / (depth / nz))) if k >= nz: k = nz - 1 index0 = k index1 = sampler.nearest(0, (x, y, z)) assert index0 == index1
def tst_nearest(self): from random import uniform from dials.algorithms.profile_model.modeller import SingleSampler from math import floor width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = SingleSampler(scan_range, nz) for i in range(1000): x = uniform(0, 1000) y = uniform(0, 1000) z = uniform(*scan_range) k = int(floor((z-scan_range[0]) / (depth / nz))) if k >= nz: k = nz - 1 index0 = k index1 = sampler.nearest((x, y, z)) assert(index0 == index1) print 'OK'
def tst_nearest(self): from random import uniform from dials.algorithms.profile_model.modeller import SingleSampler from math import floor width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = SingleSampler(scan_range, nz) for i in range(1000): x = uniform(0, 1000) y = uniform(0, 1000) z = uniform(*scan_range) k = int(floor((z - scan_range[0]) / (depth / nz))) if k >= nz: k = nz - 1 index0 = k index1 = sampler.nearest(0, (x, y, z)) assert (index0 == index1) print 'OK'