Exemplo n.º 1
0
def param(xlist, ylist, vw=ViewWindow(), colorlist=None, auto=False, gif=False, add=False, avg=False,
          filename="param" + str(int(time())), save=True):
    if callable(xlist):
        xlist = [xlist]
    if callable(ylist):
        ylist = [ylist]
    if auto:
        vw.autoparam(xlist, ylist)
    data = PlotData(vw)
    images = []
    color = 0
    if colorlist is None:
        colorlist = Color.colors(len(xlist))
    for i in range(len(xlist)):
        x = xlist[i]
        y = ylist[i]
        t = vw.tmin
        if colorlist != 'rainbow':
            color = colorlist[i]
        while t <= vw.tmax:
            if colorlist == 'rainbow':
                color = Color.rbow(vw.tmax - t, 2)
            u = t + vw.tstep
            data.line0((x(t), y(t)), (x(u), y(u)), color, add, avg)
            t = u
            if gif:
                images.append(data.save("", False))
    if gif:
        writegif(filename, images, 0.01)
    return data.save(filename, save)
Exemplo n.º 2
0
def zrotate(xlist, ylist, vw=ViewWindow(), segs=4, colorlist=None, auto=False, filename=None, gif=False, add=True,
            avg=False, save=True):
    if auto:
        vw.autoparam(xlist, ylist)
    if filename is None:
        filename = "zrotate" + str(int(time()))
    if callable(xlist):
        xlist = [xlist]
    if callable(ylist):
        ylist = [ylist]
    data = PlotData(vw, "rainbow" if colorlist == "rainbow" else Color(0, 0, 0))
    images = []
    if colorlist is None:
        colorlist = Color.colors(len(xlist))
    tlist = [vw.tmin + (vw.tmax - vw.tmin) * j / segs for j in range(segs + 1)]
    while tlist[0] < vw.tmax:
        for (x, y, color) in zip(xlist, ylist, colorlist):
            if colorlist == 'rainbow':
                color = Color.rbow(tlist[0], segs)
            for j in range(len(tlist) - 1):
                data.line0((x(tlist[j]), y(tlist[j])), (x(tlist[j + 1]), y(tlist[j + 1])), color, add, avg)
        if gif:
            images.append(data.save("", False))
        tlist = [t + vw.tstep for t in tlist]
    if gif:
        writegif(filename, images, 0.01)
    return data.save(filename, save)
Exemplo n.º 3
0
def param(xlist,
          ylist,
          vw=ViewWindow(),
          colorlist=None,
          auto=False,
          gif=False,
          add=False,
          avg=False,
          filename="param" + str(int(time())),
          save=True):
    if callable(xlist):
        xlist = [xlist]
    if callable(ylist):
        ylist = [ylist]
    if auto:
        vw.autoparam(xlist, ylist)
    data = PlotData(vw)
    images = []
    color = 0
    if colorlist is None:
        colorlist = Color.colors(len(xlist))
    for i in range(len(xlist)):
        x = xlist[i]
        y = ylist[i]
        t = vw.tmin
        if colorlist != 'rainbow':
            color = colorlist[i]
        while t <= vw.tmax:
            if colorlist == 'rainbow':
                color = Color.rbow(vw.tmax - t, 2)
            u = t + vw.tstep
            data.line0((x(t), y(t)), (x(u), y(u)), color, add, avg)
            t = u
            if gif:
                images.append(data.save("", False))
    if gif:
        writegif(filename, images, 0.01)
    return data.save(filename, save)
Exemplo n.º 4
0
def zrotate(xlist,
            ylist,
            vw=ViewWindow(),
            segs=4,
            colorlist=None,
            auto=False,
            filename=None,
            gif=False,
            add=True,
            avg=False,
            save=True):
    if auto:
        vw.autoparam(xlist, ylist)
    if filename is None:
        filename = "zrotate" + str(int(time()))
    if callable(xlist):
        xlist = [xlist]
    if callable(ylist):
        ylist = [ylist]
    data = PlotData(vw,
                    "rainbow" if colorlist == "rainbow" else Color(0, 0, 0))
    images = []
    if colorlist is None:
        colorlist = Color.colors(len(xlist))
    tlist = [vw.tmin + (vw.tmax - vw.tmin) * j / segs for j in range(segs + 1)]
    while tlist[0] < vw.tmax:
        for (x, y, color) in zip(xlist, ylist, colorlist):
            if colorlist == 'rainbow':
                color = Color.rbow(tlist[0], segs)
            for j in range(len(tlist) - 1):
                data.line0((x(tlist[j]), y(tlist[j])),
                           (x(tlist[j + 1]), y(tlist[j + 1])), color, add, avg)
        if gif:
            images.append(data.save("", False))
        tlist = [t + vw.tstep for t in tlist]
    if gif:
        writegif(filename, images, 0.01)
    return data.save(filename, save)