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

bluecellulab/cell/core.py CHANGED
@@ -840,7 +840,18 @@ class Cell(InjectableMixin, PlottableMixin):
840
840
  connected to that cell."""
841
841
  if self.sonata_proxy is None:
842
842
  raise BluecellulabError("Cell: add_synapse_replay requires a sonata proxy.")
843
- synapse_spikes: dict = get_synapse_replay_spikes(stimulus.spike_file)
843
+
844
+ file_path = Path(stimulus.spike_file).expanduser()
845
+ if not file_path.is_absolute():
846
+ config_dir = stimulus.config_dir
847
+ if config_dir is not None:
848
+ file_path = Path(config_dir) / file_path
849
+
850
+ file_path = file_path.resolve()
851
+
852
+ if not file_path.exists():
853
+ raise FileNotFoundError(f"Spike file not found: {str(file_path)}")
854
+ synapse_spikes: dict = get_synapse_replay_spikes(str(file_path))
844
855
  for synapse_id, synapse in self.synapses.items():
845
856
  source_population = synapse.syn_description["source_population_name"]
846
857
  pre_gid = CellId(
@@ -55,8 +55,9 @@ class SonataSimulationConfig:
55
55
  inputs = self.impl.config.get("inputs")
56
56
  if inputs is None:
57
57
  return result
58
+ config_dir = self._get_config_dir()
58
59
  for value in inputs.values():
59
- stimulus = Stimulus.from_sonata(value)
60
+ stimulus = Stimulus.from_sonata(value, config_dir=config_dir)
60
61
  if stimulus:
61
62
  result.append(stimulus)
62
63
  return result
@@ -84,7 +85,11 @@ class SonataSimulationConfig:
84
85
  filepath = self.impl.config.get("compartment_sets_file")
85
86
  if not filepath:
86
87
  raise ValueError("No 'compartment_sets_file' entry found in SONATA config.")
87
- with open(filepath, 'r') as f:
88
+ config_dir = self._get_config_dir()
89
+ full_path = Path(filepath)
90
+ if config_dir is not None and not full_path.is_absolute():
91
+ full_path = Path(config_dir) / filepath
92
+ with open(full_path, 'r') as f:
88
93
  return json.load(f)
89
94
 
90
95
  @lru_cache(maxsize=1)
@@ -214,3 +219,12 @@ class SonataSimulationConfig:
214
219
  connection_override: ConnectionOverrides
215
220
  ) -> None:
216
221
  self._connection_overrides.append(connection_override)
222
+
223
+ def _get_config_dir(self):
224
+ # Prefer config_path, fallback to _simulation_config_path
225
+ config_path = getattr(self.impl, "config_path", None)
226
+ if config_path is None:
227
+ sim_config_path = getattr(self.impl, "_simulation_config_path", None)
228
+ if sim_config_path is not None:
229
+ config_path = Path(sim_config_path)
230
+ return str(config_path.parent) if config_path is not None else None
@@ -19,7 +19,6 @@ Run-time validates the data via Pydantic.
19
19
  from __future__ import annotations
20
20
 
21
21
  from enum import Enum
22
- from pathlib import Path
23
22
  from typing import Optional
24
23
  import warnings
25
24
 
@@ -212,7 +211,7 @@ class Stimulus:
212
211
  raise ValueError(f"Unknown pattern {pattern}")
213
212
 
214
213
  @classmethod
215
- def from_sonata(cls, stimulus_entry: dict) -> Optional[Stimulus]:
214
+ def from_sonata(cls, stimulus_entry: dict, config_dir: Optional[str] = None) -> Optional[Stimulus]:
216
215
  pattern = Pattern.from_sonata(stimulus_entry["module"])
217
216
  if pattern == Pattern.NOISE:
218
217
  return Noise(
@@ -259,6 +258,7 @@ class Stimulus:
259
258
  delay=stimulus_entry["delay"],
260
259
  duration=stimulus_entry["duration"],
261
260
  spike_file=stimulus_entry["spike_file"],
261
+ config_dir=config_dir,
262
262
  )
263
263
  elif pattern == Pattern.SHOT_NOISE:
264
264
  return ShotNoise(
@@ -361,13 +361,7 @@ class RelativeLinear(Stimulus):
361
361
  @dataclass(frozen=True, config=dict(extra="forbid"))
362
362
  class SynapseReplay(Stimulus):
363
363
  spike_file: str
364
-
365
- @field_validator("spike_file")
366
- @classmethod
367
- def spike_file_exists(cls, v):
368
- if not Path(v).exists():
369
- raise ValueError(f"spike_file {v} does not exist")
370
- return v
364
+ config_dir: Optional[str] = None
371
365
 
372
366
 
373
367
  @dataclass(frozen=True, config=dict(extra="forbid"))
bluecellulab/tools.py CHANGED
@@ -127,7 +127,7 @@ def calculate_SS_voltage_subprocess(
127
127
  simulation.run(1000, cvode=template_accepts_cvode(template_path))
128
128
  time = cell.get_time()
129
129
  voltage = cell.get_voltage_recording(section=neuron_section, segx=segx)
130
- SS_voltage = np.mean(voltage[np.where((time < 1000) & (time > 800))])
130
+ SS_voltage = np.mean(voltage[np.where((time <= 1000) & (time > 800))])
131
131
  cell.delete()
132
132
 
133
133
  if check_for_spiking:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluecellulab
3
- Version: 2.6.69
3
+ Version: 2.6.71
4
4
  Summary: Biologically detailed neural network simulations and analysis.
5
5
  Author: Blue Brain Project, EPFL
6
6
  License: Apache2.0
@@ -10,7 +10,7 @@ bluecellulab/plotwindow.py,sha256=ePU-EegZ1Sqk0SoYYiQ6k24ZO4s3Hgfpx10uePiJ5xM,27
10
10
  bluecellulab/psection.py,sha256=FSOwRNuOTyB469BM-jPEf9l1J59FamXmzrQgBI6cnP4,6174
11
11
  bluecellulab/psegment.py,sha256=PTgoGLqM4oFIdF_8QHFQCU59j-8TQmtq6PakiGUQhIo,3138
12
12
  bluecellulab/rngsettings.py,sha256=2Ykb4Ylk3XTs58x1UIxjg8XJqjSpnCgKRZ8avXCDpxk,4237
13
- bluecellulab/tools.py,sha256=XvfWGSbNevAEUa8TYlAJtRurKOvbARY0wLa6qHkm93g,21925
13
+ bluecellulab/tools.py,sha256=ePal9-y6AnIgSdRzqqL8fH57M96VXUWPEGvJ7mpz4Ps,21926
14
14
  bluecellulab/type_aliases.py,sha256=DvgjERv2Ztdw_sW63JrZTQGpJ0x5uMTFB5hcBHDb0WA,441
15
15
  bluecellulab/utils.py,sha256=0NhwlzyLnSi8kziSfDsQf7pokO4qDkMJVAO33kSX4O0,2227
16
16
  bluecellulab/verbosity.py,sha256=T0IgX7DrRo19faxrT4Xzb27gqxzoILQ8FzYKxvUeaPM,1342
@@ -21,7 +21,7 @@ bluecellulab/analysis/plotting.py,sha256=PqRoaZz33ULMw8A9YnZXXrxcUd84M_dwlYMTFhG
21
21
  bluecellulab/analysis/utils.py,sha256=eMirP557D11BuedgSqjripDxOq1haIldNbnYNetV1bg,121
22
22
  bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
23
23
  bluecellulab/cell/cell_dict.py,sha256=VE7pi-NsMVRSmo-PSdbiLYmolDOu0Gc6JxFBkuQpFdk,1346
24
- bluecellulab/cell/core.py,sha256=PKus_O8iREcU5-SDBjM7XbRUwromPz-K9imGo2Q11-4,37875
24
+ bluecellulab/cell/core.py,sha256=xNyY3Ly4E7wb4LGIYcA2vT0EKsQYd1tNItcmxgKKK2o,38267
25
25
  bluecellulab/cell/injector.py,sha256=GB0pmyZMOHNV-lzd_t4cLoDE87S58IMbe7-qU1zBWvE,19033
26
26
  bluecellulab/cell/plotting.py,sha256=t2qDUabFtsBb-nJMkDh5UfsgW-wvQ2wfDwAVZ8-hWPo,4032
27
27
  bluecellulab/cell/random.py,sha256=pemekc11geRBKD8Ghb82tvKOZLfFWkUz1IKLc_NWg-A,1773
@@ -50,7 +50,7 @@ bluecellulab/circuit/config/__init__.py,sha256=aaoJXRKBJzpxxREo9NxKc-_CCPmVeuR1m
50
50
  bluecellulab/circuit/config/bluepy_simulation_config.py,sha256=V3eqOzskX7VrMDpl-nMQVEhDg8QWgRmRduyJBii5sgI,6974
51
51
  bluecellulab/circuit/config/definition.py,sha256=cotKRDHOjzZKNgNSrZ29voU-66W8jaGt5yuge1hyv18,2953
52
52
  bluecellulab/circuit/config/sections.py,sha256=QRnU44-OFvHxcF1LX4bAEP9dk3I6UKsuPNBbWkdfmRE,7151
53
- bluecellulab/circuit/config/sonata_simulation_config.py,sha256=J1DFqNxIJKAxD1KU_oJV9tigMdpT_Not0Q8SF5q2EeQ,7271
53
+ bluecellulab/circuit/config/sonata_simulation_config.py,sha256=8b3OkjYG7MJnrm498Tx6x1B2MbvwDZO0aAAxy6iHuts,7983
54
54
  bluecellulab/hoc/Cell.hoc,sha256=z77qRQG_-afj-RLX0xN6V-K6Duq3bR7vmlDrGWPdh4E,16435
55
55
  bluecellulab/hoc/RNGSettings.hoc,sha256=okJBdqlPXET8BrpG1Q31GdaxHfpe3CE0L5P7MAhfQTE,1227
56
56
  bluecellulab/hoc/TDistFunc.hoc,sha256=WKX-anvL83xGuGPH9g1oIORB17UM4Pi3-iIXzKO-pUQ,2663
@@ -69,16 +69,16 @@ bluecellulab/simulation/parallel.py,sha256=oQ_oV2EKr8gP4yF2Dq8q9MiblDyi89_wBgLzQ
69
69
  bluecellulab/simulation/report.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
70
  bluecellulab/simulation/simulation.py,sha256=OfrzeHvLmOV2ptYcGie_fVGrtkDfizLpE6ZyQWVxnIE,6492
71
71
  bluecellulab/stimulus/__init__.py,sha256=DgIgVaSyR-URf3JZzvO6j-tjCerzvktuK-ep8pjMRPQ,37
72
- bluecellulab/stimulus/circuit_stimulus_definitions.py,sha256=h_SqjJ-L3yNxiEO8I6Cy7i-lhfZXjrdCc92dl8bjOog,17229
72
+ bluecellulab/stimulus/circuit_stimulus_definitions.py,sha256=Xdd4j3oiGHNsuGEjI-KLy0EQd-Qd7C9JvOSLJwIr7pE,17113
73
73
  bluecellulab/stimulus/factory.py,sha256=4fvVFFjOGHSqBidLe_W1zQozfMEeePXWO6yYCs30-SM,30780
74
74
  bluecellulab/stimulus/stimulus.py,sha256=a_hKJUtZmIgjiFjbJf6RzUPokELqn0IHCgIWGw5XLm8,30322
75
75
  bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
76
76
  bluecellulab/synapse/synapse_factory.py,sha256=NHwRMYMrnRVm_sHmyKTJ1bdoNmWZNU4UPOGu7FCi-PE,6987
77
77
  bluecellulab/synapse/synapse_types.py,sha256=zs_yBvGTH4QrbQF3nEViidyq1WM_ZcTSFdjUxB3khW0,16871
78
78
  bluecellulab/validation/validation.py,sha256=D35LE_131CtIzeeePAPz1OFzncGjAcvF02lSIvGvL2E,21331
79
- bluecellulab-2.6.69.dist-info/licenses/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
80
- bluecellulab-2.6.69.dist-info/licenses/LICENSE,sha256=dAMAR2Sud4Nead1wGFleKiwTZfkTNZbzmuGfcTKb3kg,11335
81
- bluecellulab-2.6.69.dist-info/METADATA,sha256=FWJpgOEcP_8xqAXBDpNrlgkB0wqEj6YF1z8NUDd2nSM,8359
82
- bluecellulab-2.6.69.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
83
- bluecellulab-2.6.69.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
84
- bluecellulab-2.6.69.dist-info/RECORD,,
79
+ bluecellulab-2.6.71.dist-info/licenses/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
80
+ bluecellulab-2.6.71.dist-info/licenses/LICENSE,sha256=dAMAR2Sud4Nead1wGFleKiwTZfkTNZbzmuGfcTKb3kg,11335
81
+ bluecellulab-2.6.71.dist-info/METADATA,sha256=1dFG_vPcTlOZSX9CTbOdsa1uPxdc1OmlLrCdxTaDccA,8359
82
+ bluecellulab-2.6.71.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
83
+ bluecellulab-2.6.71.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
84
+ bluecellulab-2.6.71.dist-info/RECORD,,