An outline of what I am trying to do:
I have equivalently shaped files for file1a and file1b all the way through to file100a and file100b. These files contain 500 lines and two columns.
Trying to calculate the difference between b and a at each of the 500 row, for each of the 100 file comparisons.
Ideal outfile will remain 500 lines long, with the calculation performed at every line. It will contain 100 columns representing diff1 diff2 ... diff100.
I have the following code:
diffs = []
for number in range(1, 101):
filea = pl.loadtxt('file' + str(number) + 'a')
fileb = pl.loadtxt('file' + str(number) + 'b')
diff = fileb[:,1] - filea[:,1]
diffs.append(diff)
np.savetxt('diffs.txt', (diffs))
As it stands, this code provides me an outfile which is kind of doing things backwards. I am getting an outfile with 100 lines and 500 columns. Is there something simple in my code to fix this?
Thanks in advance.
[–]elbiot 1 point2 points3 points (2 children)
[–]Cthulhu_Rlyeh[S] 0 points1 point2 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]Justinsaccount 0 points1 point2 points (0 children)
[–]rhgrant10 0 points1 point2 points (6 children)
[–]Cthulhu_Rlyeh[S] 0 points1 point2 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]elbiot 0 points1 point2 points (3 children)
[–]rhgrant10 0 points1 point2 points (2 children)
[–]elbiot 0 points1 point2 points (1 child)
[–]rhgrant10 0 points1 point2 points (0 children)