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()
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'
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'