mitral_responses.append(array(mitral._vmTableSoma)) return (mitral_responses, mitral_responses_binned) #---------------------------------------------------------------- if __name__ == "__main__": sim = constOdorResponse() includeProjections = [] tweaks = build_tweaks(CLUB_MITRALS, NO_SPINE_INH, NO_SINGLES,\ NO_JOINTS, NO_MULTIS, NO_PGS, ONLY_TWO_MITS, includeProjections) BINNED = True ## if not BINNED, save the full mitral Vm-s ## and not just their spiketimes by setting spiketable = False below. network = OBNetwork(OBNet_file, synchan_activation_correction, tweaks,\ mpirank=mpirank, invivo=IN_VIVO, spiketable=BINNED) #printNetTree() # from moose_utils.py ## monitor those interneurons that are connected to mitral indices 0 and 1 ## save only spiketimes by setting extras_spikes_only=True sim.setupStim(network, avgnum=0) mitral_responses, mitral_responses_binned = sim.run(network, BINNED) figure() title('Glomerulus 0') if BINNED: deltabin = RESPIRATION / NUMBINS # Take only the last respiration cycle timevec = arange( SETTLETIME + (NUM_RESPS - 1) * RESPIRATION + deltabin / 2, RUNTIME, deltabin) mitral_responses = mitral_responses_binned
#### if only one process is called, plot one odor directly if mpisize == 1: sim = odorResponse() ## includeProjections gets used only if ONLY_TWO_MITS is True: ## Keep below projections to 'second order cells' ## i.e. to cells (granules) connected to mits0&1. ## The connections between second order cell ## and mits0&1 are automatically retained of course. ## 'PG' includes 'ORN_PG', 'PG_mitral', 'mitral_PG' and 'SA_PG' includeProjections = ['PG','granule_baseline'] tweaks = build_tweaks(CLUB_MITRALS, NO_SPINE_INH, NO_SINGLES, NO_JOINTS,\ NO_MULTIS, NO_PGS, ONLY_TWO_MITS, includeProjections, mitralsidekickidx) BINNED = False ## if not BINNED, save the full mitral Vm-s ## and not just their spiketimes by setting spiketable = False below. network = OBNetwork(OBNet_file, synchan_activation_correction, tweaks,\ mpirank, granfilebase, spiketable=BINNED) #printNetTree() # from moose_utils.py ## monitor those interneurons that are connected to mitral indices 0 and 1 ## save only spiketimes by setting extras_spikes_only=True #extras_spikes_only = True #tables = setupTables(network, NO_PGS, NO_SINGLES, NO_JOINTS,\ # {'mitrals':[0,1]}, spikes=extras_spikes_only) avgnum = 0 inhnum = 5 sim.setupStim(network, inhnum, avgnum) mitral_responses,mitral_responses_binned = sim.run(network,binned=BINNED) #if not extras_spikes_only: # timevec = arange(0.0,RUNTIME+1e-12,PLOTDT) # plot_extras(timevec, tables, NO_PGS, NO_SINGLES, NO_JOINTS)
if len(sys.argv)>2: uniquestr = sys.argv[2]+'_' # _ necessary, else say 'morphs2'+mpirank is screwed else: uniquestr = 'pulseinresp_' #### if only one process is called, plot one odor directly if mpisize == 1: sim = odorResponse() ## 'PG' includes 'ORN_PG', 'PG_mitral', 'mitral_PG' and 'SA_PG' if ONLY_TWO_MITS and not NO_PGS: includeProjections = ['PG'] else: includeProjections = [] tweaks = build_tweaks(CLUB_MITRALS, NO_SPINE_INH, NO_SINGLES,\ NO_JOINTS, NO_MULTIS, NO_PGS, ONLY_TWO_MITS,\ includeProjections=includeProjections, nolateral=NO_LATERAL) BINNED = False ## if not BINNED, save the full mitral Vm-s ## and not just their spiketimes by setting spiketable = False below. network = OBNetwork(OBNet_file, synchan_activation_correction, tweaks,\ mpirank, 'pulseinresp', granfilebase, spiketable=BINNED) #printNetTree() # from moose_utils.py ## monitor those interneurons that are connected to mitral indices 0 and 1 ## save only spiketimes by setting extras_spikes_only=True extras_spikes_only = True tables = setupTables(network, NO_PGS, NO_SINGLES, NO_JOINTS, NO_MULTIS,\ {'mitrals':[0,1]}, spikes=extras_spikes_only) ## To watch the pre compartment of mit2 that inhibits soma of mit 1 #mit2 = moose.Cell('/mitrals_2') #mit2.precomp = moose.Compartment(get_matching_children(mit2, ['Seg0_sec_dendd4_4_278'])[0]) #mit2._vmTablePrecomp = setupTable("vmTablePrecomp",mit2.precomp,'Vm') sim.setupStim(network, ('A',), avgnum=0) ## widely different resting potentials of mit0 and mit1 if VARY_MITS_RMP: tweak_field('/mitrals_0/##[TYPE=Compartment]', 'Em', '-58e-3') tweak_field('/mitrals_1/##[TYPE=Compartment]', 'Em', '-70e-3')
uniquestr = 'adi_' ## includeProjections gets used only if ONLY_TWO_MITS is True: ## Keep below projections to 'second order cells' ## i.e. to cells (granules) connected to mits0&1. ## The connections between second order cell ## and mits0&1 are automatically retained of course. ## no need for 'PG' below as 'ORN_PG' and 'SA_PG' are not needed, ## and 'PG_mitral', 'mitral_PG' connections to/from mits0&1 are kept automatically. includeProjections = ['granule_baseline'] tweaks = build_tweaks( CLUB_MITRALS, NO_SPINE_INH,\ NO_SINGLES, NO_JOINTS, NO_MULTIS, NO_PGS, ONLY_TWO_MITS,\ includeProjections, (mitralmainidx,mitralsidekickidx) ) ## send mpirank to put in ORN filenames / gran baseline temp files ## so they do not clash between mpi processes ## also, unique str, so that temp files of morphs, pulses, etc do not overlap network = OBNetwork(OBNet_file, synchan_activation_correction,\ tweaks, mpirank, uniquestr, granfilebase, spiketable=SPIKETABLE) #printNetTree() # from moose_utils.py setup_stim(network) ## if SPIKETABLE: record the Vm-s of a few interneurons ## else: record spiketimes of all interneurons tables = setupTables(network, NO_PGS, NO_SINGLES, NO_JOINTS, NO_MULTIS, args={'mitrals': (mitralmainidx, )}, spikes=SPIKETABLE) run_inhibition(network, tables)
if __name__ == "__main__": #### if only one process is called, plot one sim directly if mpisize == 1: #### run the slave processes sim = odorResponse() ## includeProjections gets used only if ONLY_TWO_MITS is True: ## Keep below projections to 'second order cells' ## i.e. to cells (granules) connected to mits0&1. ## The connections between second order cell ## and mits0&1 are automatically retained of course. # 'PG' includes 'ORN_PG', 'PG_mitral', 'mitral_PG' and 'SA_PG' includeProjections = ['PG','granule_baseline'] tweaks = build_tweaks(CLUB_MITRALS, NO_SPINE_INH, NO_SINGLES, NO_JOINTS,\ NO_MULTIS, NO_PGS, ONLY_TWO_MITS, includeProjections, mitralsidekickidx) network = OBNetwork(OBNet_file, synchan_activation_correction, tweaks,\ mpirank, granfilebase+'_noresp', spiketable=False) #printNetTree() # from moose_utils.py trialnum = 0 sinnum = 0 sim.setupStim(network, sinnum, trialnum) mitral_responses = sim.run(network, binned=False) timevec = arange(SETTLETIME,SETTLETIME+SIN_RUNTIME+3*PLOTDT/2.0,PLOTDT) plot(timevec, mitral_responses[0]) show() #### multiple processes else: if mpirank == boss: #### collate at boss process ## mitral_responses_list[avgnum][sinnum][mitnum][spikenum]
sim = PGvsGranule() includeProjections = [] # the post_segment on the mitral must be ~ this distance from the soma args = [100e-6, 'IPSP'] # meters elif sim_option == 'PGvsGranuleIPSC': sim = PGvsGranule() includeProjections = [] # the post_segment on the mitral must be ~ this distance from the soma args = [100e-6, 'IPSC'] # meters else: print "Sorry wrong option.", err_string sys.exit(1) tweaks = build_tweaks( CLUB_MITRALS, NO_SPINE_INH, NO_SINGLES, NO_JOINTS,\ NO_MULTIS, NO_PGS, ONLY_TWO_MITS, includeProjections, (mitralidx,mitralsidekickidx) ) network = OBNetwork(OBNet_file, synchan_activation_correction,\ tweaks, mpirank, granfilebase, spiketable=False) #printNetTree() # from moose_utils.py sim.setup_stim(network, args) spikes = True tables = setupTables(network, NO_PGS, NO_SINGLES, NO_JOINTS, spikes=spikes) sim.run_inhibition( network, args) # tests simset_inhibition i.e. inhibition between two mitrals if spikes: bins = 20 timevec = arange(0.0, REALRUNTIME, REALRUNTIME / float(bins)) plot_extras_spikes(timevec, tables, NO_PGS, NO_SINGLES, NO_JOINTS, bins, RUNTIME, SETTLETIME) else: timevec = arange(0.0, RUNTIME + 1e-12, PLOTDT)
if __name__ == "__main__": if mpisize == 1: ## if only one process is called, plot one odor directly sim = odorResponse() ## 'PG' includes 'ORN_PG', 'PG_mitral', 'mitral_PG' and 'SA_PG' if ONLY_TWO_MITS and not NO_PGS: includeProjections = ['PG'] else: includeProjections = [] tweaks = build_tweaks(CLUB_MITRALS, NO_SPINE_INH, NO_SINGLES,\ NO_JOINTS, NO_MULTIS, NO_PGS, ONLY_TWO_MITS,\ includeProjections=includeProjections, nolateral=NO_LATERAL) BINNED = True #False ## if not BINNED, save the full mitral Vm-s and ## not just their spiketimes by setting spiketable = False below. uniquestr = 'pulses_' network = OBNetwork(OBNet_file, synchan_activation_correction, tweaks,\ mpirank, uniquestr, granfilebase+'_noresp_extra', spiketable=BINNED) #printNetTree() # from moose_utils.py ## monitor those interneurons that are connected to mitral indices 0 and 1 ## save only spiketimes by setting spikes=True extras_spikes_only = False #True tables = setupTables(network, NO_PGS, NO_SINGLES, NO_JOINTS, NO_MULTIS,\ {'mitrals':[0,1]}, spikes=extras_spikes_only) ## pulse 0 is random air pulse, pulse 1 is odor A, ## pulse 2 is odor B, so on alternately, last pulse is A&B. pulse_i = 1 sim.setupStim(network, pulse_i, avgnum=0) ## widely different resting potentials of mit0 and mit1 if VARY_MITS_RMP: tweak_field('/mitrals_0/##[TYPE=Compartment]', 'Em', '-58e-3') tweak_field('/mitrals_1/##[TYPE=Compartment]', 'Em', '-70e-3') mit0soma_Im = setupTable('mit0somaIm', network.mitralTable[0].soma,