예제 #1
0
  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'
예제 #2
0
    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'
예제 #3
0
def test_pickle():
    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)

    sampler2 = pickle.loads(pickle.dumps(sampler))

    assert sampler.image_size() == sampler2.image_size()
    assert sampler.num_z() == sampler2.num_z()
예제 #4
0
  def tst_pickle(self):
    from dials.algorithms.profile_model.modeller import CircleSampler
    import tempfile
    import cPickle as pickle
    width = 1000
    height = 1000
    scan_range = (2, 12)
    depth = scan_range[1] - scan_range[0]
    nz = 2
    sampler = CircleSampler((width, height), scan_range, nz)

    tf = tempfile.TemporaryFile()
    pickle.dump(sampler, tf)
    tf.flush()
    tf.seek(0)
    sampler2 = pickle.load(tf)

    assert(sampler.image_size() == sampler2.image_size())
    assert(sampler.num_z() == sampler2.num_z())

    print 'OK'
예제 #5
0
    def tst_pickle(self):
        from dials.algorithms.profile_model.modeller import CircleSampler
        import tempfile
        import cPickle as pickle
        width = 1000
        height = 1000
        scan_range = (2, 12)
        depth = scan_range[1] - scan_range[0]
        nz = 2
        sampler = CircleSampler((width, height), scan_range, nz)

        tf = tempfile.TemporaryFile()
        pickle.dump(sampler, tf)
        tf.flush()
        tf.seek(0)
        sampler2 = pickle.load(tf)

        assert (sampler.image_size() == sampler2.image_size())
        assert (sampler.num_z() == sampler2.num_z())

        print 'OK'
예제 #6
0
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