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