2525
2626ignore_params = ["cm" , "Ra" , "ena" , "ek" ]
2727
28- # Due to the use of 1e-4 in BREAKPOINT in StochKv.mod: ik = 1e-4 * gk * (v - ek)
28+ # Due to the use of 1e-4 in BREAKPOINT in StochKv.mod:
29+ # ik = 1e-4 * gk * (v - ek)
2930density_scales = {"StochKv" : 1e-4 }
3031
3132channel_substitutes = {"StochKv" : "StochKv_deterministic" }
@@ -95,8 +96,10 @@ def adapt_CaDynamics_nml(
9596 channel_dir (str): repo in which to copy the channel files
9697 """
9798 place_after = (
98- ' <concentrationModel id="CaDynamics_E2_NML2" type="concentrationModelHayEtAl" '
99- 'minCai="1e-4 mM" decay="80 ms" depth="0.1 um" gamma="0.05" ion="ca"/>\n '
99+ ' <concentrationModel id="CaDynamics_E2_NML2" '
100+ 'type="concentrationModelHayEtAl" '
101+ 'minCai="1e-4 mM" decay="80 ms" depth="0.1 um" '
102+ 'gamma="0.05" ion="ca"/>\n '
100103 )
101104 cadyn_filename = "baseCaDynamics_E2_NML2.nml"
102105 new_cadyn_filename = "CaDynamics_E2_NML2.nml"
@@ -112,7 +115,7 @@ def adapt_CaDynamics_nml(
112115 f'gamma="{ value_dict ["gamma" ]} " '
113116 f'decay="{ value_dict ["decay" ]} ms" depth="0.1 um"/>\n '
114117 )
115- if not new_concentration in lines :
118+ if new_concentration not in lines :
116119 idx = lines .index (place_after ) + 2 # 2 to account for blank line
117120 lines .insert (idx , f"{ new_concentration } \n " )
118121
@@ -136,7 +139,9 @@ def get_channel_from_param_name(param_name):
136139 elif len (split_name ) == 2 :
137140 channel = split_name [1 ]
138141 else :
139- raise Exception (f"Could not extract channel from parameter name { param_name } " )
142+ raise Exception (
143+ f"Could not extract channel from parameter name { param_name } "
144+ )
140145
141146 return channel
142147
@@ -152,7 +157,8 @@ def format_dist_fun(raw_expr, value, dist_param_names):
152157 """
153158 if dist_param_names is not None :
154159 raise NotImplementedError (
155- "Functions that depend on other parameters, like decay function, are not implemented yet."
160+ "Functions that depend on other parameters, "
161+ "like decay function, are not implemented yet."
156162 )
157163 new_expr = raw_expr .format (distance = "p" , value = value )
158164 if "math" in new_expr :
@@ -224,8 +230,10 @@ def get_arguments(
224230 parameter_name (str): name of the parameter (e.g. e_pas)
225231 section_list (str): name of the location of the parameter (e.g. axonal)
226232 channel (str): ion channel (e.g. StochKv)
227- channel_name (str): ion channel name used in the neuroML channel file (e.g. StochKv_deterministic)
228- variable_parameters (list of neuroml.VariableParameter): parameters for non-uniform distributions
233+ channel_name (str): ion channel name used in the neuroML channel file
234+ (e.g. StochKv_deterministic)
235+ variable_parameters (list of neuroml.VariableParameter):
236+ parameters for non-uniform distributions
229237 cond_density (str): conductance density
230238 release_params (dict): optimized parameters
231239 """
@@ -240,7 +248,6 @@ def get_arguments(
240248 erev = None
241249 channel_class = "ChannelDensityNernst"
242250 elif erev == "pas" :
243- # do all pas have the same section_list? e.g. does it happen to have g_pas.all and e_pas.somatic?
244251 erev = params [f"e_pas.{ section_list } " ].value
245252 if erev is None :
246253 # non frozen parameter
@@ -338,7 +345,8 @@ def get_density(
338345 cell (ephys.CellModel)
339346 parameter (ephys.parameters)
340347 section_list (str): location
341- included_channels (list): list of channels already included in the nml file
348+ included_channels (list): list of channels already included
349+ in the nml file
342350 skip_non_uniform (bool): True to skip non uniform distributions
343351 release_params (dict): optimized parameters
344352 skip_channels_copy (bool): True to skip the copy pasting
@@ -397,7 +405,9 @@ def get_specific_capacitance(capacitance_overwrites):
397405 capacitance = default_capacitances [section_list ]
398406
399407 specific_capacitances .append (
400- neuroml .SpecificCapacitance (value = capacitance , segment_groups = section_list )
408+ neuroml .SpecificCapacitance (
409+ value = capacitance , segment_groups = section_list
410+ )
401411 )
402412
403413 return specific_capacitances
@@ -426,7 +436,7 @@ def get_biophys(
426436 included_channels = []
427437 channel_densities = []
428438 channel_density_nernsts = []
429- channel_density_non_uniform_nernsts = []
439+ channel_density_non_unif_nernsts = []
430440 channel_density_non_uniforms = []
431441 species = []
432442
@@ -460,8 +470,12 @@ def get_biophys(
460470 # add density to list of densities
461471 if channel_class == "ChannelDensityNernst" :
462472 channel_density_nernsts .append (density )
463- elif channel_class == "ChannelDensityNernstNonUniform" :
464- channel_density_non_uniform_nernsts .append (density )
473+ elif (
474+ channel_class == "ChannelDensityNernstNonUniform"
475+ ):
476+ channel_density_non_unif_nernsts .append (
477+ density
478+ )
465479 elif channel_class == "ChannelDensityNonUniform" :
466480 channel_density_non_uniforms .append (density )
467481 else :
@@ -474,7 +488,7 @@ def get_biophys(
474488 # non frozen parameter
475489 value = release_params [parameter .name ]
476490
477- if not model in concentrationModels :
491+ if model not in concentrationModels :
478492 concentrationModels [model ] = {}
479493 concentrationModels [model ]["gamma" ] = value
480494
@@ -493,15 +507,17 @@ def get_biophys(
493507
494508 channel_nml2_file = "CaDynamics_E2_NML2.nml"
495509 add_nml_channel_to_nml_cell_file (
496- cell_doc , included_channels , channel_nml2_file = channel_nml2_file
510+ cell_doc ,
511+ included_channels ,
512+ channel_nml2_file = channel_nml2_file ,
497513 )
498514
499515 value = parameter .value
500516 if value is None :
501517 # non frozen parameter
502518 value = release_params [parameter .name ]
503519
504- if not model in concentrationModels :
520+ if model not in concentrationModels :
505521 concentrationModels [model ] = {}
506522 concentrationModels [model ]["decay" ] = value
507523
@@ -524,15 +540,17 @@ def get_biophys(
524540 membrane_properties = neuroml .MembraneProperties (
525541 channel_densities = channel_densities ,
526542 channel_density_nernsts = channel_density_nernsts ,
527- channel_density_non_uniform_nernsts = channel_density_non_uniform_nernsts ,
543+ channel_density_non_uniform_nernsts = channel_density_non_unif_nernsts ,
528544 channel_density_non_uniforms = channel_density_non_uniforms ,
529545 specific_capacitances = specific_capacitances ,
530546 init_memb_potentials = init_memb_potentials ,
531547 )
532548
533549 # Intracellular Properties
534550 Ra = cell .params ["Ra.all" ].value
535- resistivities = [neuroml .Resistivity (value = f"{ Ra } ohm_cm" , segment_groups = "all" )]
551+ resistivities = [
552+ neuroml .Resistivity (value = f"{ Ra } ohm_cm" , segment_groups = "all" )
553+ ]
536554
537555 intracellular_properties = neuroml .IntracellularProperties (
538556 resistivities = resistivities ,
0 commit comments