Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distinguishing areal from point locations in hoc #421

Open
anilbey opened this issue Oct 25, 2022 · 2 comments
Open

distinguishing areal from point locations in hoc #421

anilbey opened this issue Oct 25, 2022 · 2 comments

Comments

@anilbey
Copy link
Contributor

anilbey commented Oct 25, 2022

    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 CompLocations 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)

@anilbey
Copy link
Contributor Author

anilbey commented Oct 31, 2022

The attribute error is fixed in 9bbc68e.

Consider @lukasgd's suggestion:

I think follow-up issues should focus on extending hoc-support or, as suggested above, introducing another level in the locations class hierarchy that distinguishes areal from point locations.

@anilbey anilbey changed the title 'NrnSectionCompLocation' object has no attribute 'seclist_name' distinguishing areal from point locations in hoc Oct 31, 2022
@lukasgd
Copy link
Contributor

lukasgd commented Nov 7, 2022

The two points connected by the "or" above are actually separate and independent aspects:

  • extend hoc-support (e.g. for point processes)
  • distinguish areal from point locations in the locations class hierarchy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants