def test_print_table(self): fu.print_table( [['test','values','of','table'],[0.0,1.0,2.0,3.0]] )
out_file.write('\n') else: # print the table: # header to screen print(''.join([ '*' for i in range( len('Parameter bounds for the Fisher matrix: ' + fish.name) + 1) ])) print('Parameter bounds for the Fisher matrix: ', fish.name) print(''.join([ '*' for i in range( len('Parameter bounds for the Fisher matrix: ' + fish.name) + 1) ])) fu.print_table(print_table) # finalize and close file: if args.latex: if outroot is not None: out_file.write('\hline\n') out_file.write('\end{tabular}') else: print('\hline') print('\end{tabular}') if outroot is not None: out_file.close() # print some final feedback: if not args.quiet:
out_file.write( 'Parameter bounds for the Fisher matrix: '+fish.name+'\n' ) out_file.write( ''.join([ '*' for i in xrange(len('Parameter bounds for the Fisher matrix: '+fish.name)+1)])+'\n' ) out_file.write( '\n' ) print_table = map(list, zip(*print_table)) col_width = [max(len(str(x)) for x in col) for col in zip(*print_table)] # print it to file: for line in print_table: out_file.write( "| " + " | ".join("{:{}}".format(x, col_width[i]) for i, x in enumerate(line)) + " |"+'\n' ) out_file.write( '\n' ) else: # print the table: # header to screen print ''.join([ '*' for i in xrange(len('Parameter bounds for the Fisher matrix: '+fish.name)+1)]) print 'Parameter bounds for the Fisher matrix: ', fish.name print ''.join([ '*' for i in xrange(len('Parameter bounds for the Fisher matrix: '+fish.name)+1)]) fu.print_table( print_table ) # finalize and close file: if args.latex: if outroot is not None: out_file.write( '\hline\n' ) out_file.write( '\end{tabular}' ) else: print '\hline' print '\end{tabular}' if outroot is not None: out_file.close() # print some final feedback: if not args.quiet: