def testrun(): tab = Table() tab.data = [('info1', 1, 2, 'op1'), ('info2', 2, 3, 3), ('info3', 3, 4, 3), ('info4', 4, 5, 3), ('info5', 5, 6, 3), ('info6', 6, 7, 3), (9, 7, 8, 3)] tab.columnames = ['a', 'b', 'c', 'd'] print tab dfrm = table2dataframe(tab) print dfrm ntab = dataframe2table(dfrm) print('test 1') testufmean = [ufloat('2.0+/-1.0'), 4.0] print ufmeanstd(testufmean, True) print('test 2') testufmean = [ufloat('2.0+/-1.0'), ufloat('4.0+/-0.0')] print ufmeanstd(testufmean, True) print('test 3') testufmean = [ufloat('2.0+/-0.0'), ufloat('4.0+/-0.0')] print ufmeanstd(testufmean, True) print('test 4') testufmean = [2.0, 4.0] print ufmeanstd(testufmean, True) print 'test 1' binlis = [1, 1, 2, 2] bins = [1, 2, 3] bl = bin_values(binlis, bins) print 'binlis:', binlis, '\n', 'bins:', bins, '\n', 'binned:', bl print 'test 2' binlis = [0, 0, 1, 1, 2, 2] bins = [1, 2, 3] bl = bin_values(binlis, bins) print binlis, '\n', bins, '\n', bl print 'test 3' binlis = [1, 1, 2, 2, 3, 3] bins = [1, 2, 3] bl = bin_values(binlis, bins) print binlis, '\n', bins, '\n', bl print 'test 4' binlis = [1, 1, 2, 2, 3, 3, 4, 4] bins = [1, 2, 3] bl = bin_values(binlis, bins) print binlis, '\n', bins, '\n', bl
def testtable(self): tab1 = Table() tab2 = Table() tab1.read('testfiles/tab1.txt', columnames=True) tab2.read('testfiles/tab1.txt', columnames=False) print('read test') print(tab1) print(tab2) tab1.read('testfiles/tab1.txt', columnames=True) tab2.read('testfiles/tab2.txt', columnames=True) print('merge test') print(tab1) print(tab2) tab1.merge(tab2, by_x='r', by_y='w') print(tab1) tab2.read('testfiles/tab2.txt', columnames=True) tab2.write_html('testfiles/tab2.html') tab2.write('testfiles/tab2-repo.txt') sub1 = tab1.getcolumn(('r', 't')).tolist() self.assertEqual(sub1, [['3', '3'], ['3', '333']]) sub2 = tab1.getcolumn(0).tolist() self.assertEqual(sub2, [['1'], ['2']])
def testrun(): rp = 6 lp = 9 data = [range(0 + i, 3 + i) for i in range(1, 25)] data = [ tuple(ele[0:2] + [rp, 2, 'k']) if ele[2] < 10 else tuple(ele[0:2] + [lp, 6, 'o']) for ele in data ] tab = Table('testdata') tab.data = data tab.columnames = ('A', 'B', 'C', 'D', 'E') tab.write('testplotdata.txt') statoverview(tab) # figure=matplotlib.pyplot.figure('ooop') # matplotlib.pyplot.show() # matplotlib.pyplot.close('all') # matplotlib.pyplot.close(figure) ggscatterplot(tabdata=tab, xvar='A', yvar='B', group='', error='', figname='a.pdf', main='a', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False, reducepnt=False, dofit=False) ggscatterplot(tabdata=tab, xvar='A', yvar='B', group='C', error='', figname='b.pdf', main='b', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False, reducepnt=False, dofit=False) ggscatterplot(tabdata=tab, xvar='A', yvar='B', group='C', error='D', figname='c.pdf', main='c', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False, reducepnt=False, dofit=False) ggscatterplot(tabdata=tab, xvar='A', yvar='B', group='C', error='', figname='d.pdf', main='d', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False, reducepnt=False, dofit=False) ggboxplot(tabdata=tab, xvar='E', yvar='B', group='C', error='', figname='e.pdf', main='e', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False) ggbarplot(tabdata=tab, xvar='A', yvar='B', group='A', error='', figname='f.pdf', main='ABA', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False) ggbarplot(tabdata=tab, xvar='A', yvar='B', group='E', error='', figname='g.pdf', main='ABE', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False) ggbarplot(tabdata=tab, xvar='A', yvar='B', group='', error='', figname='h.pdf', main='AB', colormode='hue', graphncol=0, width=7, height=7, gformat='pdf', doscale=False, dolabelflip=False)