Skip to content

Commit

Permalink
Add GABA weights to drives
Browse files Browse the repository at this point in the history
  • Loading branch information
ntolley committed Jan 8, 2024
1 parent 2de40b6 commit 39dc47b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
15 changes: 13 additions & 2 deletions hnn_core/drives.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
_extract_drive_specs_from_hnn_params)


def _get_target_properties(weights_ampa, weights_nmda, synaptic_delays,
def _get_target_properties(weights_ampa, weights_nmda, weights_gabaa,
weights_gababb, synaptic_delays,
location, probability=1.0):
"""Retrieve drive properties associated with each target cell type
Expand All @@ -23,13 +24,23 @@ def _get_target_properties(weights_ampa, weights_nmda, synaptic_delays,
weights_ampa = dict()
if weights_nmda is None:
weights_nmda = dict()
if weights_gabaa is None:
weights_gabaa = dict()
if weights_gababb is None:
weights_gababb = dict()

weights_by_type = {cell_type: dict() for cell_type in
(set(weights_ampa.keys()) | set(weights_nmda.keys()))}
(set(weights_ampa.keys()) | set(weights_nmda.keys()) |
set(weights_gabaa.keys()) |
set(weights_gababb.keys()))}
for cell_type in weights_ampa:
weights_by_type[cell_type].update({'ampa': weights_ampa[cell_type]})
for cell_type in weights_nmda:
weights_by_type[cell_type].update({'nmda': weights_nmda[cell_type]})
for cell_type in weights_gabaa:
weights_by_type[cell_type].update({'gabaa': weights_gabaa[cell_type]})
for cell_type in weights_gababb:
weights_by_type[cell_type].update({'gabab': weights_gababb[cell_type]})

target_populations = set(weights_by_type)
if not target_populations:
Expand Down
50 changes: 42 additions & 8 deletions hnn_core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ def copy(self):
def add_evoked_drive(self, name, *, mu, sigma, numspikes, location,
n_drive_cells='n_cells', cell_specific=True,
weights_ampa=None, weights_nmda=None,
weights_gabaa=None, weights_gabab=None,
space_constant=3., synaptic_delays=0.1,
probability=1.0, event_seed=2, conn_seed=3):
"""Add an 'evoked' external drive to the network
Expand Down Expand Up @@ -528,6 +529,12 @@ def add_evoked_drive(self, name, *, mu, sigma, numspikes, location,
weights_nmda : dict or None
Synaptic weights (in uS) of NMDA receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabaa : dict or None
Synaptic weights (in uS) of GABAa receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabab : dict or None
Synaptic weights (in uS) of GABAb receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
synaptic_delays : dict or float
Synaptic delay (in ms) at the column origin, dispersed laterally as
a function of the space_constant. If float, applies to all target
Expand Down Expand Up @@ -580,14 +587,16 @@ def add_evoked_drive(self, name, *, mu, sigma, numspikes, location,
drive['dynamics'] = dict(mu=mu, sigma=sigma, numspikes=numspikes)
drive['events'] = list()

self._attach_drive(name, drive, weights_ampa, weights_nmda, location,
self._attach_drive(name, drive, weights_ampa, weights_nmda,
weights_gabaa, weights_gabab, location,
space_constant, synaptic_delays,
n_drive_cells, cell_specific, probability)

def add_poisson_drive(self, name, *, tstart=0, tstop=None, rate_constant,
location, n_drive_cells='n_cells',
cell_specific=True, weights_ampa=None,
weights_nmda=None, space_constant=100.,
weights_nmda=None, weights_gabaa=None,
weights_gabab=None, space_constant=100.,
synaptic_delays=0.1, probability=1.0, event_seed=2,
conn_seed=3):
"""Add a Poisson-distributed external drive to the network
Expand Down Expand Up @@ -635,6 +644,12 @@ def add_poisson_drive(self, name, *, tstart=0, tstop=None, rate_constant,
weights_nmda : dict or None
Synaptic weights (in uS) of NMDA receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabaa : dict or None
Synaptic weights (in uS) of GABAa receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabab : dict or None
Synaptic weights (in uS) of GABAb receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
synaptic_delays : dict or float
Synaptic delay (in ms) at the column origin, dispersed laterally as
a function of the space_constant. If float, applies to all target
Expand Down Expand Up @@ -664,6 +679,8 @@ def add_poisson_drive(self, name, *, tstart=0, tstop=None, rate_constant,
tstop=tstop)
target_populations = _get_target_properties(weights_ampa,
weights_nmda,
weights_gabaa,
weights_gabab,
synaptic_delays,
location)[0]
_check_poisson_rates(rate_constant, target_populations,
Expand All @@ -689,14 +706,16 @@ def add_poisson_drive(self, name, *, tstart=0, tstop=None, rate_constant,
rate_constant=rate_constant)
drive['events'] = list()

self._attach_drive(name, drive, weights_ampa, weights_nmda, location,
self._attach_drive(name, drive, weights_ampa, weights_nmda,
weights_gabaa, weights_gabab, location,
space_constant, synaptic_delays,
n_drive_cells, cell_specific, probability)

def add_bursty_drive(self, name, *, tstart=0, tstart_std=0, tstop=None,
location, burst_rate, burst_std=0, numspikes=2,
spike_isi=10, n_drive_cells=1, cell_specific=False,
weights_ampa=None, weights_nmda=None,
weights_gabaa=None, weights_gabab=None,
synaptic_delays=0.1, space_constant=100.,
probability=1.0, event_seed=2, conn_seed=3):
"""Add a bursty (rhythmic) external drive to all cells of the network
Expand Down Expand Up @@ -751,6 +770,12 @@ def add_bursty_drive(self, name, *, tstart=0, tstart_std=0, tstop=None,
weights_nmda : dict or None
Synaptic weights (in uS) of NMDA receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabaa : dict or None
Synaptic weights (in uS) of GABAa receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabab : dict or None
Synaptic weights (in uS) of GABAb receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
synaptic_delays : dict or float
Synaptic delay (in ms) at the column origin, dispersed laterally as
a function of the space_constant. If float, applies to all target
Expand Down Expand Up @@ -795,11 +820,13 @@ def add_bursty_drive(self, name, *, tstart=0, tstart_std=0, tstop=None,
numspikes=numspikes, spike_isi=spike_isi)
drive['events'] = list()

self._attach_drive(name, drive, weights_ampa, weights_nmda, location,
self._attach_drive(name, drive, weights_ampa, weights_nmda,
weights_gabaa, weights_gabab, location,
space_constant, synaptic_delays,
n_drive_cells, cell_specific, probability)

def _attach_drive(self, name, drive, weights_ampa, weights_nmda, location,
def _attach_drive(self, name, drive, weights_ampa, weights_nmda,
weights_gabaa, weights_gabab, location,
space_constant, synaptic_delays, n_drive_cells,
cell_specific, probability):
"""Attach a drive to network based on connectivity information
Expand All @@ -816,6 +843,12 @@ def _attach_drive(self, name, drive, weights_ampa, weights_nmda, location,
weights_nmda : dict or None
Synaptic weights (in uS) of NMDA receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabaa : dict or None
Synaptic weights (in uS) of GABAa receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
weights_gabab : dict or None
Synaptic weights (in uS) of GABAb receptors on each targeted cell
type (dict keys). Cell types omitted from the dict are set to zero.
location : str
Target location of synapses. Must be an element of
`Cell.sect_loc` such as 'proximal' or 'distal', which defines a
Expand Down Expand Up @@ -866,7 +899,8 @@ def _attach_drive(self, name, drive, weights_ampa, weights_nmda, location,
# allow passing weights as None, convert to dict here
(target_populations, weights_by_type, delays_by_type,
probability_by_type) = \
_get_target_properties(weights_ampa, weights_nmda, synaptic_delays,
_get_target_properties(weights_ampa, weights_nmda, weights_gabaa,
weights_gabab, synaptic_delays,
location, probability)

# weights passed must correspond to cells in the network
Expand Down Expand Up @@ -977,8 +1011,8 @@ def _attach_drive(self, name, drive, weights_ampa, weights_nmda, location,
receptor=receptor, weight=weights, delay=delays,
lamtha=space_constant, probability=probability,
conn_seed=drive['conn_seed'] + seed_increment)
# Ensure that AMPA/NMDA connections target the same gids
# when probability < 1
# Ensure that multireceptor connections target the
# same gids when probability < 1
if receptor_idx > 0:
self.connectivity[-1]['src_gids'] = \
self.connectivity[-2]['src_gids']
Expand Down

0 comments on commit 39dc47b

Please sign in to comment.