Skip to content

Commit 8b58752

Browse files
committed
Test tuning iclamp
1 parent 39739a7 commit 8b58752

File tree

2 files changed

+93
-5
lines changed

2 files changed

+93
-5
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/CElegans/pythonScripts/c302/LEMS_TestOsc.xml
2+
/CElegans/pythonScripts/c302/TestOsc.nml
13
/CElegans/pythonScripts/c302/LEMS_Test.xml
24
/CElegans/pythonScripts/c302/LEMS_c302_A_Syns2.xml
35
/CElegans/pythonScripts/c302/Test.nml

CElegans/pythonScripts/c302/tune/c302NetTuner.py

+91-5
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ def run_optimisation(prefix,
337337
target_data,
338338
sim_time = 500,
339339
dt = 0.1,
340-
population_size = 40,
341-
max_evaluations = 120,
340+
population_size = 20,
341+
max_evaluations = 50,
342342
num_selected = 3,
343343
num_offspring = 3,
344344
mutation_rate = 0.1,
@@ -353,9 +353,10 @@ def run_optimisation(prefix,
353353

354354
my_controller = C302Controller('TestOsc', 'C1', 'Oscillator', sim_time, 0.1, simulator = simulator)
355355

356-
sim_var = OrderedDict([('exc_syn_conductance',10),
357-
('inh_syn_conductance',10),
358-
('unphysiological_offset_current',0.38)])
356+
sim_var = OrderedDict([('exc_syn_conductance',0.0440481886416),
357+
('inh_syn_conductance',0.0236199415714),
358+
('elec_syn_gbase',0.0005),
359+
('unphysiological_offset_current',4.38952826613)])
359360

360361
example_run_t, example_run_v = my_controller.run_individual(sim_var, show=True)
361362

@@ -381,6 +382,91 @@ def run_optimisation(prefix,
381382
analysis = example_run_analysis.analyse(weights.keys())
382383

383384
pp.pprint(analysis)
385+
386+
elif '-icC1' in sys.argv or '-icC1one' in sys.argv:
387+
388+
'''
389+
self.add_bioparameter("leak_cond_density", "0.1 mS_per_cm2", "BlindGuess", "0.1")
390+
self.add_bioparameter("k_slow_cond_density", "0.5 mS_per_cm2", "BlindGuess", "0.1")
391+
self.add_bioparameter("k_fast_cond_density", "0.05 mS_per_cm2", "BlindGuess", "0.1")
392+
self.add_bioparameter("ca_boyle_cond_density", "0.5 mS_per_cm2", "BlindGuess", "0.1")'''
393+
394+
parameters = ['leak_cond_density',
395+
'k_slow_cond_density',
396+
'k_fast_cond_density',
397+
'ca_boyle_cond_density',
398+
'unphysiological_offset_current']
399+
400+
#above parameters will not be modified outside these bounds:
401+
min_constraints = [.01,.1, 0.01, .1, 3]
402+
max_constraints = [.2, 1, 0.1, 1, 8]
403+
404+
weights = {}
405+
target_data = {}
406+
407+
for cell in ['ADAL']:
408+
var = '%s/0/GenericCell/v:mean_spike_frequency'%cell
409+
weights[var] = 1
410+
target_data[var] = 4
411+
412+
if '-icC1' in sys.argv:
413+
414+
simulator = 'jNeuroML_NEURON'
415+
run_optimisation('Test',
416+
'IClamp',
417+
'C1',
418+
parameters,
419+
max_constraints,
420+
min_constraints,
421+
weights,
422+
target_data,
423+
sim_time = 1000,
424+
dt = 0.1,
425+
population_size = 50,
426+
max_evaluations = 120,
427+
num_selected = 10,
428+
num_offspring = 15,
429+
mutation_rate = 0.1,
430+
num_elites = 1,
431+
seed = 123477,
432+
nogui = nogui,
433+
simulator = simulator)
434+
else:
435+
436+
sim_time = 1000
437+
simulator = 'jNeuroML_NEURON'
438+
439+
my_controller = C302Controller('TestOsc', 'C1', 'IClamp', sim_time, 0.1, simulator = simulator)
440+
441+
sim_var = OrderedDict([('leak_cond_density',0.1),
442+
('k_slow_cond_density',0.5),
443+
('k_fast_cond_density',0.05),
444+
('ca_boyle_cond_density',0.5)])
445+
446+
example_run_t, example_run_v = my_controller.run_individual(sim_var, show=True)
447+
448+
print("Have run individual instance...")
449+
450+
peak_threshold = -10
451+
452+
analysis_var = {'peak_delta': 0,
453+
'baseline': 0,
454+
'dvdt_threshold': 0,
455+
'peak_threshold': peak_threshold}
456+
457+
example_run_analysis=analysis.NetworkAnalysis(example_run_v,
458+
example_run_t,
459+
analysis_var,
460+
start_analysis=0,
461+
end_analysis=sim_time)
462+
463+
analysis = example_run_analysis.analyse()
464+
465+
pp.pprint(analysis)
466+
467+
analysis = example_run_analysis.analyse(weights.keys())
468+
469+
pp.pprint(analysis)
384470

385471
elif '-phar' in sys.argv:
386472

0 commit comments

Comments
 (0)