Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add somatostatin cell type #609

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/workflows/plot_simulate_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@

plot_psd(dpl[trial_idx], fmin=1., fmax=1e3, tmin=tmin, ax=axes[1], show=False)
axes[1].set_xscale('log')
plt.tight_layout()

hjhj
###############################################################################
# The next step is to add a simultaneous 10 Hz :term:`distal` drive with a
# lower within-burst spread of spike times (``burst_std``) compared with the
Expand Down
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
22 changes: 18 additions & 4 deletions hnn_core/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,24 @@ 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)

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
66 changes: 66 additions & 0 deletions test_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import hnn_core
from hnn_core import jones_2009_model, simulate_dipole, Network
import numpy as np
import matplotlib as plt

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


def martinotti_template():
from hnn_core.cell import Section, Cell

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

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

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

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

x1= np.linspace(0, 7, 7)
y1= np.linspace(0, 5, 5)
xv, yv = np.meshgrid(x1, y1)
pos = list()
for (x, y) in zip(xv.ravel(), yv.ravel()):
pos.append((x, y, 0.))

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

weights_nmda_d1 = {'L2_basket': 0.019482, 'L2_pyramidal': 0.004317,
'L5_pyramidal': 0.080074}
synaptic_delays_d1 = {'L2_basket': 0.1, 'L2_pyramidal': 0.1,
'L5_pyramidal': 0.1}
net.add_evoked_drive(
'evdist1', mu=63.53, sigma=3.85, numspikes=1, weights_ampa=None,
weights_nmda=weights_nmda_d1, location='distal',
synaptic_delays=synaptic_delays_d1, event_seed=4)

simulate_dipole(net, tstop = 100, record_vsec=False)

# 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)