Skip to content

Commit

Permalink
Renaming Arbor iexpr module, adding docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasgd committed Oct 25, 2022
1 parent 9dd09e6 commit 4148974
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module that generates Arbor's iexpr expression language."""
"""Translate spatially varying parameter-scaler expressions to Arbor iexprs"""

"""
Copyright (c) 2016-2022, EPFL/Blue Brain Project
Expand Down Expand Up @@ -218,8 +218,18 @@ def visit_Name(self, node):
' No valid substitution for %s.' % node.id)


def generate_arbor_iexpr(iexpr, variables, constant_formatter):
"""Generate Arbor iexpr from parameter-scaler python expression"""
def generate_acc_scale_iexpr(iexpr, variables, constant_formatter):
"""Translate parameter-scaler python arithmetic expression to Arbor iexpr
Args:
iexpr (str): Python arithmetic expression (instantiated distribution)
variables (): Mapping of variable name (referenced in the iexpr
argument) to Arbor iexpr representation
Returns:
The Arbor iexpr corresponding to the python arithmetic expression
with the variables substituted by their value.
"""

if 'value' not in variables:
raise ValueError('Arbor iexpr generation failed for %s:' % iexpr +
Expand Down
4 changes: 2 additions & 2 deletions bluepyopt/ephys/parameterscalers/parameterscalers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import string

from bluepyopt.ephys.base import BaseEPhys
from bluepyopt.ephys.parameterscalers.arbor_dsl import generate_arbor_iexpr
from bluepyopt.ephys.parameterscalers.acc_iexpr import generate_acc_scale_iexpr
from bluepyopt.ephys.serializer import DictMixin
from bluepyopt.ephys.morphologies import ArbFileMorphology

Expand Down Expand Up @@ -190,7 +190,7 @@ def acc_scale_iexpr(self, value, constant_formatter=format_float):
distance='(distance %s)' % # could be a ctor param if required
ArbFileMorphology.region_labels['somatic'].ref
)
return generate_arbor_iexpr(iexpr, variables, constant_formatter)
return generate_acc_scale_iexpr(iexpr, variables, constant_formatter)

def __str__(self):
"""String representation"""
Expand Down

0 comments on commit 4148974

Please sign in to comment.