This is the reproducing example:
BluePyOpt$ ipythonPython3.8.10 (default, Jun222022, 20:18:18) Type'copyright', 'credits'or'license'formoreinformationIPython8.5.0--AnenhancedInteractivePython. Type'?'forhelp.
In [1]: frombluepyoptimportephysIn [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)])])
---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
CellIn [2], line1---->1ephys.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, increate_hoc(mechs, parameters, morphology, ignored_globals, replace_axon, template_name, template_filename, disable_banner, template_dir, custom_jinja_params)
152template=template_file.read()
153template=jinja2.Template(template)
155global_params, section_params, range_params, location_order= \
-->156_generate_parameters(parameters)
157channels=_generate_channels_by_location(mechs, location_order)
159ignored_global_params= {}
File~/src/arbor/bluepyopt_test/BluePyOpt/bluepyopt/ephys/create_hoc.py:76, in_generate_parameters(parameters)
73assertisinstance(
74param.locations, (tuple, list)), 'Must have locations list'75forlocationinparam.locations:
--->76param_locations[location.seclist_name].append(param)
78section_params=defaultdict(list)
79range_params= []
AttributeError: 'NrnSectionCompLocation'objecthasnoattribute'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)
If
create_hoconly supports areal locations, I think neither of the otherCompLocations should be accepted bycreate_hoc(NrnSeclistCompLocation,NrnSomaDistanceCompLocation,NrnSecSomaDistanceCompLocation,NrnTrunkSomaDistanceCompLocation). Effectively, it seems that onlyNrnSeclistLocationis supported for the mechanism location, hence, I've added a check. It might be worth distinguishing areal from point locations in the class hierarchy (belowlocations.Location) in the future. In Arbor this is the difference between regions and locsets.Originally posted by @lukasgd in #393 (comment)