Example #1
0
 def test_load_ser_reader_old_new_format(self):
     # test TIA old format
     fname0 = os.path.join(self.dirpathold,
                           '64x64_TEM_images_acquire_1.ser')
     header0, data0 = load_ser_file(fname0)
     assert header0['SeriesVersion'] == 528
     # test TIA new format
     fname1 = os.path.join(self.dirpathnew,
                           '128x128_TEM_acquire-sum1_1.ser')
     header1, data1 = load_ser_file(fname1)
     assert header1['SeriesVersion'] == 544
Example #2
0
 def test_load_ser_reader_old_new_format(self):
     # test TIA old format
     fname0 = os.path.join(
         self.dirpathold, '64x64_TEM_images_acquire_1.ser')
     header0, data0 = load_ser_file(fname0)
     nt.assert_equal(header0['SeriesVersion'], 528)
     # test TIA new format
     fname1 = os.path.join(
         self.dirpathnew, '128x128_TEM_acquire-sum1_1.ser')
     header1, data1 = load_ser_file(fname1)
     nt.assert_equal(header1['SeriesVersion'], 544)
Example #3
0
    def test_guess_units_from_mode(self):
        from hyperspy.io_plugins.fei import _guess_units_from_mode, \
            convert_xml_to_dict, get_xml_info_from_emi
        fname0_emi = os.path.join(self.dirpathold,
                                  '64x64_TEM_images_acquire.emi')
        fname0_ser = os.path.join(self.dirpathold,
                                  '64x64_TEM_images_acquire_1.ser')
        objects = get_xml_info_from_emi(fname0_emi)
        header0, data0 = load_ser_file(fname0_ser)
        objects_dict = convert_xml_to_dict(objects[0])

        unit = _guess_units_from_mode(objects_dict, header0)
        assert unit == 'meters'

        # objects is empty dictionary
        with assert_warns(
                message="The navigation axes units could not be determined.",
                category=UserWarning):
            unit = _guess_units_from_mode({}, header0)
        assert unit == 'meters'
Example #4
0
    def test_guess_units_from_mode(self):
        from hyperspy.io_plugins.fei import _guess_units_from_mode, \
            convert_xml_to_dict, get_xml_info_from_emi
        fname0_emi = os.path.join(
            self.dirpathold, '64x64_TEM_images_acquire.emi')
        fname0_ser = os.path.join(
            self.dirpathold, '64x64_TEM_images_acquire_1.ser')
        objects = get_xml_info_from_emi(fname0_emi)
        header0, data0 = load_ser_file(fname0_ser)
        objects_dict = convert_xml_to_dict(objects[0])

        unit = _guess_units_from_mode(objects_dict, header0)
        nt.assert_equal(unit, 'meters')

        # objects is empty dictionary
        with assert_warns(
                message="The navigation axes units could not be determined.",
                category=UserWarning):
            unit = _guess_units_from_mode({}, header0)
        nt.assert_equal(unit, 'meters')