def tst_scan(self): from dxtbx.model import Scan, ScanFactory from scitbx.array_family import flex s1 = Scan((1, 3), (1.0, 0.2), flex.double([0.1, 0.1, 0.1]), flex.double([0.1, 0.2, 0.3])) d = s1.to_dict() s2 = ScanFactory.from_dict(d) assert (d['image_range'] == (1, 3)) assert (d['oscillation'] == (1.0, 0.2)) assert (d['exposure_time'] == [0.1, 0.1, 0.1]) assert (d['epochs'] == [0.1, 0.2, 0.3]) assert (s1 == s2) # Test with a template and partial dictionary d2 = {'exposure_time': [0.2, 0.2, 0.2]} s3 = ScanFactory.from_dict(d2, d) assert (s3.get_image_range() == (1, 3)) assert (s3.get_oscillation() == (1.0, 0.2)) assert (list(s3.get_exposure_times()) == [0.2, 0.2, 0.2]) assert (list(s3.get_epochs()) == [0.1, 0.2, 0.3]) assert (s2 != s3) # Test with a partial epoch d3 = {'image_range': (1, 10), 'epochs': [0.1, 0.2]} s4 = ScanFactory.from_dict(d3, d) assert (abs(s4.get_epochs()[2] - 0.3) < 1e-7) assert (abs(s4.get_epochs()[9] - 1.0) < 1e-7) print 'OK'
def test_scan(): from dxtbx.model import Scan from scitbx.array_family import flex s1 = Scan(image_range=(1, 20), oscillation=(5.0, 0.1), exposure_times=flex.double(range(20)), epochs=flex.double(range(20, 40))) d = s1.to_dict() s2 = Scan.from_dict(d) assert s1 == s2
def test_scan(): s1 = Scan( image_range=(1, 20), oscillation=(5.0, 0.1), exposure_times=flex.double(range(20)), epochs=flex.double(range(20, 40)), ) s1.set_valid_image_ranges("0", [(1, 20)]) d = s1.to_dict() s2 = Scan.from_dict(d) assert s1 == s2
def __call__(self): from dxtbx.model import Scan from scitbx.array_family import flex s1 = Scan( image_range=(1, 20), oscillation=(5.0, 0.1), exposure_times=flex.double(range(20)), epochs=flex.double(range(20,40))) d = s1.to_dict() s2 = Scan.from_dict(d) assert(s1 == s2) print 'OK'
def test_scan(): from dxtbx.model import Scan, ScanFactory from scitbx.array_family import flex s1 = Scan((1, 3), (1.0, 0.2), flex.double([0.1, 0.1, 0.1]), flex.double([0.1, 0.2, 0.3]), 0) d = s1.to_dict() s2 = ScanFactory.from_dict(d) assert d['image_range'] == (1, 3) assert d['oscillation'] == (1.0, 0.2) assert d['exposure_time'] == [0.1, 0.1, 0.1] assert d['epochs'] == [0.1, 0.2, 0.3] assert d['batch_offset'] == 0 assert s1 == s2 # Test with a template and partial dictionary d2 = {'exposure_time': [0.2, 0.2, 0.2]} s3 = ScanFactory.from_dict(d2, d) assert s3.get_image_range() == (1, 3) assert s3.get_oscillation() == (1.0, 0.2) assert list(s3.get_exposure_times()) == [0.2, 0.2, 0.2] assert list(s3.get_epochs()) == [0.1, 0.2, 0.3] assert s2 != s3 # Test with a partial epoch d3 = { 'image_range': (1, 10), 'epochs': [0.1, 0.2], } s4 = ScanFactory.from_dict(d3, d) assert s4.get_epochs()[2] == pytest.approx(0.3) assert s4.get_epochs()[9] == pytest.approx(1.0) d4 = {'batch_offset': 100} s5 = ScanFactory.from_dict(d4, d) assert s5.get_batch_offset() == 100 assert s5.get_batch_range() == (101, 103)
def test_scan(): s1 = Scan( (1, 3), (1.0, 0.2), flex.double([0.1, 0.1, 0.1]), flex.double([0.1, 0.2, 0.3]), 0, ) d = s1.to_dict() s2 = ScanFactory.from_dict(d) assert d["image_range"] == (1, 3) assert d["oscillation"] == (1.0, 0.2) assert d["exposure_time"] == [0.1, 0.1, 0.1] assert d["epochs"] == [0.1, 0.2, 0.3] assert d["batch_offset"] == 0 assert s1 == s2 # Test with a template and partial dictionary d2 = {"exposure_time": [0.2, 0.2, 0.2]} s3 = ScanFactory.from_dict(d2, d) assert s3.get_image_range() == (1, 3) assert s3.get_oscillation() == (1.0, 0.2) assert list(s3.get_exposure_times()) == [0.2, 0.2, 0.2] assert list(s3.get_epochs()) == [0.1, 0.2, 0.3] assert s2 != s3 # Test with a partial epoch d3 = {"image_range": (1, 10), "epochs": [0.1, 0.2]} s4 = ScanFactory.from_dict(d3, d) assert s4.get_epochs()[2] == pytest.approx(0.3) assert s4.get_epochs()[9] == pytest.approx(1.0) d4 = {"batch_offset": 100} s5 = ScanFactory.from_dict(d4, d) assert s5.get_batch_offset() == 100 assert s5.get_batch_range() == (101, 103)