def main(argv):
    i0 = 40.0
    nMin = -0.1
    nMax = 0.7

    iPulseStrength = 0.0
    resultsFilenamePattern = 'results/integrationINapIKFig4-yyPulseStrength%d.npz'
    phaseFigFilename = 'figures/fig4-yyPhaseSpace.eps'
    voltageFigFilename = 'figures/fig4-yyVoltage.eps'

    plt.figure()
    plotLowThresholdINapIKVectorField(I=i0, nMin=nMin, nMax=nMax)
    resultsFilename = resultsFilenamePattern % iPulseStrength
    results = np.load(resultsFilename)
    ys = results["ys"]
    plt.plot(ys[0, :], ys[1, :], label="p=%d"%iPulseStrength)
    plt.grid()
    plt.legend()
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.savefig(phaseFigFilename)

    times = results["times"]
    plt.figure()
    plt.plot(times, ys[0, :], label="p=%d"%iPulseStrength)
    results.close()
    plt.grid()
    plt.legend()
    plt.xlabel('Time (secs)')
    plt.ylabel('Voltage (mv)')
    plt.savefig(voltageFigFilename)

    pdb.set_trace()
def main(argv):
    phaseFigFilename = 'figures/fig4-4bPhaseSpace.eps'
    voltageFigFilename = 'figures/fig4-4bVoltage.eps'
    resultsFilenamePattern = 'results/integrationINapIKStepsize%d.npz'
    i0 = 40

    resultsFilename = resultsFilenamePattern % i0
    results = np.load(resultsFilename)
    plt.figure()
    plotLowThresholdINapIKVectorField()

    plt.plot(results['ys'][0, :], results['ys'][1, :], label="%d" % i0)
    plt.grid()
    plt.legend()
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.savefig(phaseFigFilename)

    plt.figure()
    plt.plot(results['times'], results['ys'][0, :], label="%d" % i0)
    plt.grid()
    plt.legend()
    plt.xlabel('Time (secs)')
    plt.ylabel('Voltage (mv)')
    plt.savefig(voltageFigFilename)
    pdb.set_trace()
def main(argv):
    i0 = 35
    numberOfPhaseMarks = 8
    annotationGap = 0.02
    initialTransientLength = 10
    resultsFilename = 'results/integrationINapIKFig10_1_INapIKLowThreshold.npz'
    aFigFilename = 'figures/fig10_1b_INapIKLowThreshold.eps'

    results = np.load(resultsFilename)
    times = results['times']
    ys = results['ys']
    transientIndices = np.nonzero(times < initialTransientLength)[0]
    pdb.set_trace()
    times = np.delete(arr=times, obj=transientIndices)
    ys = np.delete(arr=ys, obj=transientIndices, axis=1)
    spikeIndices = getPeakIndices(v=ys[0, :])
    spikeTimes = times[spikeIndices]

    times = np.delete(times, np.arange(0, spikeIndices[0]))
    times = times - times[0]
    ys = np.delete(ys, np.arange(0, spikeIndices[0]), axis=1)
    spikeIndices = spikeIndices - spikeIndices[0]
    spikeTimes = spikeTimes - spikeTimes[0]
    period = spikeTimes[1] - spikeTimes[0]
    phases = times % period
    phasesToPlot = np.arange(0, period, period / numberOfPhaseMarks)
    indicesBtwFirstAndSecondSpike = np.arange(0, spikeIndices[1])
    phasesToSearch = phases[indicesBtwFirstAndSecondSpike]

    indicesPhasesToPlot = np.empty(len(phasesToPlot), dtype=np.int64)
    for i in xrange(len(phasesToPlot)):
        phaseToPlot = phasesToPlot[i]
        indicesPhasesToPlot[i] = np.argmin(np.abs(phasesToSearch -
                                                  phaseToPlot))

    plt.figure()
    plotLowThresholdINapIKVectorField(i=i0)
    plt.plot(ys[0, :], ys[1, :], label="limit cycle attractor")
    plt.plot(ys[0, indicesPhasesToPlot], ys[1, indicesPhasesToPlot], 'ro')
    plt.annotate("0,T",
                 xy=ys[:, 0],
                 xytext=ys[:, indicesPhasesToPlot[0]] + annotationGap,
                 color="red",
                 size=14)
    for i in xrange(1, len(indicesPhasesToPlot)):
        plt.annotate("%d/%dT" % (i, numberOfPhaseMarks),
                     xy=ys[:, indicesPhasesToPlot[i]],
                     xytext=ys[:, indicesPhasesToPlot[i]] + annotationGap,
                     color="red",
                     size=14)
    plt.grid()
    plt.legend(loc="upper left")
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.ylim((-0.1, 0.8))
    plt.savefig(aFigFilename)
    plt.show()

    pdb.set_trace()
Exemplo n.º 4
0
def main(argv):
    # iPulseStrengths = (1000000, 1200000, 1210000, 1220000, 1230000, 1250000, 1400000)
    iPulseStrengths = (1000000, 1220000, 1400000)
    resultsFilenamePattern = 'results/integrationINapIKIPulseStrength%d.npz'
    phaseFigFilename = 'figures/fig4-7PhaseSpace.eps'
    voltageFigFilename = 'figures/fig4-7Voltage.eps'

    plt.figure()
    plotLowThresholdINapIKVectorField()
    '''
    plotINapIKVectorField(I=0.0, C=1.0, EL=-78, gL=8, gNa=20, gK=10, 
                                 VoneHalf_m=-20, k_m=15, 
                                 VoneHalf_n=-45, k_n=5, tauV=1, ENa=60,
                                 EK=-90, nDotScaleFactor=200, 
                                 vMin=-90.0, vMax=20.0, nVs=19, nVsDense=100,
                                 nMin=0.0, nMax=0.7, nNs=18, 
                                 vNullclineLabel="v nullcline",
                                 nNullclineLabel="n nullcline")a
    '''
    for iPulseStrength in iPulseStrengths:
        resultsFilename = resultsFilenamePattern % iPulseStrength
        results = np.load(resultsFilename)
        plt.plot(results['ys'][0, :],
                 results['ys'][1, :],
                 label="p=%d" % iPulseStrength)
        results.close()
    plt.grid()
    plt.legend()
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.savefig(phaseFigFilename)

    plt.figure()
    for iPulseStrength in iPulseStrengths:
        resultsFilename = resultsFilenamePattern % iPulseStrength
        results = np.load(resultsFilename)
        plt.plot(results['times'],
                 results['ys'][0, :],
                 label="p=%d" % iPulseStrength)
        results.close()
    plt.grid()
    plt.legend()
    plt.xlabel('Time (secs)')
    plt.ylabel('Voltage (mv)')
    plt.savefig(voltageFigFilename)

    pdb.set_trace()
Exemplo n.º 5
0
def main(argv):
    integrationFilename = 'results/integrationINapIKFig10_10_INapIKLowThreshold_aboveUnstable.npz'
    figFilename = 'figures/fig10_10b_INapIKLowThreshold_aboveUnstable.eps'
    nPhases = 6
    ylim = (-.1, .7)
    fontsize = 20

    integrationRes = np.load(integrationFilename)

    plt.plot(integrationRes["ysDCTrainPulses"][0, :],
             integrationRes["ysDCTrainPulses"][1, :],
             label="train pulses")
    plt.plot(integrationRes["ysDC"][0, :],
             integrationRes["ysDC"][1, :],
             label="DC")
    plotLowThresholdINapIKVectorField(i=integrationRes["i0"])
    plt.xlabel("Membrane Potential (V)")
    plt.ylabel('K activation variable, n')
    plt.ylim(ylim)

    spikeIndices = getPeakIndices(v=integrationRes["ysDCTrainPulses"][0, :])
    spikeTimes = integrationRes["timesDCTrainPulses"][spikeIndices]

    pulseTimes = np.arange(start=integrationRes["tPulse"],
                           stop=spikeTimes[-1],
                           step=integrationRes["Ts"])

    pulseIndices = np.empty(pulseTimes.shape)
    for i in range(len(pulseIndices)):
        pulseIndices[i] = np.argmin(
            np.abs(pulseTimes[i] - integrationRes["timesDCTrainPulses"]))

    for i in range(len(pulseIndices)):
        annotation = r"$\theta_{%d}$" % (i + 1)
        plt.annotate(annotation,
                     xy=(integrationRes["ysDCTrainPulses"][0, pulseIndices[i]],
                         integrationRes["ysDCTrainPulses"][1,
                                                           pulseIndices[i]]),
                     fontsize=fontsize)
    plt.savefig(figFilename)
    plt.show()
    pdb.set_trace()
Exemplo n.º 6
0
def main(argv):
    phaseFigFilename = 'figures/fig4-10PhaseSpace.eps'
    voltageFigFilename = 'figures/fig4-10Voltage.eps'
    resultsFilenamePattern = 'results/integrationINapIKStepsize%d.npz'
    i0 = 40.0

    plt.figure()
    plotLowThresholdINapIKVectorField()
    '''
    plotINapIKVectorField(I=i0, C=1.0, EL=-78, gL=8, gNa=20, gK=10, 
                                 VoneHalf_m=-20, k_m=15, 
                                 VoneHalf_n=-45, k_n=5, tauV=1, ENa=60,
                                 EK=-90, nDotScaleFactor=200, 
                                 vMin=-90.0, vMax=20.0, nVs=19, nVsDense=100,
                                 nMin=0.0, nMax=0.7, nNs=18, 
                                 vNullclineLabel="v nullcline",
                                 nNullclineLabel="n nullcline")
    '''
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')

    resultsFilename = resultsFilenamePattern % i0
    results = np.load(resultsFilename)
    plt.plot(results['ys'][0, :], results['ys'][1, :], label="%d" % i0)
    plt.grid()
    plt.legend()
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.savefig(phaseFigFilename)

    plt.figure()
    plt.plot(results['times'], results['ys'][0, :], label="%d" % i0)
    plt.grid()
    plt.legend()
    plt.xlabel('Time (secs)')
    plt.ylabel('Voltage (mv)')
    plt.savefig(voltageFigFilename)
    pdb.set_trace()
Exemplo n.º 7
0
def main(argv):
    if len(argv) != 3:
        sys.exit("Usage: %s i0 a" % argv[0])
    i0 = float(argv[1])
    a = float(argv[2])
    resultsFilename = 'results/integrationINapIKExampleP172I%.02fa%f.npz' % (
        i0, a)
    phaseFigFilename = 'figures/figPhaseSpaceExampleINapIKP172I%.02fa%f.eps' % (
        i0, a)
    voltageFigFilename = 'figures/figVoltageExampleINapIKP172I%.02fa%f.eps' % (
        i0, a)

    results = np.load(resultsFilename)

    plt.figure()
    plotLowThresholdINapIKVectorField(i=results['i0'])

    plt.plot(results['ys'][0, :], results['ys'][1, :], label="trayectory")
    axes = plt.gca()
    ylim = axes.get_ylim()
    axes.set_ylim((-0.1, ylim[1]))
    plt.grid()
    plt.legend()
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.savefig(phaseFigFilename)

    plt.figure()
    plt.plot(results['times'], results['ys'][0, :])
    results.close()
    plt.grid()
    plt.xlabel('Time (msec)')
    plt.ylabel('Voltage (mv)')
    plt.savefig(voltageFigFilename)

    plt.show()

    pdb.set_trace()
Exemplo n.º 8
0
def main(argv):
    if len(argv) != 3:
        print("Usage %s <I> <label>" % argv[0])
        return

    i0 = float(argv[1])
    label = argv[2]
    nMin = -0.1
    nMax = 0.7

    resultsFilename = 'results/integrationINapIKFig4-34%s.npz' % label
    phaseFigFilename = 'figures/fig4-34%sPhaseSpace.eps' % label
    voltageFigFilename = 'figures/fig4-34%sVoltage.eps' % label

    plt.figure()
    plotLowThresholdINapIKVectorField(I=i0, nMin=nMin, nMax=nMax)
    results = np.load(resultsFilename)
    ys = results["ys"]
    plt.plot(ys[0, :], ys[1, :], label="I=%d" % i0)
    plt.grid()
    plt.legend()
    plt.xlabel('Voltage (mv)')
    plt.ylabel('K activation variable, n')
    plt.savefig(phaseFigFilename)

    times = results["times"]
    plt.figure()
    plt.plot(times, ys[0, :], label="I=%d" % i0)
    results.close()
    plt.grid()
    plt.legend()
    plt.xlabel('Time (secs)')
    plt.ylabel('Voltage (mv)')
    plt.savefig(voltageFigFilename)

    pdb.set_trace()
Exemplo n.º 9
0
def main(argv):
    figFilename = 'figures/fig4-4.eps'
    plotLowThresholdINapIKVectorField()
    plt.savefig(figFilename)
    pdb.set_trace()