Ejemplo n.º 1
0
        ei_net.setConstantVelocityCurrent_e(const_v)

        stateRecF_e = choice(ei_net.E_pop, options.gammaNSample, replace=False)
        stateRecF_i = choice(ei_net.I_pop, options.gammaNSample, replace=False)

        stateMonF_e_params = {
            'withtime': False,
            'interval': options.sim_dt * 10,
            'record_from': ['I_clamp_GABA_A']
        }

        stateMonF_e = ei_net.getGenericStateMonitor(stateRecF_e,
                                                    stateMonF_e_params,
                                                    'stateMonF_e')

        d['net_params'] = ei_net.getNetParams()  # Common settings will stay
        d.flush()

        ei_net.simulate(options.time, printTime=options.printTime)
        ei_net.endSimulation()
        d['trials'].append(signal_analysis(ei_net.getAllData()))
        d.flush()
        constrT, simT, totalT = ei_net.printTimes()
        overalT += totalT
    except NESTError as e:
        print("Simulation interrupted. Message: {0}".format(str(e)))
        print("Trying to save the simulated data if possible...")
        break

d.close()
print("Script total run time: {0} s".format(overalT))
out = []
overalT = 0.
################################################################################
for trial_idx in range(o.ntrials):
    print("\n\t\tStarting trial no. {0}\n".format(trial_idx))
    seed_gen.set_generators(trial_idx)
    d['master_seed'] = int(o.master_seed)
    d['invalidated'] = 1

    ei_net = BasicGridCellNetwork(o, simulationOpts=None)

    ei_net.endConstruction()
    ei_net.beginSimulation()

    data = ei_net.getNetParams()
    # E --> I neurons
    data['g_IE'] = ei_net.getConnMatrix("E")
    # I --> E neurons
    data['g_EI'] = ei_net.getConnMatrix("I")

    ei_net.endSimulation()

    out.append(data)
    constrT, simT, totalT = ei_net.printTimes()
    overalT += totalT

d["trials"] = out
d.close()
print("Script total run time: {0} s".format(overalT))
################################################################################
out = []
overalT = 0.
################################################################################
for trial_idx in range(o.ntrials):
    print("\n\t\tStarting trial no. {0}\n".format(trial_idx))
    seed_gen.set_generators(trial_idx)
    d['master_seed'] = o.master_seed
    d['invalidated'] = 1

    ei_net = BasicGridCellNetwork(o, simulationOpts=None)

    ei_net.endConstruction()
    ei_net.beginSimulation()

    data = ei_net.getNetParams()
    # E --> I neurons
    data['g_IE'] = ei_net.getConnMatrix("E")
    # I --> E neurons
    data['g_EI'] = ei_net.getConnMatrix("I")

    ei_net.endSimulation()

    out.append(data)
    constrT, simT, totalT = ei_net.printTimes()
    overalT += totalT

d["trials"] = out
d.close()
print("Script total run time: {0} s".format(overalT))
################################################################################