-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
from neuromllite import * | ||
from neuromllite.NetworkGenerator import * | ||
from neuromllite.utils import create_new_model | ||
import sys | ||
|
||
sys.path.append("..") | ||
|
||
''' | ||
bAC217_L4_MC_5fa0a62bd0_0_0.cell.nml cADpyr229_L23_PC_c292d67a2e_0_0.cell.nml cADpyr231_L6_TPC_L4_117b9dfb71_0_0.cell.nml cNAC187_L1_HAC_f8c9772d9d_0_0.cell.nml Soma_AllNML2.cell.nml | ||
bNAC219_L1_DAC_a9ae5cbbf5_0_0.cell.nml cADpyr230_L4_SS_1afeb14f17_0_0.cell.nml cADpyr232_L5_TTPC1_0fb1ca4724_0_0.cell.nml cNAC187_L23_NBC_9d37c4b1f8_0_0.cell.nml | ||
cADpyr229_L23_PC_5ecbf9b163_0_0.cell.nml cADpyr231_L6_TPC_L1_44f2206f70_0_0.cell.nml cADpyr232_L5_UTPC_d736225429_0_0.cell.nml cSTUT189_L23_LBC_e6e8f83407_0_0.cell.nml | ||
''' | ||
colors = {'RS':'0 0 0.8', 'FS':'0.8 0 0', 'LTS':'0 0 0.8', 'IB':'0.8 0 0', 'IBR':'0.8 0 0'} | ||
colors = {'cADpyr229_L23_PC_c292d67a2e_0_0':'0 0 0.8', 'cNAC187_L23_NBC_9d37c4b1f8_0_0':'0.8 0 0'} | ||
|
||
def generate(cell, duration=3000, config='IClamp',parameters = None): | ||
|
||
reference = "%s_%s"%(config, cell) | ||
|
||
cell_id = '%s'%cell | ||
cell_nmll = Cell(id=cell_id, neuroml2_source_file='../%s.cell.nml'%(cell)) | ||
|
||
################################################################################ | ||
### Add some inputs | ||
|
||
if 'IClamp' in config: | ||
|
||
if not parameters: | ||
parameters = {} | ||
parameters['stim_amp'] = '350pA' | ||
|
||
input_source = InputSource(id='iclamp_0', | ||
neuroml2_input='PulseGenerator', | ||
parameters={'amplitude':'stim_amp', 'delay':'500ms', 'duration':'2000ms'}) | ||
|
||
|
||
else: | ||
|
||
if not parameters: | ||
parameters = {} | ||
parameters['average_rate'] = '100 Hz' | ||
parameters['number_per_cell'] = '10' | ||
|
||
input_source = InputSource(id='pfs0', | ||
neuroml2_input='PoissonFiringSynapse', | ||
parameters={'average_rate':'average_rate', | ||
'synapse':syn_exc.id, | ||
'spike_target':"./%s"%syn_exc.id}) | ||
|
||
sim, net = create_new_model(reference, | ||
duration, | ||
dt=0.025, # ms | ||
temperature=34, # degC | ||
default_region='Cortex', | ||
parameters = parameters, | ||
cell_for_default_population=cell_nmll, | ||
color_for_default_population=colors[cell], | ||
input_for_default_population=input_source) | ||
|
||
return sim, net | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
|
||
if '-all' in sys.argv: | ||
for cell in colors: | ||
generate(cell, 3000, config="IClamp") | ||
|
||
|
||
else: | ||
|
||
#sim, net = generate('cADpyr229_L23_PC_c292d67a2e_0_0', 3000, config="IClamp") | ||
sim, net = generate('cNAC187_L23_NBC_9d37c4b1f8_0_0', 3000, config="IClamp",parameters={'stim_amp':'30pA'}) | ||
|
||
check_to_generate_or_run(sys.argv, sim) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
### BBP cell summary | ||
<table> | ||
<tr> | ||
<td width=30><b>cADpyr229_L23_PC_c292d67a2e_0_0</b></td> | ||
<td><a href="mean_spike_frequency_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="firing_rates_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="firing_rates_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="heatmap_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="dt_traces_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="dt_traces_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="heatmap_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="mean_spike_frequency_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<tr> | ||
<tr> | ||
<td width=30><b>cNAC187_L23_NBC_9d37c4b1f8_0_0</b></td> | ||
<td><a href="mean_spike_frequency_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="firing_rates_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="firing_rates_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="heatmap_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="dt_traces_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="dt_traces_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="heatmap_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="mean_spike_frequency_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
import sys | ||
|
||
import pprint; pp = pprint.PrettyPrinter(depth=6) | ||
|
||
from neuromllite.sweep.ParameterSweep import ParameterSweep | ||
from neuromllite.sweep.ParameterSweep import NeuroMLliteRunner | ||
|
||
|
||
|
||
from GenerateExamples import colors | ||
|
||
if __name__ == '__main__': | ||
|
||
heatmap_lims=[-110,-20] | ||
|
||
if '-all' in sys.argv: | ||
|
||
print('Generating all plots') | ||
save_fig_dir = './' | ||
html = '<table>\n' | ||
|
||
fixed = {'dt':0.025, 'duration':3000} | ||
|
||
|
||
vary = {'stim_amp':['%spA'%(i) for i in xrange(-100,1000,50)]} | ||
#vary = {'stim_amp':['%spA'%(i/10.0) for i in xrange(-10,20,5)]} | ||
#vary = {'stim_amp':['-100pA','0pA','100pA','200pA','300pA','400pA']} | ||
|
||
cells = colors.keys() | ||
|
||
for type in cells: | ||
if type!='ec' and type !='ca3': | ||
|
||
run = True | ||
run = False | ||
|
||
if run: | ||
|
||
nmllr = NeuroMLliteRunner('Sim_IClamp_%s.json'%type, | ||
simulator='jNeuroML_NEURON') | ||
ps = ParameterSweep(nmllr, | ||
vary, | ||
fixed, | ||
num_parallel_runs=16, | ||
save_plot_all_to='firing_rates_%s.png'%type, | ||
heatmap_all=True, | ||
save_heatmap_to='heatmap_%s.png'%type, | ||
heatmap_lims=heatmap_lims, | ||
plot_all=True, | ||
show_plot_already=False) | ||
|
||
report = ps.run() | ||
|
||
#ps.plotLines('stim_amp','average_last_1percent',save_figure_to='average_last_1percent_%s.png'%type) | ||
ps.plotLines('stim_amp','mean_spike_frequency',save_figure_to='mean_spike_frequency_%s.png'%type) | ||
|
||
height = '160' | ||
html+='<tr>\n' | ||
html+=' <td width=30><b>'+type+'</b></td>\n' | ||
html+=' <td><a href="mean_spike_frequency_%s.png'%type+'">\n' | ||
html+=' <img alt="?" src="mean_spike_frequency_%s.png'%type+'" height="'+height+'"/></a>\n' | ||
html+=' </td>\n' | ||
html+=' <td><a href="firing_rates_%s.png'%type+'">\n' | ||
html+=' <img alt="?" src="firing_rates_%s.png'%type+'" height="'+height+'"/></a>\n' | ||
html+=' </td>\n' | ||
html+=' <td><a href="heatmap_%s.png'%type+'">\n' | ||
html+=' <img alt="?" src="heatmap_%s.png'%type+'" height="'+height+'"/></a>\n' | ||
html+=' </td>\n' | ||
html+=' <td><a href="dt_traces_%s.png'%type+'">\n' | ||
html+=' <img alt="?" src="dt_traces_%s.png'%type+'" height="'+height+'"/></a>\n' | ||
html+=' </td>\n' | ||
html+=' <td><a href="heatmap_dt_%s.png'%type+'">\n' | ||
html+=' <img alt="?" src="heatmap_dt_%s.png'%type+'" height="'+height+'"/></a>\n' | ||
html+=' </td>\n' | ||
html+=' <td><a href="mean_spike_frequency_dt_%s.png'%type+'">\n' | ||
html+=' <img alt="?" src="mean_spike_frequency_dt_%s.png'%type+'" height="'+height+'"/></a>\n' | ||
html+=' </td>\n' | ||
html+='<tr>\n' | ||
|
||
import matplotlib.pyplot as plt | ||
if not '-nogui' in sys.argv: | ||
print("Showing plots") | ||
plt.show() | ||
|
||
|
||
with open(save_fig_dir+'info.html','w') as f: | ||
f.write('<html><body>\n%s\n</body></html>'%html) | ||
with open(save_fig_dir+'README.md','w') as f2: | ||
f2.write('### BBP cell summary \n%s'%(html.replace('.html','.md'))) | ||
|
||
elif '-dt' in sys.argv: | ||
|
||
|
||
optimal_stim = {'cADpyr229_L23_PC_c292d67a2e_0_0':'500', | ||
'cNAC187_L23_NBC_9d37c4b1f8_0_0':'30'} | ||
|
||
vary = {'dt':[0.1,0.05,0.025,0.01,0.005,0.0025,0.001,0.0005,0.00025,0.0001]} | ||
vary = {'dt':[0.1,0.05,0.025,0.01,0.005,0.0025,0.001]} | ||
vary = {'dt':[0.05,0.025,0.01,0.005,0.0025]} | ||
#vary = {'dt':[0.05,0.025,0.01,0.005]} | ||
#vary = {'dt':[0.05,0.025,0.01]} | ||
#vary = {'dt':[0.05,0.025,0.01]} | ||
|
||
for type in optimal_stim: | ||
if type!='ec' and type !='ca3': | ||
|
||
run = True | ||
|
||
if run: | ||
|
||
fixed = {'duration':3000, 'stim_amp':'%spA'%optimal_stim[type]} | ||
|
||
nmllr = NeuroMLliteRunner('Sim_IClamp_%s.json'%type, | ||
simulator='jNeuroML_NEURON') | ||
ps = ParameterSweep(nmllr, | ||
vary, | ||
fixed, | ||
num_parallel_runs=16, | ||
save_plot_all_to='dt_traces_%s.png'%type, | ||
heatmap_all=True, | ||
save_heatmap_to='heatmap_dt_%s.png'%type, | ||
heatmap_lims=heatmap_lims, | ||
plot_all=True, | ||
show_plot_already=False) | ||
|
||
report = ps.run() | ||
|
||
#ps.plotLines('stim_amp','average_last_1percent',save_figure_to='average_last_1percent_%s.png'%type) | ||
ps.plotLines('dt','mean_spike_frequency',save_figure_to='mean_spike_frequency_dt_%s.png'%type, logx=True) | ||
|
||
|
||
|
||
import matplotlib.pyplot as plt | ||
if not '-nogui' in sys.argv: | ||
print("Showing plots") | ||
plt.show() | ||
|
||
|
||
else: | ||
|
||
fixed = {'dt':0.025, 'duration':3000} | ||
|
||
quick = False | ||
#quick=True | ||
|
||
vary = {'stim_amp':['%spA'%(i/10.0) for i in xrange(-10,20,2)]} | ||
vary = {'dt':[0.1,0.05,0.025,0.01,0.005,0.0025,0.001,0.0005,0.00025,0.0001]} | ||
vary = {'dt':[0.1,0.05,0.025,0.01,0.005,0.0025,0.001]} | ||
vary = {'dt':[0.1,0.05,0.025,0.01,0.005]} | ||
|
||
#vary = {'number_per_cell':[i for i in xrange(0,250,10)]} | ||
#vary = {'stim_amp':['1pA','1.5pA','2pA']} | ||
vary = {'stim_amp':['%spA'%(i) for i in xrange(-100,1000,50)]} | ||
|
||
type = 'RS' | ||
type = 'cADpyr229_L23_PC_c292d67a2e_0_0' | ||
type = 'cNAC187_L23_NBC_9d37c4b1f8_0_0' | ||
#type='poolosyn' | ||
config = 'IClamp' | ||
#config = 'PoissonFiringSynapse' | ||
|
||
nmllr = NeuroMLliteRunner('Sim_%s_%s.json'%(config,type), | ||
simulator='jNeuroML_NEURON') | ||
|
||
if quick: | ||
pass | ||
|
||
ps = ParameterSweep(nmllr, vary, fixed, | ||
num_parallel_runs=16, | ||
plot_all=True, | ||
save_plot_all_to='firing_rates_%s.png'%type, | ||
heatmap_all=True, | ||
save_heatmap_to='heatmap_%s.png'%type, | ||
heatmap_lims=heatmap_lims, | ||
show_plot_already=False) | ||
|
||
report = ps.run() | ||
ps.print_report() | ||
|
||
#ps.plotLines('stim_amp','average_last_1percent',save_figure_to='average_last_1percent_%s.png'%type) | ||
ps.plotLines('stim_amp','mean_spike_frequency',save_figure_to='mean_spike_frequency_%s.png'%type) | ||
#ps.plotLines('dt','mean_spike_frequency',save_figure_to='mean_spike_frequency_%s.png'%type, logx=True) | ||
#ps.plotLines('number_per_cell','mean_spike_frequency',save_figure_to='poisson_mean_spike_frequency_%s.png'%type) | ||
|
||
import matplotlib.pyplot as plt | ||
if not '-nogui' in sys.argv: | ||
print("Showing plots") | ||
plt.show() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+93.2 KB
NMC/NeuroML2/nmllite/firing_rates_cADpyr229_L23_PC_c292d67a2e_0_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<html><body> | ||
<table> | ||
<tr> | ||
<td width=30><b>cADpyr229_L23_PC_c292d67a2e_0_0</b></td> | ||
<td><a href="mean_spike_frequency_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="firing_rates_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="firing_rates_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="heatmap_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="dt_traces_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="dt_traces_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="heatmap_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="mean_spike_frequency_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png" height="160"/></a> | ||
</td> | ||
<tr> | ||
<tr> | ||
<td width=30><b>cNAC187_L23_NBC_9d37c4b1f8_0_0</b></td> | ||
<td><a href="mean_spike_frequency_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="firing_rates_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="firing_rates_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="heatmap_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="dt_traces_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="dt_traces_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="heatmap_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="heatmap_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<td><a href="mean_spike_frequency_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png"> | ||
<img alt="?" src="mean_spike_frequency_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png" height="160"/></a> | ||
</td> | ||
<tr> | ||
|
||
</body></html> |
Binary file added
BIN
+24.2 KB
NMC/NeuroML2/nmllite/mean_spike_frequency_cADpyr229_L23_PC_c292d67a2e_0_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26.5 KB
NMC/NeuroML2/nmllite/mean_spike_frequency_cNAC187_L23_NBC_9d37c4b1f8_0_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
NMC/NeuroML2/nmllite/mean_spike_frequency_dt_cADpyr229_L23_PC_c292d67a2e_0_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13 KB
NMC/NeuroML2/nmllite/mean_spike_frequency_dt_cNAC187_L23_NBC_9d37c4b1f8_0_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.