示例#1
0
def test_write_fresh(save_path):
    signal = hs.signals.Signal2D((255 * np.random.rand(10, 3, 5, 5)
                                  ).astype(np.uint8))
    signal.save(save_path, overwrite=True)
    sig_reload = hs.load(save_path)
    np.testing.assert_equal(signal.data, sig_reload.data)
    header = sarray2dict(get_default_header())
    header.update({
        'NX': 3, 'NY': 10,
        'DP_SZ': 5,
        'SX': 1, 'SY': 1,
        'SDP': 100,
        'Data_offset_2': 10 * 3 + header['Data_offset_1'],
        'Note': '',
    })
    header['Data_offset_2'] += header['Data_offset_2'] % 16
    assert (
        sig_reload.original_metadata.blockfile_header.as_dictionary() ==
        header)
示例#2
0
def test_write_fresh(save_path):
    signal = hs.signals.Signal2D((255 * np.random.rand(10, 3, 5, 5)
                                  ).astype(np.uint8))
    signal.save(save_path, overwrite=True)
    sig_reload = hs.load(save_path)
    np.testing.assert_equal(signal.data, sig_reload.data)
    header = sarray2dict(get_default_header())
    header.update({
        'NX': 3, 'NY': 10,
        'DP_SZ': 5,
        'SX': 1, 'SY': 1,
        'SDP': 100,
        'Data_offset_2': 10 * 3 + header['Data_offset_1'],
        'Note': '',
    })
    header['Data_offset_2'] += header['Data_offset_2'] % 16
    assert (
        sig_reload.original_metadata.blockfile_header.as_dictionary() ==
        header)
示例#3
0
def test_write_fresh(save_path):
    signal = hs.signals.Signal2D(
        (255 * np.random.rand(10, 3, 5, 5)).astype(np.uint8))
    signal.save(save_path, overwrite=True)
    sig_reload = hs.load(save_path)
    np.testing.assert_equal(signal.data, sig_reload.data)
    header = sarray2dict(get_default_header())
    header.update({
        "NX": 3,
        "NY": 10,
        "DP_SZ": 5,
        "SX": 1,
        "SY": 1,
        "SDP": 100,
        "Data_offset_2": 10 * 3 + header["Data_offset_1"],
        "Note": "",
    })
    header["Data_offset_2"] += header["Data_offset_2"] % 16
    assert sig_reload.original_metadata.blockfile_header.as_dictionary(
    ) == header
示例#4
0
def test_default_header():
    # Simply check that no exceptions are raised
    header = get_default_header()
    assert header is not None
示例#5
0
def test_default_header():
    # Simply check that no exceptions are raised
    header = get_default_header()
    nt.assert_is_not_none(header)
示例#6
0
def test_default_header():
    # Simply check that no exceptions are raised
    header = get_default_header()
    nt.assert_is_not_none(header)
示例#7
0
def test_default_header():
    # Simply check that no exceptions are raised
    header = get_default_header()
    assert header is not None