bluecellulab 2.6.18__py3-none-any.whl → 2.6.20__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.

@@ -9,6 +9,7 @@ from bluecellulab.cell.core import Cell
9
9
  from bluecellulab.cell.template import TemplateParams
10
10
  from bluecellulab.simulation.parallel import IsolatedProcess
11
11
  from bluecellulab.simulation.simulation import Simulation
12
+ from bluecellulab.stimulus.circuit_stimulus_definitions import Hyperpolarizing
12
13
  from bluecellulab.stimulus.factory import Stimulus, StimulusFactory
13
14
 
14
15
 
@@ -38,6 +39,7 @@ def run_stimulus(
38
39
  section: str,
39
40
  segment: float,
40
41
  cvode: bool = True,
42
+ add_hypamp: bool = True,
41
43
  ) -> Recording:
42
44
  """Creates a cell and stimulates it with a given stimulus.
43
45
 
@@ -56,6 +58,9 @@ def run_stimulus(
56
58
  """
57
59
  cell = Cell.from_template_parameters(template_params)
58
60
  neuron_section = cell.sections[section]
61
+ if add_hypamp:
62
+ hyp_stim = Hyperpolarizing(target="", delay=0.0, duration=stimulus.stimulus_time)
63
+ cell.add_replay_hypamp(hyp_stim)
59
64
  cell.add_voltage_recording(neuron_section, segment)
60
65
  iclamp, _ = cell.inject_current_waveform(
61
66
  stimulus.time, stimulus.current, section=neuron_section, segx=segment
@@ -81,6 +86,7 @@ def apply_multiple_stimuli(
81
86
  segment: float = 0.5,
82
87
  n_processes: int | None = None,
83
88
  cvode: bool = True,
89
+ add_hypamp: bool = True,
84
90
  ) -> StimulusRecordings:
85
91
  """Apply multiple stimuli to the cell on isolated processes.
86
92
 
@@ -95,6 +101,7 @@ def apply_multiple_stimuli(
95
101
  segment: The segment of the section where the stimuli are applied.
96
102
  n_processes: The number of processes to use for running the stimuli.
97
103
  cvode: True to use variable time-steps. False for fixed time-steps.
104
+ add_hypamp: True to add the cell's holding current stimulus
98
105
 
99
106
  Returns:
100
107
  A dictionary where the keys are the names of the stimuli and the values
@@ -144,7 +151,7 @@ def apply_multiple_stimuli(
144
151
  else:
145
152
  raise ValueError("Unknown stimulus name.")
146
153
 
147
- task_args.append((cell.template_params, stimulus, section_name, segment, cvode))
154
+ task_args.append((cell.template_params, stimulus, section_name, segment, cvode, add_hypamp))
148
155
 
149
156
  with IsolatedProcess(processes=n_processes) as pool:
150
157
  # Map expects a function and a list of argument tuples
@@ -26,6 +26,7 @@ import numpy as np
26
26
  import pandas as pd
27
27
  from pydantic.types import NonNegativeInt
28
28
  from typing_extensions import deprecated
29
+ from typing import Optional
29
30
 
30
31
  import bluecellulab
31
32
  from bluecellulab.cell import CellDict
@@ -116,6 +117,8 @@ class CircuitSimulation:
116
117
  self.spike_threshold = self.circuit_access.config.spike_threshold
117
118
  self.spike_location = self.circuit_access.config.spike_location
118
119
 
120
+ self.projections: list[str] = []
121
+
119
122
  condition_parameters = self.circuit_access.config.condition_parameters()
120
123
  set_global_condition_parameters(condition_parameters)
121
124
 
@@ -239,18 +242,17 @@ class CircuitSimulation:
239
242
  "pre_spike_trains")
240
243
 
241
244
  if add_projections is True:
242
- projections = self.circuit_access.config.get_all_projection_names()
245
+ self.projections = self.circuit_access.config.get_all_projection_names()
243
246
  elif add_projections is False:
244
- projections = []
247
+ self.projections = []
245
248
  else:
246
- projections = add_projections
249
+ self.projections = add_projections
247
250
 
248
251
  self._add_cells(cell_ids)
249
252
  if add_synapses:
250
253
  self._add_synapses(
251
254
  pre_gids=pre_gids,
252
- add_minis=add_minis,
253
- projections=projections)
255
+ add_minis=add_minis)
254
256
  if add_replay or interconnect_cells or pre_spike_trains:
255
257
  if add_replay and not add_synapses:
256
258
  raise BluecellulabError("add_replay option can not be used if "
@@ -357,18 +359,17 @@ class CircuitSimulation:
357
359
  ornstein_uhlenbeck_stim_count += 1
358
360
 
359
361
  def _add_synapses(
360
- self, pre_gids=None, add_minis=False, projections=None):
362
+ self, pre_gids=None, add_minis=False):
361
363
  """Instantiate all the synapses."""
362
364
  for cell_id in self.cells:
363
365
  self._add_cell_synapses(
364
366
  cell_id, pre_gids=pre_gids,
365
- add_minis=add_minis,
366
- projections=projections)
367
+ add_minis=add_minis)
367
368
 
368
369
  def _add_cell_synapses(
369
- self, cell_id: CellId, pre_gids=None, add_minis=False, projections=None
370
+ self, cell_id: CellId, pre_gids=None, add_minis=False
370
371
  ) -> None:
371
- syn_descriptions = self.get_syn_descriptions(cell_id, projections=projections)
372
+ syn_descriptions = self.get_syn_descriptions(cell_id)
372
373
 
373
374
  if pre_gids is not None:
374
375
  if self.circuit_format == CircuitFormat.SONATA:
@@ -423,12 +424,10 @@ class CircuitSimulation:
423
424
  )
424
425
  return syn_descriptions[filtered_rows]
425
426
 
426
- def get_syn_descriptions(
427
- self, cell_id: int | tuple[str, int], projections=None
428
- ) -> pd.DataFrame:
427
+ def get_syn_descriptions(self, cell_id: int | tuple[str, int]) -> pd.DataFrame:
429
428
  """Get synapse descriptions dataframe."""
430
429
  cell_id = create_cell_id(cell_id)
431
- return self.circuit_access.extract_synapses(cell_id, projections=projections)
430
+ return self.circuit_access.extract_synapses(cell_id, projections=self.projections)
432
431
 
433
432
  @staticmethod
434
433
  def merge_pre_spike_trains(*train_dicts) -> dict[CellId, np.ndarray]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bluecellulab
3
- Version: 2.6.18
3
+ Version: 2.6.20
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -1,5 +1,5 @@
1
1
  bluecellulab/__init__.py,sha256=JvigOm_7WDjVAodm4R_TyRzj7vd9hmEbvLJDUVtgeqo,899
2
- bluecellulab/circuit_simulation.py,sha256=GLy_O5onhiSa-RajorDHlgP1rkFxjUONB4G6B4upyg0,33672
2
+ bluecellulab/circuit_simulation.py,sha256=cLCA97WKjhlEitD4CUad9n4pH4KF7Iw68w1bZH512yw,33587
3
3
  bluecellulab/connection.py,sha256=volV2YKtmqAF7MOEJar5ldF1ARAo7k2vF9MB1NXybUY,4640
4
4
  bluecellulab/dendrogram.py,sha256=w0vvv0Q169DolTX1j9dAZIvHIl4H258gAjQ1xQaNiGk,6427
5
5
  bluecellulab/exceptions.py,sha256=KIxF7s_7gPVJ07TiQ-Z1D8de7ylV74gNMhzl0339CVM,2379
@@ -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=6_OuUtUjmSvhCj5_mX-8ZnUpv5jXUHHYDYPUcV2m0eE,5958
18
+ bluecellulab/analysis/inject_sequence.py,sha256=Ih3wdNRn0-lM-NW8agrMUGS862CEgzn_hl54DFDXyjM,6325
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=2UtXXd4FA2X5A_7ljjbN4yobpMWD2FWfux67ZFND2rI,31315
@@ -62,9 +62,9 @@ bluecellulab/stimulus/factory.py,sha256=XDbnqCuMCh1RdZLKvlRucMj3wkXDqy6mEda_Oh6Y
62
62
  bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
63
63
  bluecellulab/synapse/synapse_factory.py,sha256=3y15LlaBoNJiU2KUeTkh70pyU5OYf6xQIMSBmmMPMak,6987
64
64
  bluecellulab/synapse/synapse_types.py,sha256=4gne-hve2vq1Lau-LAVPsfLjffVYqAYBW3kCfC7_600,16871
65
- bluecellulab-2.6.18.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
66
- bluecellulab-2.6.18.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
67
- bluecellulab-2.6.18.dist-info/METADATA,sha256=qRtydITfTVimJQmOLizHxMlxNIteEBD1-W9FWWXMr74,7054
68
- bluecellulab-2.6.18.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
69
- bluecellulab-2.6.18.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
70
- bluecellulab-2.6.18.dist-info/RECORD,,
65
+ bluecellulab-2.6.20.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
66
+ bluecellulab-2.6.20.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
67
+ bluecellulab-2.6.20.dist-info/METADATA,sha256=yTXxAI-720NEswCTw_VFn6SZ-MAVtsprxRaM-ZdwSsE,7054
68
+ bluecellulab-2.6.20.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
69
+ bluecellulab-2.6.20.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
70
+ bluecellulab-2.6.20.dist-info/RECORD,,