Пример #1
0
def pr2a(file_prefix=None):
    lfunc = lorenz.lorenz(16, 45, 4)
    ts, xxs = rungekutta.rk4(lfunc, 0.0, numpy.array([-13.0, -12.0, 52.0], dtype=numpy.float64), 0.0001, 300000)
    xs = xxs.transpose()[:, 0]
    data = numpy.array(zip(xs, ts), dtype=numpy.float64)
    ms = tispy.mutual("-D", 16000, input=data)
    tau = first_min(ms)
    ws = tispy.delay("-d", int(tau), "-m", 7, input=data)
    x0 = numpy.array([-35, -35], dtype=numpy.float64)
    zs = numpy.array(zip(ws[100000:, 0], ws[100000:, 5]), dtype=numpy.float64)
    d_cap = find_loglog_slope(zs, x0, file_prefix=suffixed(file_prefix, "_2a"))
    print "Lorenz\tembed\td_cap = {0:.6f}".format(d_cap)
Пример #2
0
def pr2(delay=None, file_prefix=None):
    data = numpy.loadtxt('data/ps8/data2.first250sec', dtype=numpy.float64)
    if delay is not None:
        ms = tispy.mutual('-D', str(delay), input=data)
    else:
        ms = tispy.mutual(input=data)
    tau = first_min(ms)

    def _render(axes):
        axes.plot(ms[:, 0], ms[:, 1])
        (lbound, ubound) = axes.get_ybound()
        axes.plot([tau, tau], [lbound, ubound], 'k')
        axes.legend(('Mutual information', r'Optimal $\tau$'))

    plot.render(
        xlabel=r'$\tau$',
        ylabel='Mutual information',
        title=r'Mutual information vs. $\tau$ (min at $\tau$={0})'.format(
            first_min(ms)),
        ax_callback=_render,
        file_prefix=suffixed(file_prefix, '_1'))
Пример #3
0
def pr2(delay=None, file_prefix=None):
    data = numpy.loadtxt("data/ps8/data2.first250sec", dtype=numpy.float64)
    if delay is not None:
        ms = tispy.mutual("-D", str(delay), input=data)
    else:
        ms = tispy.mutual(input=data)
    tau = first_min(ms)

    def _render(axes):
        axes.plot(ms[:, 0], ms[:, 1])
        (lbound, ubound) = axes.get_ybound()
        axes.plot([tau, tau], [lbound, ubound], "k")
        axes.legend(("Mutual information", r"Optimal $\tau$"))

    plot.render(
        xlabel=r"$\tau$",
        ylabel="Mutual information",
        title=r"Mutual information vs. $\tau$ (min at $\tau$={0})".format(first_min(ms)),
        ax_callback=_render,
        file_prefix=suffixed(file_prefix, "_1"),
    )
Пример #4
0
def pr2a(file_prefix=None):
    lfunc = lorenz.lorenz(16, 45, 4)
    ts, xxs = rungekutta.rk4(
        lfunc, 0.0, numpy.array([-13.0, -12.0, 52.0], dtype=numpy.float64),
        0.0001, 300000)
    xs = xxs.transpose()[:, 0]
    data = numpy.array(zip(xs, ts), dtype=numpy.float64)
    ms = tispy.mutual('-D', 16000, input=data)
    tau = first_min(ms)
    ws = tispy.delay('-d', int(tau), '-m', 7, input=data)
    x0 = numpy.array([-35, -35], dtype=numpy.float64)
    zs = numpy.array(zip(ws[100000:, 0], ws[100000:, 5]), dtype=numpy.float64)
    d_cap = find_loglog_slope(zs, x0, file_prefix=suffixed(file_prefix, '_2a'))
    print 'Lorenz\tembed\td_cap = {0:.6f}'.format(d_cap)
Пример #5
0
def extrema():
    lfunc = lorenz.lorenz(16, 45, 4)
    ts, xxs = rungekutta.rk4(lfunc, 0.0, numpy.array([-13.0, -12.0, 52.0], dtype=numpy.float64), 0.0001, 300000)
    xs = xxs.transpose()[:, 0]
    data = numpy.array(zip(xs, ts), dtype=numpy.float64)
    ms = tispy.mutual("-D", 16000, input=data)
    tau = first_min(ms)
    print "Tau: {0:.6f}".format(tau)
    ws = tispy.delay("-d", int(tau), "-m", 7, input=data)
    zs = ws[100000:, :]
    mins = numpy.empty(7, dtype=numpy.float64)
    maxs = numpy.empty(7, dtype=numpy.float64)
    for i in xrange(7):
        mins[i] = min(zs[:, i])
        maxs[i] = max(zs[:, i])
    print "Mins: {0}".format(mins)
    print "Maxs: {0}".format(maxs)
Пример #6
0
def extrema():
    lfunc = lorenz.lorenz(16, 45, 4)
    ts, xxs = rungekutta.rk4(
        lfunc, 0.0, numpy.array([-13.0, -12.0, 52.0], dtype=numpy.float64),
        0.0001, 300000)
    xs = xxs.transpose()[:, 0]
    data = numpy.array(zip(xs, ts), dtype=numpy.float64)
    ms = tispy.mutual('-D', 16000, input=data)
    tau = first_min(ms)
    print 'Tau: {0:.6f}'.format(tau)
    ws = tispy.delay('-d', int(tau), '-m', 7, input=data)
    zs = ws[100000:, :]
    mins = numpy.empty(7, dtype=numpy.float64)
    maxs = numpy.empty(7, dtype=numpy.float64)
    for i in xrange(7):
        mins[i] = min(zs[:, i])
        maxs[i] = max(zs[:, i])
    print 'Mins: {0}'.format(mins)
    print 'Maxs: {0}'.format(maxs)
Пример #7
0
def pr6(file_prefix=None):
    lfunc = lorenz.lorenz(16, 45, 4)
    ts, vs = rungekutta.rk4(lfunc, 0.0, numpy.array([-13.0, -12.0, 52.0], dtype=numpy.float64), 0.001, 30000)
    xs = vs.transpose()[:, 0]
    data = numpy.array(zip(xs, ts), dtype=numpy.float64)
    ms = tispy.mutual("-D", 1600, input=data)
    tau = first_min(ms)
    ws = tispy.delay("-d", int(tau), "-m", 7, input=data)
    col1 = 0
    col2 = 5
    plot.render(
        ws[:, col1],
        ws[:, col2],
        "k.",
        markersize=0.6,
        title=r"Delay Coordinate Embedding: {0}, $\tau={1}$ s".format(r"lorenz", 0.001 * tau),
        xlabel=r"$x(t+{0:.3f})$".format(col1 * 0.001 * tau),
        ylabel=r"$x(t+{0:.3f})$".format(col2 * 0.001 * tau),
        file_prefix=suffixed(file_prefix, "_6"),
    )
    return tau
Пример #8
0
def pr6(file_prefix=None):
    lfunc = lorenz.lorenz(16, 45, 4)
    ts, vs = rungekutta.rk4(
        lfunc, 0.0, numpy.array([-13.0, -12.0, 52.0], dtype=numpy.float64),
        0.001, 30000)
    xs = vs.transpose()[:, 0]
    data = numpy.array(zip(xs, ts), dtype=numpy.float64)
    ms = tispy.mutual('-D', 1600, input=data)
    tau = first_min(ms)
    ws = tispy.delay('-d', int(tau), '-m', 7, input=data)
    col1 = 0
    col2 = 5
    plot.render(ws[:, col1],
                ws[:, col2],
                'k.',
                markersize=0.6,
                title=r'Delay Coordinate Embedding: {0}, $\tau={1}$ s'.format(
                    r'lorenz', 0.001 * tau),
                xlabel=r'$x(t+{0:.3f})$'.format(col1 * 0.001 * tau),
                ylabel=r'$x(t+{0:.3f})$'.format(col2 * 0.001 * tau),
                file_prefix=suffixed(file_prefix, '_6'))
    return tau