Beispiel #1
0
def main(argv):
    if len(argv) != 3:
        print("Usage: %s <i> <selfCouplingStrength>" % argv[0])
        sys.exit(1)

    i = int(argv[1])
    selfCouplingStrength = float(argv[2])
    epsilon = 0.1
    i0 = 10
    couplingStartTime = 99.04
    dt = 1e-2
    wiMarker = "x"
    integrationINapIKFilename = "results/integrationWCoupledINapIKHighThresholdWithSelfCouplingStrength%.02fI0%.02fEpsilon%.06fCouplingStartTime%.02f.npz" % (
        selfCouplingStrength, i0, epsilon, couplingStartTime)
    integrationQsFilename = "results/integrationQINapIKHighThresholdI0%.02fEpsilon%.06fCouplingStart%.02f_oscillator%d.npz" % (
        i0, epsilon, couplingStartTime, i)
    malkinsWConstantFilename = "results/w%dINapIKHighThresholdWithSelfCouplingStrength%.02fI0%.02fEpsilon%.06fCouplingStart%.02f.npz" % (
        i, selfCouplingStrength, i0, epsilon, couplingStartTime)

    integrationINapIKRes = np.load(integrationINapIKFilename)
    iStartTimeIndex = np.argmin(
        np.abs(couplingStartTime - integrationINapIKRes["times%dUncoupled" %
                                                        (i)]))
    xsiTimes = integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex:]-\
               integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex]
    xsi = integrationINapIKRes["ys%dUncoupled" % (i)][:, iStartTimeIndex:]
    qsIntRes = np.load(integrationQsFilename)
    qsTimes = qsIntRes["times"]
    qs = qsIntRes["ys"]
    T = np.max(qsIntRes["times"])

    uncoupledFunc = lambda x1, x2: np.array([0.0, 0.0])
    selfCoupledFunc = lambda x1, x2: np.array(
        [selfCouplingStrength * x1[0], 0.0])
    couplings = [selfCoupledFunc, uncoupledFunc]

    w = malkinsHFunc(qs=qs,
                     qsTimes=qsTimes,
                     xsi=xsi,
                     xsiTimes=xsiTimes,
                     xsj=xsi,
                     xsjTimes=xsiTimes,
                     coupling=couplings[i],
                     phaseDiff=0.0,
                     T=T)
    np.savez(file=malkinsWConstantFilename, w=w)

    plt.plot(w, marker=wiMarker)
    plt.grid()
    plt.axhline(y=0, color="gray")
    plt.xlabel("Phase Difference")
    plt.ylabel(r"$w_%d$" % (i))
    plt.legend()
    plt.show()

    pdb.set_trace()
Beispiel #2
0
def main(argv):
    if len(argv)!=3:
        print("Usage: %s <i> <selfCouplingStrength>"%argv[0])
        sys.exit(1)

    i = int(argv[1])
    selfCouplingStrength = float(argv[2])
    epsilon = 0.003
    i0 = 35.0
    couplingStartTime = 100.44
    dt = 1e-3
    wiMarker = "x"
    integrationINapIKFilename = "results/integrationWCoupledINapIKLowThresholdWithSelfCouplingStrength%.02fI0%.02fEpsilon%.06fCouplingStartTime%.02f.npz"%(selfCouplingStrength, i0, epsilon, couplingStartTime)
    integrationQsiFilename = "results/integrationQINapIKLowThresholdI0%.02fEpsilon%.06fCouplingStart%.02f_oscillator%d.npz"%(i0, epsilon, couplingStartTime, i)
    malkinsWConstantFilename = "results/w%dINapIKLowThresholdWithSelfCouplingStrength%.02fI0%.02fEpsilon%.06fCouplingStart%.02f.npz"%(i, selfCouplingStrength, i0, epsilon, couplingStartTime)

    integrationINapIKRes = np.load(integrationINapIKFilename)
    iStartTimeIndex = np.argmin(np.abs(couplingStartTime-
                                       integrationINapIKRes["times%dUncoupled"%(i)]))
    xsiTimes = integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex:]-\
               integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex]
    xsi = integrationINapIKRes["ys%dUncoupled"%(i)][:,iStartTimeIndex:]
    qsiIntRes = np.load(integrationQsiFilename)
    qsiTimes = qsiIntRes["times"]
    qsi = qsiIntRes["ys"]
    T = np.max(qsiIntRes["times"])

    uncoupledFunc = lambda x1, x2: np.array([0.0, 0.0])
    selfCoupledFunc = lambda x1, x2: np.array([selfCouplingStrength*x1[0], 0.0])
    couplings = [selfCoupledFunc, uncoupledFunc]

    w = malkinsHFunc(qsi=qsi, qsiTimes=qsiTimes, 
                                xsi=xsi, xsiTimes=xsiTimes, 
                                xsj=xsi, xsjTimes=xsiTimes,
                                coupling=couplings[i], 
                                phaseDiff=0.0, T=T)
    np.savez(file=malkinsWConstantFilename, w=w)
def main(argv):
    epsilon = 0.1
    i0 = 10
    couplingStartTime = 99.04
    selfCouplingStrength = 0.65
    i = 1
    j = 0
    # i = 0
    # j = 1
    dt = 1e-2
    integrationINapIKFilename = "results/integrationWCoupledINapIKHighThresholdWithSelfCouplingStrength%.02fI0%.02fEpsilon%.06fCouplingStartTime%.02f.npz" % (
        selfCouplingStrength, i0, epsilon, couplingStartTime)
    integrationQsFilename = "results/integrationQINapIKHighThresholdI0%.02fEpsilon%.06fCouplingStart%.02f_oscillator%d.npz" % (
        i0, epsilon, couplingStartTime, i)
    malkinsHFuncFilename = "results/h%d%dINapIKHighThresholdI0%.02fEpsilon%.06fCouplingStart%.02f.npz" % (
        i, j, i0, epsilon, couplingStartTime)

    integrationINapIKRes = np.load(integrationINapIKFilename)
    iStartTimeIndex = np.argmin(
        np.abs(couplingStartTime - integrationINapIKRes["times%dUncoupled" %
                                                        (i)]))
    xsiTimes = integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex:]-\
               integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex]
    xsi = integrationINapIKRes["ys%dUncoupled" % (i)][:, iStartTimeIndex:]
    jStartTimeIndex = np.argmin(
        np.abs(couplingStartTime - integrationINapIKRes["times%dUncoupled" %
                                                        (j)]))
    xsjTimes = integrationINapIKRes["times%dUncoupled"%(j)][jStartTimeIndex:]-\
               integrationINapIKRes["times%dUncoupled"%(j)][jStartTimeIndex]
    xsj = integrationINapIKRes["ys%dUncoupled" % (i)][:, jStartTimeIndex:]
    qsIntRes = np.load(integrationQsFilename)
    qsTimes = qsIntRes["times"]
    qs = qsIntRes["ys"]
    T = np.max(qsIntRes["times"])

    btwCoupledFunc = lambda x1, x2: np.array([x2[0] - x1[0], 0.0])

    phaseDiffs = np.arange(0, T, dt)
    hValues = np.empty(len(phaseDiffs))
    for k in xrange(len(phaseDiffs)):
        hValues[k] = malkinsHFunc(qs=qs,
                                  qsTimes=qsTimes,
                                  xsi=xsi,
                                  xsiTimes=xsiTimes,
                                  xsj=xsj,
                                  xsjTimes=xsjTimes,
                                  coupling=btwCoupledFunc,
                                  phaseDiff=phaseDiffs[k],
                                  T=T)
        print("h%d%dValues[phaseDiff=%.04f]=%.04f" %
              (i, j, phaseDiffs[k], hValues[k]))
    np.savez(file=malkinsHFuncFilename, phaseDiffs=phaseDiffs, hValues=hValues)

    if len(hValues) > 1:
        plt.plot(phaseDiffs, hValues, label=r"$H_{%d%d}$" % (i, j))
    else:
        plt.plot(phaseDiffs,
                 hValues,
                 marker=hiiMarker,
                 label=r"$H_{%d%d}$" % (i, j))
    plt.grid()
    plt.axhline(y=0, color="gray")
    plt.xlabel("Phase Difference")
    plt.ylabel(r"$H_{ij}$")
    plt.legend()
    plt.show()

    pdb.set_trace()
def main(argv):
    epsilon = 0.003
    i0 = 35.0
    couplingStartTime = 100.44
    # i = 0
    # j = 1
    i = 1
    j = 0
    dt = 1e-2
    integrationINapIKFilename = "results/integrationWCoupledINapIKLowThresholdI0%.02fEpsilon%.06fCouplingStartTime%.02f.npz"%(i0, epsilon, couplingStartTime)
    integrationQisFilename = "results/integrationQINapIKLowThresholdI0%.02fEpsilon%.06fCouplingStart%.02f_oscillator%d.npz"%(i0, epsilon, couplingStartTime, i)
    malkinsHFuncFilename = "results/h%d%dINapIKLowThresholdI0%.02fEpsilon%.06fCouplingStart%.02f.npz"%(i, j, i0, epsilon, couplingStartTime)

    integrationINapIKRes = np.load(integrationINapIKFilename)
    iStartTimeIndex = np.argmin(np.abs(couplingStartTime-
                                       integrationINapIKRes["times%dUncoupled"%(i)]))
    xsiTimes = integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex:]-\
               integrationINapIKRes["times%dUncoupled"%(i)][iStartTimeIndex]
    xsi = integrationINapIKRes["ys%dUncoupled"%(i)][:,iStartTimeIndex:]
    jStartTimeIndex = np.argmin(np.abs(couplingStartTime-
                                       integrationINapIKRes["times%dUncoupled"%(j)]))
    xsjTimes = integrationINapIKRes["times%dUncoupled"%(j)][jStartTimeIndex:]-\
               integrationINapIKRes["times%dUncoupled"%(j)][jStartTimeIndex]
    xsj = integrationINapIKRes["ys%dUncoupled"%(j)][:,jStartTimeIndex:]
    qsiIntRes = np.load(integrationQisFilename)
    qsiTimes = qsiIntRes["times"]
    qsi = qsiIntRes["ys"]
    T = np.max(qsiIntRes["times"])

    # begin debug
    # xi0Trimmed = xsi[0,:len(qsiTimes)]
    # xj0Trimmed = xsj[0,:len(qsiTimes)]
    # plt.plot(qsiTimes, xi0Trimmed, label="i")
    # plt.plot(qsiTimes, xj0Trimmed, label="j")
    # plt.legend()
    # plt.show()
    # end debug

    phaseDiffs = np.arange(0, T, dt)
    uncoupledFunc = lambda x1, x2: np.array([0.0, 0.0])
    coupledFunc = lambda x1, x2: np.array([x2[0]-x1[0], 0.0])
    couplings = [[uncoupledFunc, coupledFunc], 
                 [coupledFunc, uncoupledFunc]]
    hValues = np.empty(len(phaseDiffs))
    for k in xrange(len(phaseDiffs)):
        hValues[k] = malkinsHFunc(qsi=qsi, qsiTimes=qsiTimes,
                                           xsi=xsi,
                                           xsiTimes=xsiTimes,
                                           xsj=xsj,
                                           xsjTimes=xsjTimes,
                                           coupling=couplings[i][j],
                                           phaseDiff=phaseDiffs[k],
                                           T=T)
        print("h%d%dValues[phaseDiff=%.04f]=%.04f"%(i, j, 
                                                       phaseDiffs[k], 
                                                       hValues[k]))
    np.savez(file=malkinsHFuncFilename, phaseDiffs=phaseDiffs, hValues=hValues)

    plt.plot(phaseDiffs, hValues, label=r"$H_{%d%d}$"%(i,j))
    plt.axhline(y=0, color="gray")
    plt.xlabel("Phase Difference")
    plt.ylabel(r"$H_{ij}$")
    plt.legend()
    plt.show()

    pdb.set_trace()