Skip to content

Commit

Permalink
Use step_begin, step_end when exporting to hoc if present
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaquier Aurélien Tristan committed Jan 25, 2024
1 parent 130d990 commit 635528f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions bluepyopt/ephys/create_hoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def range_exprs_to_hoc(range_params):
value = re.sub(r'\&', '&&', value)
value = re.sub('{distance}', FLOAT_FORMAT, value)
value = re.sub('{value}', format_float(param.value), value)
if hasattr(param.value_scaler, "step_begin"):
value = re.sub('{step_begin}', format_float(param.value_scaler.step_begin), value)
value = re.sub('{step_end}', format_float(param.value_scaler.step_end), value)
ret.append(Range(param.location, param.name, value))
return ret

Expand Down
5 changes: 2 additions & 3 deletions bluepyopt/ephys/parameterscalers/parameterscalers.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def inst_distribution(self):
return string.Formatter().vformat(self.distribution, (), dist_dict)

def scale_dict(self, values, distance):
"""Create scale disctionary"""
"""Create scale dictionary"""
scale_dict = {}
if isinstance(values, dict):
for k, v in values.items():
Expand Down Expand Up @@ -204,7 +204,6 @@ def scale(self, values, segment, sim=None):

# Find something to generalise this
import math # pylint:disable=W0611 #NOQA
import numpy

# This eval is unsafe (but is it ever dangerous ?)
# pylint: disable=W0123
Expand Down Expand Up @@ -290,7 +289,7 @@ def __init__(
distribution (str): distribution of parameter dependent on distance
from soma. string can contain `distance` and/or `value` as
placeholders for the distance to the soma and parameter value
respectivily
respectivily. It can also contain step_begin and step_end.
dist_param_names (list): list of names of parameters that
parametrise the distribution. These names will become
attributes of this object.
Expand Down

0 comments on commit 635528f

Please sign in to comment.