bsb-nest 4.2.1__py2.py3-none-any.whl → 4.3.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bsb-nest might be problematic. Click here for more details.

bsb_nest/__init__.py CHANGED
@@ -9,4 +9,4 @@ from .adapter import NestAdapter
9
9
  from .simulation import NestSimulation
10
10
 
11
11
  __plugin__ = SimulationBackendPlugin(Simulation=NestSimulation, Adapter=NestAdapter)
12
- __version__ = "4.2.1"
12
+ __version__ = "4.3.0"
bsb_nest/device.py CHANGED
@@ -21,6 +21,8 @@ class NestDevice(DeviceModel):
21
21
  type=types.or_(Targetting, NestRule), default=dict, call_default=True
22
22
  )
23
23
  """Targets of the device, which should be either a population or a nest rule"""
24
+ receptor_type = config.attr(type=int, required=False, default=0)
25
+ """Integer ID of the postsynaptic target receptor"""
24
26
 
25
27
  def get_target_nodes(self, adapter, simulation, simdata):
26
28
  if isinstance(self.targetting, Targetting):
@@ -43,8 +45,13 @@ class NestDevice(DeviceModel):
43
45
  nest.Connect(
44
46
  device,
45
47
  nodes,
46
- syn_spec={"weight": self.weight, "delay": self.delay},
48
+ syn_spec={
49
+ "weight": self.weight,
50
+ "delay": self.delay,
51
+ "receptor_type": self.receptor_type,
52
+ },
47
53
  )
54
+
48
55
  except Exception as e:
49
56
  if "does not send output" not in str(e):
50
57
  raise
@@ -1,4 +1,5 @@
1
1
  from .dc_generator import DCGenerator
2
2
  from .multimeter import Multimeter
3
3
  from .poisson_generator import PoissonGenerator
4
+ from .sinusoidal_poisson_generator import SinusoidalPoissonGenerator
4
5
  from .spike_recorder import SpikeRecorder
@@ -0,0 +1,62 @@
1
+ import nest
2
+ from bsb import config
3
+ from neo import SpikeTrain
4
+
5
+ from ..device import NestDevice
6
+
7
+
8
+ @config.node
9
+ class SinusoidalPoissonGenerator(
10
+ NestDevice, classmap_entry="sinusoidal_poisson_generator"
11
+ ):
12
+ rate = config.attr(type=float, required=True)
13
+ """Rate of the poisson generator"""
14
+ amplitude = config.attr(type=float, required=True)
15
+ """Amplitude of the sinusoidal signal"""
16
+ frequency = config.attr(type=float, required=True)
17
+ """Frequency of the sinusoidal signal"""
18
+ phase = config.attr(type=float, required=False, default=0.0)
19
+ """Phase of the sinusoidal signal"""
20
+ start = config.attr(type=float, required=False, default=0.0)
21
+ """Activation time in ms"""
22
+ stop = config.attr(type=float, required=False, default=None)
23
+ """Deactivation time in ms.
24
+ If not specified, generator will last until the end of the simulation."""
25
+
26
+ def boot(self):
27
+ if self.stop is not None:
28
+ if self.stop <= self.start:
29
+ raise ConfigurationError(
30
+ f"Stop time (given: {self.stop}) must be greater than start time (given: {self.start})."
31
+ )
32
+
33
+ def implement(self, adapter, simulation, simdata):
34
+ nodes = self.get_target_nodes(adapter, simulation, simdata)
35
+ params = {
36
+ "rate": self.rate,
37
+ "start": self.start,
38
+ "amplitude": self.amplitude,
39
+ "frequency": self.frequency,
40
+ "phase": self.phase,
41
+ }
42
+ if self.stop is not None:
43
+ params["stop"] = self.stop
44
+ device = self.register_device(
45
+ simdata, nest.Create("sinusoidal_poisson_generator", params=params)
46
+ )
47
+ sr = nest.Create("spike_recorder")
48
+ nest.Connect(device, sr)
49
+ self.connect_to_nodes(device, nodes)
50
+
51
+ def recorder(segment):
52
+ segment.spiketrains.append(
53
+ SpikeTrain(
54
+ sr.events["times"],
55
+ units="ms",
56
+ senders=sr.events["senders"],
57
+ t_stop=simulation.duration,
58
+ device=self.name,
59
+ )
60
+ )
61
+
62
+ simdata.result.create_recorder(recorder)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bsb-nest
3
- Version: 4.2.1
3
+ Version: 4.3.0
4
4
  Summary: NEST simulation adapter for the BSB framework.
5
5
  Author-email: Robin De Schepper <robingilbert.deschepper@unipv.it>
6
6
  Description-Content-Type: text/markdown
@@ -24,7 +24,7 @@ Provides-Extra: dev
24
24
  Provides-Extra: parallel
25
25
  Provides-Extra: test
26
26
 
27
- [![Build Status](https://github.com/dbbs-lab/bsb-nest/actions/workflows/build.yml/badge.svg)](https://github.com/dbbs-lab/bsb-nest/actions/workflows/build.yml)
27
+ [![Build Status](https://github.com/dbbs-lab/bsb-nest/actions/workflows/main.yml/badge.svg)](https://github.com/dbbs-lab/bsb-nest/actions/workflows/main.yml)
28
28
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
29
29
 
30
30
  # bsb-nest
@@ -1,18 +1,19 @@
1
- bsb_nest/__init__.py,sha256=IL-VNOohSjl__4e5bfduv46iMjfLhZqT6G9xJdsfTHA,311
1
+ bsb_nest/__init__.py,sha256=La2BwDgSYXsBpvdE_GMHPLfH1bGgXK5JE4rAAh0vGuU,311
2
2
  bsb_nest/adapter.py,sha256=uwFdicGOx7mRyYlfRY89zw7re0dnv9qumli1llJ0Rok,6668
3
3
  bsb_nest/cell.py,sha256=AauERRJd5OkKVSIxbx6LO2D9L7LDA6iMFfYjxu59e4c,960
4
4
  bsb_nest/connection.py,sha256=KFMXRvSR-tN7E52Mpo7dgWjXVQQSOd1VdryRPx-NfHQ,5571
5
- bsb_nest/device.py,sha256=w6jeGSOzqd8iTtw6HxsWS0TuYTxf6iO9eqAseaFC3W8,2615
5
+ bsb_nest/device.py,sha256=OXpUXJSwduUCIPxzbrAztTwLzS_tLOUvwmoqISGbYr0,2874
6
6
  bsb_nest/distributions.py,sha256=qAYaHJkMwaCfbTh_efoJT1hMoDHWsfQo_3SNLoD8WeA,1950
7
7
  bsb_nest/exceptions.py,sha256=NX4oiGWIshrLG1DCak_nTfI8cQI7GTdewR71qNzsXGM,264
8
8
  bsb_nest/simulation.py,sha256=MCfEhwhbl_S1WNyY-EAzW8SmVKk-nLui71jK9M3lGKw,985
9
- bsb_nest/devices/__init__.py,sha256=0-zwJ8jdvBdTFetU-q87OfyZYpKl_JVcVDrsLNn7yHQ,163
9
+ bsb_nest/devices/__init__.py,sha256=AgiHteAtWd5jhl_xB_V60oeM31fGb-DGi3WjoLZLL_E,232
10
10
  bsb_nest/devices/dc_generator.py,sha256=g-jRZorCl2yYhr5bx2I00ZlxYrblDcqVbtk0XYZzmdI,953
11
11
  bsb_nest/devices/multimeter.py,sha256=dLBDNCJuFIgxOZ0ssEoir7d65EW7ORS1jFNsvmU2wJ0,1811
12
12
  bsb_nest/devices/poisson_generator.py,sha256=SGo4jhq_rbIoB38OM5FTTYlyShxGAwWqCqAncWVB3qg,1465
13
+ bsb_nest/devices/sinusoidal_poisson_generator.py,sha256=MlNSmJgkuschiUgd2RZXBl008cDWYezbXXdup0TAtJY,2191
13
14
  bsb_nest/devices/spike_recorder.py,sha256=vJ9FQqmrcF0HdLl5Jy_bt_ABCUIgF-PLVI23E76JkhY,894
14
- bsb_nest-4.2.1.dist-info/entry_points.txt,sha256=uJlX9h2VeYfAumav18IM2PTJ3FssfwDUnUmfSFdR2SA,41
15
- bsb_nest-4.2.1.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
16
- bsb_nest-4.2.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
17
- bsb_nest-4.2.1.dist-info/METADATA,sha256=gm8BOcXCq1xdqi6oFDS3bUynPxa4BdvNaq_tiN0qnvk,1602
18
- bsb_nest-4.2.1.dist-info/RECORD,,
15
+ bsb_nest-4.3.0.dist-info/entry_points.txt,sha256=uJlX9h2VeYfAumav18IM2PTJ3FssfwDUnUmfSFdR2SA,41
16
+ bsb_nest-4.3.0.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
17
+ bsb_nest-4.3.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
18
+ bsb_nest-4.3.0.dist-info/METADATA,sha256=7vrpz4RkqfZZkyYO0z4PPAPUz8BoNVTYPVMlv8mNckQ,1600
19
+ bsb_nest-4.3.0.dist-info/RECORD,,