My question concerns the following pythonPython code which is already working. As far as I have seen, there are very elegant solutions of compacting code. Do you have any ideas on how to make the following code look smoother?
mom = [0.,0.13,0.27,0.53,0.67]
strings = ['overview_files/root/file_' + str(e) for e in mom]
myfile = [np.loadtxt(s) for s in strings]
nbinp = len(mom)
nbinomega = len(myfile[0][:,0])
x, y, z = (np.empty(nbinp*nbinomega) for i in range(3))
for i in range(nbinomega):
for j in range(nbinp):
i_new = i + j*nbinomega
y[i_new] = myfile[j][i,0] - 1.4
x[i_new] = mom[j]
z[i_new] = myfile[j][i,1]
Thanks in advance!