Esempio n. 1
0
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)
Esempio n. 2
0
def default_empad():
    executor = InlineJobExecutor()
    ds = EMPADDataSet(
        path=EMPAD_XML,
    )
    ds = ds.initialize(executor)
    yield ds
Esempio n. 3
0
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")
Esempio n. 4
0
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)
Esempio n. 5
0
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")
Esempio n. 6
0
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)
Esempio n. 7
0
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")
Esempio n. 8
0
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
Esempio n. 9
0
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)
Esempio n. 10
0
def default_empad():
    ds = EMPADDataSet(path=EMPAD_XML, )
    ds = ds.initialize()
    yield ds
Esempio n. 11
0
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)
Esempio n. 12
0
def test_new_empad_xml():
    executor = InlineJobExecutor()
    ds = EMPADDataSet(path=EMPAD_XML_2, )
    ds = ds.initialize(executor)
Esempio n. 13
0
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)