This repository was archived by the owner on Feb 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
distinguishing areal from point locations in hoc #421
Copy link
Copy link
Open
Description
This is the reproducing example:
BluePyOpt$ ipython
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from bluepyopt import ephys
In [2]: ephys.create_hoc.create_hoc(mechs=[], parameters=[ephys.parameters.NrnSectionParameter(name='param', value=1., locations=[ephys.locations.NrnSectionCompLocation(name='loc', sec_name='soma[0]', comp_x=0.5)])])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [2], line 1
----> 1 ephys.create_hoc.create_hoc(mechs=[], parameters=[ephys.parameters.NrnSectionParameter(name='param', value=1., locations=[ephys.locations.NrnSectionCompLocation(name='loc', sec_name='soma[0]', comp_x=0.5)])])
File ~/src/arbor/bluepyopt_test/BluePyOpt/bluepyopt/ephys/create_hoc.py:156, in create_hoc(mechs, parameters, morphology, ignored_globals, replace_axon, template_name, template_filename, disable_banner, template_dir, custom_jinja_params)
152 template = template_file.read()
153 template = jinja2.Template(template)
155 global_params, section_params, range_params, location_order = \
--> 156 _generate_parameters(parameters)
157 channels = _generate_channels_by_location(mechs, location_order)
159 ignored_global_params = {}
File ~/src/arbor/bluepyopt_test/BluePyOpt/bluepyopt/ephys/create_hoc.py:76, in _generate_parameters(parameters)
73 assert isinstance(
74 param.locations, (tuple, list)), 'Must have locations list'
75 for location in param.locations:
---> 76 param_locations[location.seclist_name].append(param)
78 section_params = defaultdict(list)
79 range_params = []
AttributeError: 'NrnSectionCompLocation' object has no attribute 'seclist_name'
If create_hoc
only supports areal locations, I think neither of the other CompLocation
s should be accepted by create_hoc
(NrnSeclistCompLocation
, NrnSomaDistanceCompLocation
, NrnSecSomaDistanceCompLocation
, NrnTrunkSomaDistanceCompLocation
). Effectively, it seems that only NrnSeclistLocation
is supported for the mechanism location, hence, I've added a check. It might be worth distinguishing areal from point locations in the class hierarchy (below locations.Location
) in the future. In Arbor this is the difference between regions and locsets.
Originally posted by @lukasgd in #393 (comment)
Metadata
Metadata
Assignees
Labels
No labels