I am trying to make a graph from some data I took.
I have managed to write a script that will give me the two graphs I am looking for.
from ROOT import TGraph
from array import array
filename = “testdata.txt”
x1, y1, z1, a1 = numpy.loadtxt(filename, unpack=True)
x = array(“d”, x1)
y = array(“d”, y1)
z = array(“d”, z1)
c1=ROOT.TCanvas(“c1”, “”, 700, 500)
gr = TGraph(len(x), x,y)
c2=ROOT.TCanvas(“c2”, “”, 700, 500)
gr1 = TGraph(len(x), x,z)
This works fine.
The problem I am having, is that the data file I took isn’t so neat as the one I used here.
I took the right values from the real data file, and put them neatly into three columns into another text file, testdata.txt.
I want to be able to graph these same numbers from my original data file.
That is, how do I read only certain parts of the file:
Skip the headers a few rows down, and then certain columns only.
Is there a way to do this? Is it completely different that what I have here?