From 39dc47bc123df8689345713becab245e3b532733 Mon Sep 17 00:00:00 2001 From: Nicholas Tolley Date: Mon, 8 Jan 2024 17:16:28 -0500 Subject: [PATCH] Add GABA weights to drives --- hnn_core/drives.py | 15 ++++++++++++-- hnn_core/network.py | 50 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/hnn_core/drives.py b/hnn_core/drives.py index 834f31a41..f15a61808 100644 --- a/hnn_core/drives.py +++ b/hnn_core/drives.py @@ -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 @@ -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: diff --git a/hnn_core/network.py b/hnn_core/network.py index 8aa754de1..629072caa 100644 --- a/hnn_core/network.py +++ b/hnn_core/network.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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, @@ -689,7 +706,8 @@ 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) @@ -697,6 +715,7 @@ 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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']