Exemple #1
0
def run(netdef,tosave,modify,procs,thisProc,stims,param,repeats,sim_time,SaveSpikes,SaveVoltage,SaveConductance,SaveCurrent):
    net = netdef()

    if SaveVoltage:
        net.recordVoltage()

    repeats = int(repeats)
    # Randomseed was 200 for most figures
    # Changed to 200 for rat
    # Changed to 200 for anurans
    s = Simulation(net, randomseed=202,delay=25)
    s.verbose = False
    s.sim_time = sim_time
    s.dt = 0.050
    total = len(stims)*len(param)*repeats
    spp = ceil(float(total)/procs)
    start = thisProc*spp
    end = (thisProc+1)*spp
    count = 0
    for a in param: 
        s.set_amplitude(net.sim_amp)
        for d in stims*repeats:
            if count >= start and count < end:
                net = modify(net,a,d)
                progress.update(count-start,spp,thisProc)
                s.stim_dur = d 
                s.run()
                key = [a,d] 
                net.savecells(tosave, key, spikes=SaveSpikes,voltage=SaveVoltage,conductance=SaveConductance,current=SaveCurrent)
            count += 1
    progress.update(spp,spp,thisProc)

    r = [thisProc,net.savedparams,net.savedcells]
    return r
Exemple #2
0
total = len(stims)*len(param)*repeats
print "Running %d simulations..." % total
count = 0

for a in param: 
    for net in networks:
        networks["AC"].cells["IC"]["cells"][0].sec["soma"].L = a
        networks["AC"].cells["IC"]["cells"][0].sec["soma"].diam = a
        networks["C"].cells["IC"]["cells"][0].sec["soma"].L = a
        networks["C"].cells["IC"]["cells"][0].sec["soma"].diam = a

    for d in stims*repeats:
        progress.update(count, total)
        count += 1
        for net in networks:
            s[net].stim_dur = d 
            s[net].run()
            key = [a,d] 
            networks[net].savecells([["IC","soma"],["IC","dendE"]], key, spikes=True, 
                                                                         conductance=False, 
                                                                         current=False, 
                                                                         voltage=True)

if True:
    ns.plot_mean_spikes(networks["C"], "IC-soma", "c_soma_size.dat")
    ns.plot_mean_spikes(networks["AC"], "IC-soma", "ac_soma_size.dat")
    ns.show()  # Comment out to just save the results to file

# Plot the results
if False:
    count = 0