Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 9f768e2

Browse files
committed
add public generate_channels_by_location function
1 parent b2c9ac3 commit 9f768e2

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

bluepyopt/ephys/create_hoc.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@
4949
'myelinated']
5050

5151

52+
def generate_channels_by_location(mechs, location_order):
53+
"""Create a OrderedDictionary of all channel mechs for hoc template.
54+
55+
Args:
56+
mechs (list of bluepyopt.ephys.mechanisms.Mechanism): mechanisms
57+
location_order (list of str): order of locations
58+
59+
Returns: tuple of channels, point_channels and location order
60+
"""
61+
loc_desc = _loc_desc
62+
return _generate_channels_by_location(mechs, location_order, loc_desc)
63+
64+
5265
def _generate_channels_by_location(mechs, location_order, loc_desc):
5366
"""Create a OrderedDictionary of all channel mechs for hoc template."""
5467
channels = OrderedDict((location, []) for location in location_order)

bluepyopt/tests/test_ephys/test_create_hoc.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@
2020
'myelinated']
2121

2222

23+
@pytest.mark.unit
24+
def test_generate_channels_by_location():
25+
"""ephys.create_hoc: Test generate_channels_by_location"""
26+
mech = utils.make_mech()
27+
public_res = create_hoc.generate_channels_by_location(
28+
[mech], DEFAULT_LOCATION_ORDER,
29+
)
30+
private_res = create_hoc._generate_channels_by_location(
31+
[mech], DEFAULT_LOCATION_ORDER, create_hoc._loc_desc
32+
)
33+
assert public_res == private_res
34+
35+
2336
@pytest.mark.unit
2437
def test__generate_channels_by_location():
2538
"""ephys.create_hoc: Test _generate_channels_by_location"""

0 commit comments

Comments
 (0)