bluecellulab 2.6.4__py3-none-any.whl → 2.6.6__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 bluecellulab might be problematic. Click here for more details.

@@ -18,6 +18,8 @@ class StimulusName(Enum):
18
18
  IDREST = auto()
19
19
  IV = auto()
20
20
  FIRE_PATTERN = auto()
21
+ POS_CHEOPS = auto()
22
+ NEG_CHEOPS = auto()
21
23
 
22
24
 
23
25
  class Recording(NamedTuple):
@@ -68,7 +70,7 @@ def run_stimulus(
68
70
  return Recording(current, voltage, time)
69
71
 
70
72
 
71
- def apply_multiple_step_stimuli(
73
+ def apply_multiple_stimuli(
72
74
  cell: Cell,
73
75
  stimulus_name: StimulusName,
74
76
  amplitudes: Sequence[float],
@@ -109,6 +111,10 @@ def apply_multiple_step_stimuli(
109
111
  stimulus = stim_factory.iv(threshold_current=cell.threshold, threshold_percentage=amplitude)
110
112
  elif stimulus_name == StimulusName.FIRE_PATTERN:
111
113
  stimulus = stim_factory.fire_pattern(threshold_current=cell.threshold, threshold_percentage=amplitude)
114
+ elif stimulus_name == StimulusName.POS_CHEOPS:
115
+ stimulus = stim_factory.pos_cheops(threshold_current=cell.threshold, threshold_percentage=amplitude)
116
+ elif stimulus_name == StimulusName.NEG_CHEOPS:
117
+ stimulus = stim_factory.neg_cheops(threshold_current=cell.threshold, threshold_percentage=amplitude)
112
118
  else:
113
119
  raise ValueError("Unknown stimulus name.")
114
120
 
@@ -18,6 +18,7 @@ import logging
18
18
  from pathlib import Path
19
19
  from typing import Optional, Protocol
20
20
 
21
+ import h5py
21
22
  import pandas as pd
22
23
 
23
24
  from bluecellulab.circuit.config import SimulationConfig, SonataSimulationConfig
@@ -172,12 +173,14 @@ class SonataSimulationAccess:
172
173
 
173
174
  def get_synapse_replay_spikes(f_name: str) -> dict:
174
175
  """Read the .dat file containing the spike replays."""
175
- data = np.genfromtxt(f_name, skip_header=1)
176
- spikes = pd.DataFrame(data=data, columns=["t", "node_id"]).astype({"node_id": int})
177
- # subtract 1 from all node_ids to make them 0-based
178
- # source: https://sonata-extension.readthedocs.io/
179
- # en/latest/blueconfig-projection-example.html#dat-spike-files
180
- spikes["node_id"] -= 1
176
+ with h5py.File(f_name, 'r') as f:
177
+ # Access the timestamps and node_ids datasets
178
+ timestamps = f['/spikes/All/timestamps'][:]
179
+ node_ids = f['/spikes/All/node_ids'][:]
180
+
181
+ spikes = pd.DataFrame(data={'t': timestamps, 'node_id': node_ids})
182
+ spikes = spikes.astype({"node_id": int})
183
+
181
184
  if (spikes["t"] < 0).any():
182
185
  logger.warning("Found negative spike times... Clipping them to 0")
183
186
  spikes["t"].clip(lower=0., inplace=True)
@@ -387,3 +387,71 @@ class StimulusFactory:
387
387
  threshold_current=threshold_current,
388
388
  threshold_percentage=threshold_percentage,
389
389
  )
390
+
391
+ def pos_cheops(
392
+ self,
393
+ threshold_current: float,
394
+ threshold_percentage: float = 300.0,
395
+ ) -> Stimulus:
396
+ """A combination of pyramid shaped Ramp stimuli with a positive
397
+ amplitude.
398
+
399
+ Args:
400
+ threshold_current: The threshold current of the Cell.
401
+ threshold_percentage: Percentage of desired threshold_current amplification.
402
+ """
403
+ delay = 250.0
404
+ ramp1_duration = 4000.0
405
+ ramp2_duration = 2000.0
406
+ ramp3_duration = 1333.0
407
+ inter_delay = 2000.0
408
+ post_delay = 250.0
409
+
410
+ amplitude = threshold_current * threshold_percentage / 100
411
+ result = (
412
+ Empty(self.dt, duration=delay)
413
+ + Slope(self.dt, duration=ramp1_duration, amplitude_start=0.0, amplitude_end=amplitude)
414
+ + Slope(self.dt, duration=ramp1_duration, amplitude_start=amplitude, amplitude_end=0.0)
415
+ + Empty(self.dt, duration=inter_delay)
416
+ + Slope(self.dt, duration=ramp2_duration, amplitude_start=0.0, amplitude_end=amplitude)
417
+ + Slope(self.dt, duration=ramp2_duration, amplitude_start=amplitude, amplitude_end=0.0)
418
+ + Empty(self.dt, duration=inter_delay)
419
+ + Slope(self.dt, duration=ramp3_duration, amplitude_start=0.0, amplitude_end=amplitude)
420
+ + Slope(self.dt, duration=ramp3_duration, amplitude_start=amplitude, amplitude_end=0.0)
421
+ + Empty(self.dt, duration=post_delay)
422
+ )
423
+ return result
424
+
425
+ def neg_cheops(
426
+ self,
427
+ threshold_current: float,
428
+ threshold_percentage: float = 300.0,
429
+ ) -> Stimulus:
430
+ """A combination of pyramid shaped Ramp stimuli with a negative
431
+ amplitude.
432
+
433
+ Args:
434
+ threshold_current: The threshold current of the Cell.
435
+ threshold_percentage: Percentage of desired threshold_current amplification.
436
+ """
437
+ delay = 1750.0
438
+ ramp1_duration = 3333.0
439
+ ramp2_duration = 1666.0
440
+ ramp3_duration = 1111.0
441
+ inter_delay = 2000.0
442
+ post_delay = 250.0
443
+
444
+ amplitude = - threshold_current * threshold_percentage / 100
445
+ result = (
446
+ Empty(self.dt, duration=delay)
447
+ + Slope(self.dt, duration=ramp1_duration, amplitude_start=0.0, amplitude_end=amplitude)
448
+ + Slope(self.dt, duration=ramp1_duration, amplitude_start=amplitude, amplitude_end=0.0)
449
+ + Empty(self.dt, duration=inter_delay)
450
+ + Slope(self.dt, duration=ramp2_duration, amplitude_start=0.0, amplitude_end=amplitude)
451
+ + Slope(self.dt, duration=ramp2_duration, amplitude_start=amplitude, amplitude_end=0.0)
452
+ + Empty(self.dt, duration=inter_delay)
453
+ + Slope(self.dt, duration=ramp3_duration, amplitude_start=0.0, amplitude_end=amplitude)
454
+ + Slope(self.dt, duration=ramp3_duration, amplitude_start=amplitude, amplitude_end=0.0)
455
+ + Empty(self.dt, duration=post_delay)
456
+ )
457
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bluecellulab
3
- Version: 2.6.4
3
+ Version: 2.6.6
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -26,6 +26,7 @@ Requires-Dist: bluepysnap <4.0.0,>=3.0.0
26
26
  Requires-Dist: pydantic <3.0.0,>=2.5.2
27
27
  Requires-Dist: typing-extensions >=4.8.0
28
28
  Requires-Dist: networkx >=3.1
29
+ Requires-Dist: h5py >=3.11.0
29
30
 
30
31
  |banner|
31
32
 
@@ -15,7 +15,7 @@ bluecellulab/type_aliases.py,sha256=DvgjERv2Ztdw_sW63JrZTQGpJ0x5uMTFB5hcBHDb0WA,
15
15
  bluecellulab/utils.py,sha256=SbOOkzw1YGjCKV3qOw0zpabNEy7V9BRtgMLsQJiFRq4,1526
16
16
  bluecellulab/verbosity.py,sha256=T0IgX7DrRo19faxrT4Xzb27gqxzoILQ8FzYKxvUeaPM,1342
17
17
  bluecellulab/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- bluecellulab/analysis/inject_sequence.py,sha256=qr3N1tQX4avvKzFBT0L7W6LnSgk2y_P_7Yhy0UjlGmk,4769
18
+ bluecellulab/analysis/inject_sequence.py,sha256=Kgs-Be6CtRc9LI1qsM7mC4oGfpW6VrqGPHSuoa7XFYs,5148
19
19
  bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
20
20
  bluecellulab/cell/cell_dict.py,sha256=PVmZsjhZ9jp3HC-8QmdFqp-crAcVMSVeLWujcOPLlpo,1346
21
21
  bluecellulab/cell/core.py,sha256=ZVzy3tsA5X7OyCmnHQn0d6AlNg9rOG2ojKuojvKdsFw,31487
@@ -35,7 +35,7 @@ bluecellulab/circuit/__init__.py,sha256=Khpa13nzNvDlDS2JduyoFTukEduEkWCc5ML_JwGp
35
35
  bluecellulab/circuit/format.py,sha256=eYhiBIQnPnnVBmaSDymFjQprXN9QjEYKmFhb2mIS86o,1674
36
36
  bluecellulab/circuit/iotools.py,sha256=KVE7x5LNQ4RgjNh05Q-h3Swpbs3nRFtrcWNHj62aiRI,1585
37
37
  bluecellulab/circuit/node_id.py,sha256=gaRAW3UhbPOPsoXMHLjo3qH9iNod7YB8ZOcguWprrU4,1265
38
- bluecellulab/circuit/simulation_access.py,sha256=QHVEN-sEZbCCvblhBHEShGX0-NEXCD1AYpavpVGCgAE,7073
38
+ bluecellulab/circuit/simulation_access.py,sha256=jrVz6pFNAuwvuvsTq9OqeDfjIZ5akE98RBMBNDwuDVQ,7062
39
39
  bluecellulab/circuit/synapse_properties.py,sha256=a4-Yw_f8JIR6i2YG8qhCW97TMSd_Z-aF6lp_a1wBwnM,6374
40
40
  bluecellulab/circuit/validate.py,sha256=7EUN15u0JFFlLf389jUBqLwDOHyZdfKtoidI-xLUVYA,3593
41
41
  bluecellulab/circuit/circuit_access/__init__.py,sha256=sgp6m5kP-pq60V1IFGUiSUR1OW01zdxXNNUJmPA8anI,201
@@ -58,13 +58,13 @@ bluecellulab/simulation/parallel.py,sha256=xmlIelxYNct-vGhPip7_vF9gwyehdpomYB8kf
58
58
  bluecellulab/simulation/simulation.py,sha256=I__cZwV_A8I7XSefn6aJDBA_jXCI3E35-pCNCLUsnvo,6206
59
59
  bluecellulab/stimulus/__init__.py,sha256=DgIgVaSyR-URf3JZzvO6j-tjCerzvktuK-ep8pjMRPQ,37
60
60
  bluecellulab/stimulus/circuit_stimulus_definitions.py,sha256=uij_s44uNdmMwMLGmTHSRgmp9K9B_vvHHshX6YPJNJU,15686
61
- bluecellulab/stimulus/factory.py,sha256=cjnMqFx-Y31kV1XHvkSbGI2f1OpEawU3Wg_cLqcIyRc,11883
61
+ bluecellulab/stimulus/factory.py,sha256=hoq5JA69eX4bAdtOJNErhBn_p0uQh8QPoFvCqqeGBN4,14874
62
62
  bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
63
63
  bluecellulab/synapse/synapse_factory.py,sha256=MjUorWoMl4lFSBgQw4QS09Dzh0-LYWlCHJKYy8N-d3w,6847
64
64
  bluecellulab/synapse/synapse_types.py,sha256=4gne-hve2vq1Lau-LAVPsfLjffVYqAYBW3kCfC7_600,16871
65
- bluecellulab-2.6.4.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
66
- bluecellulab-2.6.4.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
67
- bluecellulab-2.6.4.dist-info/METADATA,sha256=0d2std48SNCpQmGlEd8Hr7YJWKIPoKpNqDNA8aIts8U,7025
68
- bluecellulab-2.6.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
69
- bluecellulab-2.6.4.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
70
- bluecellulab-2.6.4.dist-info/RECORD,,
65
+ bluecellulab-2.6.6.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
66
+ bluecellulab-2.6.6.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
67
+ bluecellulab-2.6.6.dist-info/METADATA,sha256=4_xecVXsjYRMbTw9HJXdgWR4o5S-uiv3UVuXotp0gD4,7054
68
+ bluecellulab-2.6.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
69
+ bluecellulab-2.6.6.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
70
+ bluecellulab-2.6.6.dist-info/RECORD,,