def tst_getters(self): from math import sqrt from dials.algorithms.profile_model.modeller import CircleSampler width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = CircleSampler((width, height), scan_range, nz) image_size = sampler.image_size() scan_range = sampler.scan_range() image_centre = sampler.image_centre() r0 = sampler.r0() r1 = sampler.r1() r2 = sampler.r2() size = len(sampler) assert(width == image_size[0]) assert(height == image_size[1]) assert(width // 2 == image_centre[0]) assert(height // 2 == image_centre[1]) assert(r0 == min([width // 2, height // 2])) assert(r1 == r0 / 3.0) assert(r2 == r1 * sqrt(5.0)) assert(9 * nz == size) print 'OK'
def tst_getters(self): from math import sqrt from dials.algorithms.profile_model.modeller import CircleSampler width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 2 sampler = CircleSampler((width, height), scan_range, nz) image_size = sampler.image_size() scan_range = sampler.scan_range() image_centre = sampler.image_centre() r0 = sampler.r0() r1 = sampler.r1() r2 = sampler.r2() size = len(sampler) assert (width == image_size[0]) assert (height == image_size[1]) assert (width // 2 == image_centre[0]) assert (height // 2 == image_centre[1]) assert (r0 == min([width // 2, height // 2])) assert (r1 == r0 / 3.0) assert (r2 == r1 * sqrt(5.0)) assert (9 * nz == size) print 'OK'
def tst_weights(self): from dials.algorithms.profile_model.modeller import CircleSampler from math import exp, log from scitbx import matrix width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 1 sampler = CircleSampler((width, height), scan_range, nz) # Check the weight at the coord in 1.0 eps = 1e-7 for i in range(len(sampler)): coord = sampler.coord(i) weight = sampler.weight(i, 0, coord) assert(abs(weight - 1.0) < eps) r0 = sampler.r0() r1 = sampler.r1() r2 = sampler.r2() r = r2 / (2.0*r1) expected = exp(-4.0*r*r*log(2.0)) for i in range(1, 9): coord = sampler.coord(i) weight = sampler.weight(0, 0, coord) assert(abs(weight - expected) < eps) r = r2 / (2.0*(r2 - r1)) expected = exp(-4.0*r*r*log(2.0)) for i in range(1, 9): coord = sampler.coord(0) weight = sampler.weight(i, 0, coord) assert(abs(weight - expected) < eps) for i in range(1, 9): coord1 = matrix.col(sampler.coord(0)) coord2 = matrix.col(sampler.coord(i)) coord = coord1 + r1 * (coord2 - coord1) / r2 weight = sampler.weight(0, 0, coord) assert(abs(weight - 0.5) < eps) weight = sampler.weight(i, 0, coord) assert(abs(weight - 0.5) < eps) print 'OK'
def tst_weights(self): from dials.algorithms.profile_model.modeller import CircleSampler from math import exp, log from scitbx import matrix width = 1000 height = 1000 scan_range = (2, 12) depth = scan_range[1] - scan_range[0] nz = 1 sampler = CircleSampler((width, height), scan_range, nz) # Check the weight at the coord in 1.0 eps = 1e-7 for i in range(len(sampler)): coord = sampler.coord(i) weight = sampler.weight(i, coord) assert (abs(weight - 1.0) < eps) r0 = sampler.r0() r1 = sampler.r1() r2 = sampler.r2() r = r2 / (2.0 * r1) expected = exp(-4.0 * r * r * log(2.0)) for i in range(1, 9): coord = sampler.coord(i) weight = sampler.weight(0, coord) assert (abs(weight - expected) < eps) r = r2 / (2.0 * (r2 - r1)) expected = exp(-4.0 * r * r * log(2.0)) for i in range(1, 9): coord = sampler.coord(0) weight = sampler.weight(i, coord) assert (abs(weight - expected) < eps) for i in range(1, 9): coord1 = matrix.col(sampler.coord(0)) coord2 = matrix.col(sampler.coord(i)) coord = coord1 + r1 * (coord2 - coord1) / r2 weight = sampler.weight(0, coord) assert (abs(weight - 0.5) < eps) weight = sampler.weight(i, coord) assert (abs(weight - 0.5) < eps) print 'OK'
def test_getters(): from dials.algorithms.profile_model.modeller import CircleSampler width = 1000 height = 1000 scan_range = (2, 12) nz = 2 sampler = CircleSampler((width, height), scan_range, nz) image_size = sampler.image_size() image_centre = sampler.image_centre() r0 = sampler.r0() r1 = sampler.r1() r2 = sampler.r2() size = len(sampler) assert width == image_size[0] assert height == image_size[1] assert width // 2 == image_centre[0] assert height // 2 == image_centre[1] assert r0 == min([width // 2, height // 2]) assert r1 == r0 / 3.0 assert r2 == r1 * math.sqrt(5.0) assert 9 * nz == size