Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
wagdy88 authored and jasmainak committed Mar 7, 2023
1 parent 7944cdf commit 473942e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 7 deletions.
5 changes: 3 additions & 2 deletions hnn_core/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,15 @@ class Cell:
Keys are name of synaptic mechanism. Each synaptic mechanism
has keys for parameters of the mechanism, e.g., 'e', 'tau1',
'tau2'.
topology : list of list
topology : list of list | None
The topology of cell sections. Each element is a list of
4 items in the format
[parent_sec, parent_loc, child_sec, child_loc] where
parent_sec and parent_loc are float between 0 and 1
specifying the location in the section to connect and
parent_sec and child_sec are names of the connecting
sections.
sections. If None, no topology is specified. This may
be necessary for single-compartment cells.
sect_loc : dict of list
Can have keys 'proximal' or 'distal' each containing
names of section locations that are proximal or distal.
Expand Down
12 changes: 11 additions & 1 deletion hnn_core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,17 @@ def add_tonic_bias(self, *, cell_type=None, amplitude=None,
}

def _add_cell_type(self, cell_name, pos, cell_template=None):
"""Add cell type by updating pos_dict and gid_ranges."""
"""Add cell type by updating pos_dict and gid_ranges.
Parameters
----------
cell_name : str
The name of the cell population.
pos : list of tuple (x, y, z)
The position of the cells to be added to net.pos_dict.
cell_template : None | instance of Cell
An instance of
"""
ll = self._n_gids
self._n_gids += len(pos)
self.gid_ranges[cell_name] = range(ll, self._n_gids)
Expand Down
69 changes: 65 additions & 4 deletions hnn_core/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,71 @@ def plot_cells(net, ax=None, show=True):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

colors = {'L5_pyramidal': 'b', 'L2_pyramidal': 'c',
'L5_basket': 'r', 'L2_basket': 'm'}
markers = {'L5_pyramidal': '^', 'L2_pyramidal': '^',
'L5_basket': 'x', 'L2_basket': 'x'}
#colors = {'L5_pyramidal': 'b', 'L2_pyramidal': 'c',
#'L5_basket': 'r', 'L2_basket': 'm'}

#markers = {'L5_pyramidal': '^', 'L2_pyramidal': '^',
# 'L5_basket': 'x', 'L2_basket': 'x'}

all_colors = ['b', 'c', 'r', 'm', 'tab:orange', 'g', 'y', 'k', 'w', 'tab:brown']
all_markers= ['^', '^', 'x', 'x', 'o', 'v', 's', 'p', 'h', '<']
cell_names = ['L5_pyramidal', 'L2_pyramidal', 'L5_basket', 'L2_basket']
for cell_name in net.cell_types:
if cell_name not in cell_names:
cell_names.append(cell_name)
# import hnn_core
# from hnn_core import jones_2009_model, simulate_dipole
# import matplotlib as plt

# net = jones_2009_model(add_drives_from_params= True)
# params = hnn_core.read_params('/home/mohamed/Desktop/PhD Thesis/auditory_evoked_simulation/HNN-AEF-main/HNN_Parameters/L_Contra.param')

# def martinotti(n_cells):
# from hnn_core.cell import Section, Cell

# cell_name = 'martinotti'
# pos = [(5, 5, 5)] * n_cells
# # pos = net.pos_dict['L5_basket'].copy()

# end_pts = [[0, 0, 0], [0, 0, 39.]]
# soma = Section(L=39., diam=20., cm=0.85,
# Ra=200., end_pts=end_pts)
# soma.syns = ['gabaa', 'nmda']

# synapses = {
# 'gabaa': {
# 'e': -80,
# 'tau1': 0.5,
# 'tau2': 5.
# },
# 'nmda': {
# 'e': 0,
# 'tau1': 1.,
# 'tau2': 20.
# }
# }
# sect_loc = ['proximal']

# return Cell(cell_name, pos,
# sections=soma,
# synapses=synapses,
# topology=None,
# sect_loc=sect_loc,
# gid=0)

# net.plot_cells()
# net._add_cell_type('L5_martinotti', pos='L5_basket' ,cell_template = None)

# simulate_dipole(net, tstop = 100, record_vsec= 'all')

# net.add_connection(src_gids='L5_martinotti', target_gids='L5_pyramidal', loc='apical_tuft', receptor='gabaa', weight= 0.025 , delay=1.0 ,lamtha=70.0 , allow_autapses= False, probability=1)


colors= dict()
markers= dict()
for idx, cell_name in enumerate(cell_names):
colors[cell_name] = all_colors[idx]
markers[cell_name] = all_markers[idx]

for cell_type in net.cell_types:
x = [pos[0] for pos in net.pos_dict[cell_type]]
Expand Down

0 comments on commit 473942e

Please sign in to comment.