def test_detect_fail(): executor = InlineJobExecutor() # does not exist: assert not EMPADDataSet.detect_params("/does/not/exist.raw", executor=executor) # exists but we can't detect any parameters (and we don't know if it even is an EMPAD file) assert not EMPADDataSet.detect_params(EMPAD_RAW, executor=executor)
def default_empad(): executor = InlineJobExecutor() ds = EMPADDataSet( path=EMPAD_XML, ) ds = ds.initialize(executor) yield ds
def test_nonexistent(): ds = EMPADDataSet( path="/does/not/exist.raw", scan_size=(4, 4), ) with pytest.raises(DataSetException) as einfo: ds = ds.initialize(InlineJobExecutor()) assert einfo.match("No such file or directory")
def test_nonexistent(): ds = EMPADDataSet( path="/does/not/exist.raw", scan_size=(4, 4), ) with pytest.raises(DataSetException) as e: ds = ds.initialize() assert "No such file or directory" in str(e)
def test_nonexistent(): ds = EMPADDataSet( path="/does/not/exist.raw", nav_shape=(4, 4), ) with pytest.raises(DataSetException) as einfo: ds = ds.initialize(InlineJobExecutor()) assert einfo.match("could not open file /does/not/exist.raw")
def test_invalid_size(): ds = EMPADDataSet( path=EMPAD_RAW, scan_size=(4, 5), ) ds = ds.initialize() with pytest.raises(DataSetException) as e: ds.check_valid() assert "invalid filesize" in str(e)
def test_invalid_size(): ds = EMPADDataSet( path=EMPAD_RAW, scan_size=(4, 5), ) ds = ds.initialize(InlineJobExecutor()) with pytest.raises(DataSetException) as einfo: ds.check_valid() assert einfo.match("invalid filesize")
def random_empad(tmpdir_factory): datadir = tmpdir_factory.mktemp('data') filename = datadir + '/empad-test-default.raw' data = _mk_random(size=(16, 16, 130, 128), dtype='float32') data.tofile(str(filename)) del data ds = EMPADDataSet( path=str(filename), scan_size=(16, 16), ) ds = ds.initialize() yield ds
def test_empad_dist(dist_ctx): ds = EMPADDataSet(path="/data/EMPAD/acquisition_12_pretty.xml") ds = ds.initialize(dist_ctx.executor) analysis = dist_ctx.create_sum_analysis(dataset=ds) results = dist_ctx.run(analysis) assert results[0].raw_data.shape == (128, 128)
def default_empad(): ds = EMPADDataSet(path=EMPAD_XML, ) ds = ds.initialize() yield ds
def test_detect_fail(): # does not exist: assert not EMPADDataSet.detect_params("/does/not/exist.raw") # exists but we can't detect any parameters (and we don't know if it even is an EMPAD file) assert not EMPADDataSet.detect_params(EMPAD_RAW)
def test_new_empad_xml(): executor = InlineJobExecutor() ds = EMPADDataSet(path=EMPAD_XML_2, ) ds = ds.initialize(executor)
def test_empad_dist(dist_ctx): ds = EMPADDataSet(path=EMPAD_XML) ds = ds.initialize(dist_ctx.executor) analysis = dist_ctx.create_sum_analysis(dataset=ds) results = dist_ctx.run(analysis) assert results[0].raw_data.shape == (128, 128)