Esempio n. 1
0
                            except RuntimeError:
                                hasErred = 1
                                print "Too large g!"
                                if iterg == 1:
                                    nextgs = [0.0, 0.0015, 0.00075]
                                    continue
                                else:
                                    nextgs = [
                                        nextgs[0], nextgs[2],
                                        nextgs[0] + nextgs[2]
                                    ]
                                continue

                            times = np.array(h.tvec)
                            Vsoma = np.array(h.vsoma)
                            spikes = mytools.spike_times(
                                times, Vsoma, -50, -50)
                            nSpikes1 = len(spikes)
                            hasSpiked = hasSpiked or (nSpikes1 > 0)
                            if nSpikes1 > 0 and nSpikes1 < minNSpikes:
                                minNSpikes = nSpikes1

                            print "iterg=" + str(iterg) + " done, g=" + str(
                                thisg) + ", " + str(nSpikes1) + " spikes"
                            if iterg == 0 and nSpikes1 > 0:
                                print "Even zero g causes spiking!! igene=" + str(
                                    igene) + ", imut=" + str(
                                        imut) + ", iallmutval=" + str(
                                            iallmutval) + ", iter=" + str(
                                                iter) + ", spike at " + str(
                                                    spikes[0])
                                nextgs = [0.0, 0.0, 0.0]
Esempio n. 2
0
  v_init = """ + str(v0) + """
  cai0_ca_ion = """ + str(ca0) + """
  st1.amp = """ + str(squareAmp) + """
  st1.del = 200
  st1.dur = """ + str(squareDur) + """
  """)
            h.init()
            h.run()

            times = np.array(h.tvec)
            Vsoma = np.array(h.vsoma)
            close("all")
            f, axarr = subplots(2, 1)
            axarr[0].plot(times, Vsoma)
            axarr[1].plot(times, Vsoma)
            spikes = mytools.spike_times(times, Vsoma, -20, -45)
            spikes2 = mytools.spike_times(times, Vsoma, -35, 100)
            isis = [y - x for x, y in zip(spikes[0:-1], spikes[1:])]
            if len(isis) > 0 and mean(isis) != 0:
                CVISI = std(isis) / mean(isis)  #std is defined in pylab
            else:
                CVISI = nan  #NaN defined in pylab

            ispikelastburst = -1
            nspikesperbursts = []
            nspikesperbursts2 = []
            for ispike in range(0, len(isis)):
                if isis[ispike] > 1.1 * mean(isis):
                    nspikesperbursts.append(ispike - ispikelastburst)
                    ispikelastburst = ispike
            if len(nspikesperbursts) >= 2:
Esempio n. 3
0
    h("""
tstop = """+str(tstop)+"""
v_init = """+str(v0)+"""
cai0_ca_ion = """+str(ca0)+"""
st1.amp = """+str(squareAmp)+"""
st1.dur = """+str(squareDur)+"""
""")
    h.init()
    h.run()

    times=np.array(h.tvec)
    Vsoma=np.array(h.vsoma)
    Vdend=np.array(h.vdend)
    Casoma=np.array(h.casoma)
    Cadend=np.array(h.cadend)
    spikes = mytools.spike_times(times,Vsoma,0,100)
    spikfreqs[iI] = sum([1 for x in spikes if x >= 500.0])/3.5

    f, axarr = subplots(1, 1)
    axarr.plot(times, Vsoma)
    axarr.plot(spikes, [1 for x in spikes],'r.')
    axarr.set_title("Perisomatic firing, nspikes="+str(len(spikes))+", after 300ms nspikes="+str(sum([1 for x in spikes if x >= 3700.0])))
    axarr.set_ylim([-100,40])
    axarr.set_xlim([3390,7200])
    f.savefig("runcontrols_cs"+str(icell)+"_"+str(iI)+".eps")

    if abs(Is[iI]-1.0) < 0.0001:
      Vsoma_control = Vsoma
      Casoma_control = Casoma
      Vdend_control = Vdend
      Cadend_control = Cadend
""")
                        timeStart_dt = time.time()
                        h.init()
                        h.run()
                        print "Simulation done in " + str(
                            time.time() - timeStart_dt) + " seconds"
                        times = np.array(h.tvec)
                        Vsoma = np.array(h.vsoma)
                        Casoma = np.array(h.casoma)
                        SKsoma = np.array(h.sksoma)
                        Vdend = np.array(h.vdend)
                        Vdend2 = np.array(h.vdend2)
                        Vdend3 = np.array(h.vdend3)
                        Cadend3 = np.array(h.cadend3)
                        SKdend3 = np.array(h.skdend3)
                        spikes = mytools.spike_times(times, Vsoma, -35, -45)

                        CasomaupThisIter.append(max(Casoma))
                        SKsomaupThisIter.append(max(SKsoma))
                        VdendupThisIter.append(max(Vdend))
                        Vdend2upThisIter.append(max(Vdend2))
                        Vdend3upThisIter.append(max(Vdend3))
                        Cadend3upThisIter.append(max(Cadend3))
                        SKdend3upThisIter.append(max(SKdend3))
                        spikesupThisIter.append(spikes[:])

                        times_tcshort = [2900 + x for x in range(0, 301)]
                        Vdend3tcupThisIter.append(
                            mytools.interpolate(times, Vdend3, times_tcshort))
                        Cadend3tcupThisIter.append(
                            mytools.interpolate(times, Cadend3, times_tcshort))
Esempio n. 5
0
cai0_ca_ion = """ + str(ca0) + """
v_init = """ + str(v0) + """
syn1.onset = """ + str(1000) + """
""")
            h.init()
            try:
                h.run()
            except RuntimeError:
                print "Too large I!"
                nextIs = [nextIs[0], nextIs[2], 0.5 * (nextIs[0] + nextIs[2])]
                continue
            times = np.array(h.tvec)
            Vsoma = np.array(h.vsoma)
            Vdend = np.array(h.vdend)

            nSpikes = len(mytools.spike_times(times, Vsoma, -20, -45))
            if iter > 2 and nSpikes > 0:
                nextIs = [nextIs[0], nextIs[2], 0.5 * (nextIs[0] + nextIs[2])]
            if iter > 2 and nSpikes == 0:
                nextIs = [nextIs[2], nextIs[1], 0.5 * (nextIs[2] + nextIs[1])]
            print str(nSpikes) + ", nextIs=" + str(nextIs)
            Is.append(nextIs[2])

            picklelist = [Is, dists, idist]
            file = open(
                'apicalthresholds_epsp_icell' + str(icell) + '_dist' +
                str(dists[idist]) + '.sav', 'w')
            pickle.dump(picklelist, file)
            file.close()

        IsAll.append(Is[:])