36e8a554066d4d0b05923f7d0d7f43d4dbfb664d,hyperspy/tests/io/test_tiff.py,,test_read_unit_from_DM_stack,#Any#,97

Before Change


    nt.assert_almost_equal(s.axes_manager[0].scale, 2.5, places=5)
    nt.assert_almost_equal(s.axes_manager[1].scale, 0.16867, places=5)
    nt.assert_almost_equal(s.axes_manager[2].scale, 1.68674, places=5)
    fname2 = fname.replace("DM_stack.tif", "DM_stack2.tif")
    s.save(fname2, overwrite=True)
    s2 = hs.load(fname2)
    _compare_signal_shape_data(s, s2)
    nt.assert_equal(s2.axes_manager[0].units, s.axes_manager[0].units)
    nt.assert_equal(s2.axes_manager[1].units, "micron")
    nt.assert_equal(s2.axes_manager[2].units, "micron")
    nt.assert_almost_equal(s2.axes_manager[0].scale, s.axes_manager[0].scale,
                           places=5)
    nt.assert_almost_equal(s2.axes_manager[1].scale, s.axes_manager[1].scale,
                           places=5)
    nt.assert_almost_equal(s2.axes_manager[2].scale, s.axes_manager[2].scale,
                           places=5)
    nt.assert_almost_equal(s2.axes_manager[0].offset, s.axes_manager[0].offset,
                           places=5)
    nt.assert_almost_equal(s2.axes_manager[1].offset, s.axes_manager[1].offset,
                           places=5)
    nt.assert_almost_equal(s2.axes_manager[2].offset, s.axes_manager[2].offset,
                           places=5)
    if remove_files:
        os.remove(fname2)    

    
def test_read_unit_from_imagej_stack_no_scale(import_local_tifffile=False):
    fname = os.path.join(my_path, "tiff_files",
        "test_loading_image_saved_with_imageJ_stack_no_scale.tif")
    s = hs.load(fname, import_local_tifffile=import_local_tifffile)

After Change


    nt.assert_almost_equal(s.axes_manager[0].scale, 2.5, places=5)
    nt.assert_almost_equal(s.axes_manager[1].scale, 0.16867, places=5)
    nt.assert_almost_equal(s.axes_manager[2].scale, 1.68674, places=5)
    with tempfile.TemporaryDirectory() as tmpdir:
        fname2 = os.path.join(
            tmpdir, "test_loading_image_saved_with_DM_stack2.tif")
        s.save(fname2, overwrite=True)
        s2 = hs.load(fname2)
        _compare_signal_shape_data(s, s2)
        nt.assert_equal(s2.axes_manager[0].units, s.axes_manager[0].units)
        nt.assert_equal(s2.axes_manager[1].units, "micron")
        nt.assert_equal(s2.axes_manager[2].units, "micron")
        nt.assert_almost_equal(
            s2.axes_manager[0].scale, s.axes_manager[0].scale, places=5)
        nt.assert_almost_equal(
            s2.axes_manager[1].scale, s.axes_manager[1].scale, places=5)
        nt.assert_almost_equal(
            s2.axes_manager[2].scale, s.axes_manager[2].scale, places=5)
        nt.assert_almost_equal(
            s2.axes_manager[0].offset, s.axes_manager[0].offset, places=5)
        nt.assert_almost_equal(
            s2.axes_manager[1].offset, s.axes_manager[1].offset, places=5)
        nt.assert_almost_equal(
            s2.axes_manager[2].offset, s.axes_manager[2].offset, places=5)


def test_read_unit_from_imagej_stack_no_scale(import_local_tifffile=False):
    fname = os.path.join(MY_PATH, "tiff_files",
                         "test_loading_image_saved_with_imageJ_stack_no_scale.tif")
    s = hs.load(fname, import_local_tifffile=import_local_tifffile)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 16

Instances


Project Name: hyperspy/hyperspy
Commit Name: 36e8a554066d4d0b05923f7d0d7f43d4dbfb664d
Time: 2016-07-26
Author: frandelapena@gmail.com
File Name: hyperspy/tests/io/test_tiff.py
Class Name:
Method Name: test_read_unit_from_DM_stack


Project Name: hyperspy/hyperspy
Commit Name: 36e8a554066d4d0b05923f7d0d7f43d4dbfb664d
Time: 2016-07-26
Author: frandelapena@gmail.com
File Name: hyperspy/tests/io/test_tiff.py
Class Name:
Method Name: test_read_unit_from_DM_stack


Project Name: hyperspy/hyperspy
Commit Name: 36e8a554066d4d0b05923f7d0d7f43d4dbfb664d
Time: 2016-07-26
Author: frandelapena@gmail.com
File Name: hyperspy/tests/io/test_tiff.py
Class Name:
Method Name: test_write_read_unit_imagej


Project Name: hyperspy/hyperspy
Commit Name: 36e8a554066d4d0b05923f7d0d7f43d4dbfb664d
Time: 2016-07-26
Author: frandelapena@gmail.com
File Name: hyperspy/tests/io/test_tiff.py
Class Name:
Method Name: test_write_read_unit_imagej_with_description


Project Name: hyperspy/hyperspy
Commit Name: 36e8a554066d4d0b05923f7d0d7f43d4dbfb664d
Time: 2016-07-26
Author: frandelapena@gmail.com
File Name: hyperspy/tests/io/test_tiff.py
Class Name:
Method Name: _test_read_unit_from_dm