Skip to content

Commit 85e8aa2

Browse files
authored
Merge pull request #140 from kaeldai/cleanup/0.8_release
fixing tutorials
2 parents 81dac4a + 84f5bc0 commit 85e8aa2

File tree

24 files changed

+1004
-1683
lines changed

24 files changed

+1004
-1683
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: python
22

33
matrix:
44
include:
5-
- python: 2.7
65
- python: 3.6
76

87
before_install:

bmtk/analyzer/spike_trains.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def _find_spikes(spikes_file=None, config_file=None, population=None):
7171
spikes_f))
7272

7373
spikes_obj = SpikeTrains.load(spikes_f)
74+
7475
if len(spikes_obj.populations) > 1:
7576
raise ValueError('Spikes file {} contains more than one node population.'.format(spikes_f))
7677
else:
@@ -208,5 +209,7 @@ def calc_stats(r):
208209

209210

210211
def to_dataframe(config_file, spikes_file=None, population=None):
211-
_, spike_trains = _find_spikes(config_file=config_file, spikes_file=spikes_file, population=population)
212+
# _, spike_trains = _find_spikes(config_file=config_file, spikes_file=spikes_file, population=population)
213+
pop, spike_trains = _find_spikes(config_file=config_file, spikes_file=spikes_file, population=population)
214+
212215
return spike_trains.to_dataframe()

bmtk/simulator/bionet/biocell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class BioCell(Cell):
6969
"""Implemntation of a morphologically and biophysically detailed type cell.
7070
7171
"""
72-
def __init__(self, node, bionetwork):
73-
super(BioCell, self).__init__(node)
72+
def __init__(self, node, population_name, bionetwork):
73+
super(BioCell, self).__init__(node=node, population_name=population_name, network=bionetwork)
7474

7575
# Set up netcon object that can be used to detect and communicate cell spikes.
7676
self.set_spike_detector(bionetwork.spike_threshold)

bmtk/simulator/bionet/bionetwork.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ def get_virtual_cells(self, population, node_id, spike_trains):
123123
self._virtual_nodes[population][node_id] = virt_cell
124124
return virt_cell
125125

126-
def _build_cell(self, bionode):
126+
def _build_cell(self, bionode, population_name):
127127
if bionode.model_type in self._model_type_map:
128-
cell = self._model_type_map[bionode.model_type](bionode, self)
128+
cell = self._model_type_map[bionode.model_type](bionode, population_name=population_name, bionetwork=self)
129129
self._rank_nodes_by_model[bionode.model_type][cell.gid] = cell
130130
return cell
131131
else:
@@ -142,7 +142,7 @@ def build_nodes(self):
142142
node_ids_map = {}
143143
if node_pop.internal_nodes_only:
144144
for node in node_pop[MPI_rank::MPI_size]:
145-
cell = self._build_cell(node)
145+
cell = self._build_cell(bionode=node, population_name=node_pop.name)
146146
node_ids_map[node.node_id] = cell
147147
self._rank_node_gids[cell.gid] = cell
148148

@@ -154,8 +154,10 @@ def build_nodes(self):
154154
if node.model_type == 'virtual':
155155
continue
156156
else:
157-
cell = self._build_cell(node)
157+
cell = self._build_cell(bionode=node, population_name=node_pop.name)
158158
node_ids_map[node.node_id] = cell
159+
160+
159161
self._rank_node_gids[cell.gid] = cell
160162

161163
elif node_pop.virtual_nodes_only:

bmtk/simulator/bionet/cell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ class Cell(object):
3535
a Cell object directly. Cell classes act as wrapper around HOC cell object with extra functionality for setting
3636
positions, synapses, and other parameters depending on the desired cell class.
3737
"""
38-
def __init__(self, node):
38+
def __init__(self, node, population_name, network=None):
3939
self._node = node
40-
self._gid = node.gid
40+
41+
self._gid = network.gid_pool.get_gid(name=population_name, node_id=node.node_id)
4142
self._node_id = node.node_id
4243
self._props = node
4344
self._netcons = [] # list of NEURON network connection object attached to this cell

bmtk/simulator/bionet/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def load_nrn_modules(self):
4242
nrn.load_neuron_modules(self.mechanisms_dir, self.templates_dir)
4343

4444
def build_env(self):
45+
self.io = io
46+
self._set_logging()
4547
self.create_output_dir()
4648
self.copy_to_output()
4749
if io.mpi_size > 1:

bmtk/simulator/bionet/gids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add_pool(self, name, n_nodes):
2323
self._accumulated_offset += n_nodes
2424

2525
def get_gid(self, name, node_id):
26-
return self._pool_offsets[name] + node_id
26+
return int(self._pool_offsets[name] + node_id)
2727

2828
def get_pool_id(self, gid):
2929
offset_indx = np.searchsorted(self._offsets, gid, 'right')

bmtk/simulator/bionet/pointprocesscell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def syn_weight(self, val):
5454

5555
class PointProcessCell(Cell):
5656
"""Implimentation of a Leaky Integrate-and-file neuron type cell."""
57-
def __init__(self, node, bionetwork):
58-
super(PointProcessCell, self).__init__(node)
57+
def __init__(self, node, population_name, bionetwork):
58+
super(PointProcessCell, self).__init__(node, population_name=population_name, network=bionetwork)
5959
self.set_spike_detector()
6060
self._src_gids = []
6161
self._src_nets = []

bmtk/simulator/core/node_sets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def gids(self):
3939
else:
4040
for pop in self._populations:
4141
for node in pop.filter(self._filter):
42-
yield node.node_id
42+
yield self._network.gid_pool.get_gid(name=pop.name, node_id=node.node_id)
4343

4444
def nodes(self):
4545
return None

bmtk/simulator/pointnet/gids.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def add(self, name, node_id, gid):
2424
raise NotImplementedError()
2525

2626
def get_gid(self, name, node_id):
27-
# return self._popid2gid[name][node_id]
28-
raise NotImplementedError()
27+
return self.get_nestids(name=name, node_ids=[node_id])[0]
2928

3029
def get_pool_id(self, gid):
3130
return self._gid2pop_id[gid]

0 commit comments

Comments
 (0)