Exemplo n.º 1
0
def table(name, data):
	j=0
	i=0
	f = np.zeros(len(data))
	for i in range(len(data)):
		if(type(data[i][0]) == type(dummy) or type(data[i][0]) == type(dummyarray[1]) or type(data) == type(udummyarray)):
			f[i] = True
		else:
			f[i] = False
	print(f)
	#Runden
	for i in range(len(data)):
		if(f[i]):
			for j in range(data[0]):
				sdevs(data[i][j]) = rts(sdevs(data[i][j]))
				noms(data[i][j]) = round((noms(data[i][j]), -int(m.floor(m.log10(abs(x))))))
							
			
	output = open(name, 'w')
	output.write(r'\begin{table}[h]' + '\n' + r'\centering' + '\n' + r'\caption{CAPTION}' + '\n' +r'\sisetup{%uncertainty-seperator = {\,},'+'\n'+r'table-number-alignment = center,'+'\n'+'table-unit-alignment = center,'+'\n'+'%table-figures-integer = 1,'+'\n'+'%table-figures-decimal = 1,'+'\n'+'table-auto-round = true'+'\n'+'}'+'\n'+ r'\begin{tabular}{ ')
	for i in range(len(data)):
		if(f[i]):
			output.write(r'S[table-format= 3.1]'+'\n'+' @{\,$\pm{}$\,} '+'\n' + r' S[table-format= 3.1] ')
		else:
			output.write(r' S[table-format= 3.1] '+'\n')
	output.write(r'}' + '\n' + r'\toprule' + '\n')
	
	for i in range(len(data)):
		if(i < (len(data)-1)): 
			if(f[i]):
				output.write(r'\multicolumn{2}{c}{TITLE}'+'\n'+'&')
			else:
				output.write(r'{$\text{Title}$}'+'\n'+'&')
		else:
			if(f[i]):
				output.write(r'\multicolumn{2}{c}{TITLE} \\'+'\n')
			else:
				output.write(r'{$\text{Title}$} \\'+'\n')
	output.write(r' \midrule' + '\n')
	
	#Tabelle
	for j in range(len(data[0])):
		i = 0
		while i <= len(data)-1:
				if(f[i]):
					if(i == len(data)-1):
						output.write(str(data[i][j].n) + '&' + str(data[i][j].s) + r'\\' + '\n')
					else:
						output.write(str(data[i][j].n)+ '&' + str(data[i][j].s) + '&')
					i = i+1
				else:
					if(i == len(data)-1):
						output.write(str(data[i][j]) + r'\\' + '\n')
					else:
						output.write(str(data[i][j]) + '&')
					i = i+1
	#Tabelle Ende
	output.write(r'\bottomrule' + '\n' + r'\end{tabular}' + '\n' + r'\label{tab:LABEL}' + '\n' + r'\end{table}')
	output.close()
Exemplo n.º 2
0
 def g(t, y):
     i = int((t - ti) / dt)
     return f(y, i, M)
Exemplo n.º 3
0
def crts(x): #Anzahl der sign. Nachkommastellen
	if -int(m.floor(m.log10(abs(x))))>0:
		return -int(m.floor(m.log10(abs(x))))
Exemplo n.º 4
0
def cuts(x):						#Nachkommastellen
	if-int(m.floor(m.log10(abs(x))))<1:
		return 0
	else:
		return -int(m.floor(m.log10(abs(x))))
Exemplo n.º 5
0
def rts(x):							#Runden
	if x:
		return round(x, -int(m.floor(m.log10(abs(x)))))
	else:
		return 0