有人可以告诉我我要去哪里吗?这是我的代码以及出现的错误。 ps我已经正确给出了somefile.mrc路径。
import numpy
import Mrc
a = Mrc.bindFile('home/smitha/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. One thing
# you can do with that class is print out key information from the header.
a.Mrc.info()
wavelength0_nm = a.Mrc.hdr.wave[0]
AttributeError跟踪(最近的调用) 最后)在() 3 a = Mrc.bindFile('/ home / smitha / deep-image-prior / data / Falcon_2015_05_14-20_42_18.mrc') 4 hist = numpy.histogram(a,bins = 200) ----> 5 a.Mrc.info() 6个波长0_nm = a.Mrc.hdr.wave [0] 7
AttributeError:'NoneType'对象没有属性'Mrc'
答案 0 :(得分:0)
AttributeError: 'NoneType' object has no attribute 'Mrc'
意味着即使对象是'Mrc'
,您也要尝试访问该对象的NoneType
成员,因此该对象没有这样的成员。
您正在尝试在a.Mrc.info()
中这样做,这意味着a
是None
(NoneType
的唯一实例)。原因是
a = Mrc.bindFile('/home/smitha/deep-image-prior/data/Falcon_2015_05_14-20_42_18.mrc')
OR
hist = numpy.histogram(a, bins=200)
已将None
分配给a
。每行之后检查type(a)
,查看问题出在哪里,并调试函数