Skip to content

Commit

Permalink
Added MissingAxon hook to fix intersection data for incomplete/missin…
Browse files Browse the repository at this point in the history
…g axons (#150)

* golgi axon fix

* after connect: missing axon of Goc

* MissingAxon hook now handles missing intersections. closes #46.

Co-authored-by: claudia casellato <claudia.casellato@unipv.it>
  • Loading branch information
Helveg and claudiacasellato committed Oct 19, 2020
1 parent 6203e7d commit 334bfe9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
6 changes: 6 additions & 0 deletions bsb/configurations/mouse_cerebellum_cortex.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@
"affinity": 0.2
}
},
"after_connectivity": {
"golgi_axon_fix": {
"class": "bsb.postprocessing.MissingAxon",
"types": ["golgi_cell"]
}
},
"simulations": {
"stim_on_MFs": {
"simulator": "neuron",
Expand Down
38 changes: 15 additions & 23 deletions bsb/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,24 +220,9 @@ def spoof_connections(self, connection_type, connectivity_matrix):
#
# The left column will be the first from_morphology (0) and the right column
# will be the first to_morphology (1)
morphologies = np.column_stack(
(
np.zeros(
(
len(
connectivity_matrix,
)
)
),
np.ones(
(
len(
connectivity_matrix,
)
)
),
)
)
_from = np.zeros(len(connectivity_matrix))
_to = np.ones(len(connectivity_matrix))
morphologies = np.column_stack((_from, _to))
# Generate the map
morpho_map = [from_morphologies[0], to_morphologies[0]]
from_m = self.scaffold.morphology_repository.get_morphology(from_morphologies[0])
Expand Down Expand Up @@ -271,11 +256,18 @@ def spoof_connections(self, connection_type, connectivity_matrix):
)


class GolgiAxonFix(PostProcessingHook):
class MissingAxon(PostProcessingHook):
# Replaces the presynaptic compartment IDs of all Golgi cells with the soma compartment
def after_connectivity(self):
for n, ct in self.scaffold.configuration.connection_types.items():
if ct.from_cell_types[0].name == "golgi_cell":
for tag in ct.tags:
compartment_matrix = self.scaffold.connection_compartments[tag]
compartment_matrix[:, 0] = np.zeros(len(compartment_matrix))
for type in self.types:
if ct.from_cell_types[0].name == type:
for tag in ct.tags:
if tag not in self.scaffold.connection_compartments:
warn(
f"MissingAxon hook skipped {tag}, missing detailed intersection data.",
ConnectivityWarning,
)
continue
compartment_matrix = self.scaffold.connection_compartments[tag]
compartment_matrix[:, 0] = np.zeros(len(compartment_matrix))

0 comments on commit 334bfe9

Please sign in to comment.