Pytables安装问题

时间:2019-02-25 10:43:15

标签: pytables

我使用anaconda 3,spyder 3,环境python 2.7.15

我确保pytables网站中提到的所有必备软件包都已安装

但是,当我运行以下代码时,仍然出现以下错误:

import numpy
from tables import *
class Particle(IsDescription):
     name      = StringCol(16)   # 16-character String
     idnumber  = Int64Col()      # Signed 64-bit integer
     ADCcount  = UInt16Col()     # Unsigned short integer
     TDCcount  = UInt8Col()      # unsigned byte
     grid_i    = Int32Col()      # 32-bit integer
     grid_j    = Int32Col()      # 32-bit integer
     pressure  = Float32Col()    # float  (single-precision)
     energy    = Float64Col() 

h5file = open_file("tutorial1.h5", mode="w", title="Test file")

group = h5file.create_group("/", 'detector', 'Detector information')

table = h5file.create_table(group, 'readout', Particle, "Readout    example")

particle = table.row


for i in xrange(10):
     particle['name']  = 'Particle: %6d' % (i)
     particle['TDCcount'] = i % 256
     particle['ADCcount'] = (i * 256) % (1 << 16)
     particle['grid_i'] = i
     particle['grid_j'] = 10 - i
     particle['pressure'] = float(i*i)
     particle['energy'] = float(particle['pressure'] ** 4)
     particle['idnumber'] = i * (2 ** 34)
     # Insert a new particle record
     particle.append()


table.flush()

table = h5file.root.detector.readout
pressure = [x['pressure'] for x in table.iterrows() if x['TDCcount'] > 3       and 20 <= x['pressure'] < 50]
pressure
  

NameError:名称'IsDescription'未定义

0 个答案:

没有答案