So I have been trying to use pythonxy to graph some data but have been having trouble getting the script I was given to work. The instructions I was given are as follows
I really don't know much about python and trying to use pythonxy makes is a lot harder to figure out what I'm doing so any help is much appreciated. I have the data collected and saved correctly I know that much at least so if I can figure out how to get python to work then I should be good to go!
* Now fire up your python shell:
This preloads numpy and matplotlib, but if you're using
something else, make sure those two packages are loaded...
numpy is a requirement for matplotlib anyway, but the
advantage to loading it explicitly is that it makes the
next step very easy:
% idx, P, Pdot = loadtxt("psrcat-P-Pdot.dat",
If I didn't have loadtxt from numpy, I'd have to actually
manually parse the data file, but that's not hard either.
Here's a snippet of code that does something similar:
f = open('myfile.txt', 'rU')
for line in f:
x, y, z = line.split()
But then you still need to load the x,y,z values into an
array. Lets say loadtxt works for now.
So now you have one-dimensional arrays which contain P and
Pdot. Plot them up!
% plot( log(P), log(Pdot), 'ro' )
And you're off.