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'
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')