On 12/27/2011 06:14 AM, Yigit Turgut wrote:
On Dec 26, 8:58 pm, Lie Ryan<lie.1...@gmail.com> wrote:
On 12/27/2011 04:08 AM, Yigit Turgut wrote:
not your fault, I made a mistake when copy-pasteing the code, here's the
fixed code:
from itertools import izip_longest
def to_square(data):
sq_data = [[], []]
for x,y, xn in izip_longest(data[0], data[1], data[0][1:]):
sq_data[0].append(x)
sq_data[1].append(y)
sq_data[0].append(xn)
sq_data[1].append(y)
return numpy.array(sq_data, dtype=float)
use it like this:
t,y1 = to_square(numpy.genfromtxt(filename, unpack=True))
pyplot.plot(t,y1)
pyplot.show()
Significant improvement on the plot, pretty interesting. It runs ok
but I need to know how?! (:
it's pretty simple, actually; just observe the numbers before and after
it's fixed by the function and it should be fairly obvious.
--
http://mail.python.org/mailman/listinfo/python-list