本文整理汇总了Python中pydal.dalDataset函数的典型用法代码示例。如果您正苦于以下问题:Python dalDataset函数的具体用法?Python dalDataset怎么用?Python dalDataset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dalDataset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dataset_createTable
def test_dataset_createTable(self):
ds = pydal.dalDataset("testfile.h5","HDF5")
tab = ds.createTable("table1")
tab = ds.createTable("table2")
tab = ds.createTable("table3")
ds.close()
self.assertEqual(type(tab),pydal.dalTable)
示例2: test_table_appendRow
def test_table_appendRow(self): # modifies table1
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
for x in range(BIGNUM):
ret = table.appendRow([6,2.6,36])
ds.close()
self.assertTrue(ret)
示例3: test_table_readRows
def test_table_readRows(self):
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
aa = table.readRows(0,1)
print aa
ds.close()
self.assertTrue()
示例4: test_dataset_getAttribute_float_list
def test_dataset_getAttribute_float_list(self): # float
ds = pydal.dalDataset("testfile.h5","HDF5")
a = numpy.array([1.111,2.222,3.333])
b = ds.getAttribute_float("float_list_attribute")
# should be updated to compare expected with returned vals,
# but needs the same precision. Otherwise assertEqual fails.
ds.close()
self.assertTrue(type(b)==numpy.ndarray)
示例5: test_table_write_col_data_by_index
def test_table_write_col_data_by_index(self): # modifies table3
ds = pydal.dalDataset("testfile.h5","HDF5")
t3 = ds.openTable("table3")
# first create the rows in the table with appendRows
ret = t3.appendRows([0 for x in range(BIGNUM*3)],BIGNUM)
# then fill them with data using write_col_by_index
t3.write_col_by_index_boost(numpy.ones(BIGNUM,numpy.int16),0,0,BIGNUM)
t3.write_col_by_index_boost(numpy.ones(BIGNUM,numpy.float32),1,0,BIGNUM)
t3.write_col_by_index_boost(numpy.random.randint(0,100,BIGNUM),2,0,BIGNUM)
ds.close()
self.assertTrue(t3)
示例6: test_table_addColumns
def test_table_addColumns(self):
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
table.addColumn("col1", "dalINT", 1 )
table.addColumn("col2", "dalFLOAT", 1 )
table.addColumn("col3", "dalSHORT", 1 )
t2 = ds.openTable("table2")
t2.addColumn("col1", "dalFLOAT", 1 )
t2.addColumn("col2", "dalFLOAT", 1 )
t2.addColumn("col3", "dalFLOAT", 1 )
t3 = ds.openTable("table3")
t3.addColumn("col1", "dalSHORT", 1 )
t3.addColumn("col2", "dalFLOAT", 1 )
t3.addColumn("col3", "dalINT", 1 )
cols = table.listColumns()
ds.close()
self.assertEqual(cols,['col1','col2','col3'])
示例7: test_table_appendRows
def test_table_appendRows(self): # modifies table2
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table2")
ret = table.appendRows([ 1.0 for x in range(BIGNUM*3)],BIGNUM)
ds.close()
self.assertTrue(ret)
示例8: test_table_setAttribute_short_list
def test_table_setAttribute_short_list(self): # list of shorts
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
ret = table.setAttribute_short("short_attribute_list",[-3872, -330, 3840])
ds.close()
self.assertTrue(ret)
示例9: test_table_setAttribute_short
def test_table_setAttribute_short(self): # short
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
ret = table.setAttribute_short("short_attribute",-3872)
ds.close()
self.assertTrue(ret)
示例10: test_table_setAttribute_uint_list
def test_table_setAttribute_uint_list(self): # list of uints
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
ret = table.setAttribute_uint("uint_attribute_list",[92834, 6646, 333399])
ds.close()
self.assertTrue(ret)
示例11: len
if len(sys.argv) < 8: range_plot = [0]
elif len((sys.argv[7]).split(':')) > 1:
range_plot = list(range(int((sys.argv[7]).split(':')[0]),int((sys.argv[7]).split(':')[1])))
else: range_plot = [int(sys.argv[7])]
if len(sys.argv) < 9: pol = 0
else: pol = int(sys.argv[8])
if pol > 3:
pol2 = pol-3
pol = 0
print("plotting pols %i and %i" % (pol, pol2))
else:
pol2 = 0
print("plotting pol %i" % (pol))
# open file
msds= dal.dalDataset()
if ( True != msds.open(sys.argv[1]) ):
print("ERROR: Could not open file: " + sys.argv[1])
print(" Please check the file and try again.")
sys.exit(1)
# open tables
tablename = "MAIN";
msds.setFilter( "TIME," + data_name, \
"ANTENNA1 = " + sys.argv[2] + " AND ANTENNA2 = " + sys.argv[3] + \
" AND DATA_DESC_ID = " + subband )
table12 = msds.openTable( tablename );
msds.setFilter( "TIME," + data_name, \
"ANTENNA1 = " + sys.argv[3] + " AND ANTENNA2 = " + sys.argv[4] + \
" AND DATA_DESC_ID = " + subband )
示例12: test_dataset_createFloatArray_with_numpy_array
def test_dataset_createFloatArray_with_numpy_array(self):
ds = pydal.dalDataset("testfile.h5","HDF5")
arr = ds.createFloatArray("floatarray1_numpy_array",[2,2],numpy.array([1.0,2.0,3.0,4.0]),[2,2])
ds.close()
self.assertEqual(type(arr),pydal.dalArray)
示例13: test_table_setAttribute_int_list
def test_table_setAttribute_int_list(self): # list of ints
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
ret = table.setAttribute_int("int_attribute_list",[-23637, 0, 24898, 665557])
ds.close()
self.assertTrue(ret)
示例14: test_table_setAttribute_float_list
def test_table_setAttribute_float_list(self): # list of floats
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
ret = table.setAttribute_float( "float_attribute_list", [87323.234, 998989.77777, -929292.521] )
ds.close()
self.assertTrue(ret)
示例15: test_table_setAttribute_double
def test_table_setAttribute_double(self): # double
ds = pydal.dalDataset("testfile.h5","HDF5")
table = ds.openTable("table1")
ret = table.setAttribute_double( "double_attribute", 324.9287364 )
ds.close()
self.assertTrue(ret)