ValueError:字段“ IFORM”出现多次

时间:2019-12-05 07:39:16

标签: python

我正在尝试使用HyperSpy库将“ .unf”文件加载到Jupyter环境中,但是出现此错误。

import hyperspy.api as hs
data = hs.load("/path/to/file/PRC.unf")

这是错误:

ValueError                                Traceback (most recent call last)
<ipython-input-7-b0117f505d01> in <module>
----> 1 data = hs.load("/home/vahid/PythonProjects/UNFfiles/PRC.unf")

~/PythonProjects/UNFfiles/venv/lib/python3.7/site-packages/hyperspy/io.py in load(filenames, signal_type, stack, stack_axis, new_axis_name, lazy, convert_units, **kwds)
    279             objects = [load_single_file(filename, lazy=lazy,
    280                                         **kwds)
--> 281                        for filename in filenames]
    282 
    283         if len(objects) == 1:

~/PythonProjects/UNFfiles/venv/lib/python3.7/site-packages/hyperspy/io.py in <listcomp>(.0)
    279             objects = [load_single_file(filename, lazy=lazy,
    280                                         **kwds)
--> 281                        for filename in filenames]
    282 
    283         if len(objects) == 1:

~/PythonProjects/UNFfiles/venv/lib/python3.7/site-packages/hyperspy/io.py in load_single_file(filename, **kwds)
    316     else:
    317         reader = io_plugins[i]
--> 318         return load_with_reader(filename=filename, reader=reader, **kwds)
    319 
    320 

~/PythonProjects/UNFfiles/venv/lib/python3.7/site-packages/hyperspy/io.py in load_with_reader(filename, reader, signal_type, convert_units, **kwds)
    323     lazy = kwds.get('lazy', False)
    324     file_data_list = reader.file_reader(filename,
--> 325                                         **kwds)
    326     objects = []
    327 

~/PythonProjects/UNFfiles/venv/lib/python3.7/site-packages/hyperspy/io_plugins/semper_unf.py in file_reader(filename, **kwds)
    703 def file_reader(filename, **kwds):
    704     lazy = kwds.get('lazy', False)
--> 705     semper = SemperFormat.load_from_unf(filename, lazy=lazy)
    706     semper.log_info()
    707     return [semper.to_signal(lazy=lazy)._to_dictionary()]

~/PythonProjects/UNFfiles/venv/lib/python3.7/site-packages/hyperspy/io_plugins/semper_unf.py in load_from_unf(cls, filename, lazy)
    386                     :rec_length //
    387                     2],
--> 388                 count=1)
    389             metadata.update(sarray2dict(header))
    390             assert np.frombuffer(f.read(4), dtype=np.int32)[0] == rec_length, \

**ValueError: field 'IFORM' occurs more than once**

我不确定该错误是什么。显然,“ IFORM”是这种类型的数据结构中的某种字典键。如果有人可以帮助我解决这个问题,我将不胜感激。

0 个答案:

没有答案