我正在尝试运行以下代码。我在python路径中有一个Mrc.py。我正在正确导入它。我仍然遇到错误。我正在jupyter笔记本中运行它。谁能告诉我我要去哪里错了?
import numpy
import mrc
a= Mrc.bindFile('/home/deep-image-prior/data /Falcon_2015_05_14-20_42_18.mrc')
# a is a NumPy array with the image data memory mapped from
# somefile.mrc. You can use it directly with any function
# that will take a NumPy array.
hist = numpy.histogram(a, bins=200)
# a.Mrc is an instances of the Mrc class.
# you can do with that class is print out key information from the header.
a.Mrc.info()
# Use a.Mrc.hdr to access the MRC header fields.
wavelength0_nm = a.Mrc.hdr.wave[0]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/Mrc.py in makeHdrArray(buffer)
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-6-36b7bf8a3846> in <module>()
1 import numpy
2 import mrc
----> 3 a = Mrc.bindFile('/home/smitha/deep-image-prior/data/Falcon_2015_05_14-20_42_18.mrc')
4 # a is a NumPy array with the image data memory mapped from
5 # somefile.mrc. You can use it directly with any function
~/anaconda3/lib/python3.6/site-packages/Mrc.py in bindFile(fn, writable)
12 if writable:
13 mode = 'r+'
---> 14 a = Mrc(fn, mode)
15
16 return a.data_withMrc()
~/anaconda3/lib/python3.6/site-packages/Mrc.py in __init__(self, path, mode, extHdrSize, extHdrNints, extHdrNfloats)
52 #20060818 self._hdrArray = makeHdrArray(self.h)
53 #20060818 self.hdr = implement_hdr( self._hdrArray )
---> 54 self.hdr = makeHdrArray(self.h)
55
56 nzBeforeByteOrder = self.hdr.Num[0]
~/anaconda3/lib/python3.6/site-packages/Mrc.py in makeHdrArray(buffer)
801 h.dtype = mrcHdr_dtype
802 except:
--> 803 if len(h) != N.dtype(mrcHdr_dtype).itemsize: #1024
804 raise ValueError("header buffer should be of size %d, but %d bytes given" %(
805 N.dtype(mrcHdr_dtype).itemsize, len(h)))
TypeError: data type not understood