-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_AP_i.py
More file actions
41 lines (27 loc) · 1.49 KB
/
setup_AP_i.py
File metadata and controls
41 lines (27 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""setup the AP current stimulus based on AP_time_current_pairs and a
passed index to these pairs. Let the first element in the pair (the
time of the AP) be the base_dir_name.py suffix and the second element
needs to be assigned to the h.IClamp[0].amp throughout calc_ca_suppr
and figs_incl_suppl.py"""
import sys
print(sys.argv)
AP_i_index=eval(sys.argv[-1])
from AP_time_current_pairs import *
print(AP_time_current_pairs[AP_i_index])
AP_time=AP_time_current_pairs[AP_i_index][0]
from neuron import h
# setup base_dir_name
h.system(rf'''sed -e "96s/.*/base_dir_name=\'\"20251224_AP_time{AP_time}\/\"\'/" configure_sim.py.orig > configure_sim.py''')
# setup current amplitude and tstop
amplitude=AP_time_current_pairs[AP_i_index][1]
# change tstop on line 35 and 43 and add a IClamp[0].amp setting on line 41
# of run_tGAR_blocked.py
h.system(r'sed -e "35s/.*/ h.tstop=400/" run_tGAR_blocked.py.template > run_tGAR_blocked.py.tmp')
h.system(fr'sed -e "41s/.*/ h.IClamp[0].amp={amplitude}/" run_tGAR_blocked.py.tmp > run_tGAR_blocked.py.tmp1')
h.system(r'sed -e "43s/.*/ my_run(400)/" run_tGAR_blocked.py.tmp1 > run_tGAR_blocked.py')
# add IClamp[0].amp setting on line 66
h.system(fr'sed -e "66s/.*/h.IClamp[0].amp={amplitude}/" run_tGAR_control.py.template > run_tGAR_control.py.tmp')
# change line 71 to "tstop" of 400
h.system(r'sed -e "71s/.*/my_run(400)/" run_tGAR_control.py.tmp > run_tGAR_control.py')
# these changes will be persistent when figs_incl_suppl.py and
# ca_calc_suppr.py are run.