bluecellulab 2.3.4__py3-none-any.whl → 2.3.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.
- bluecellulab/cell/ballstick/__init__.py +3 -3
- bluecellulab/importer.py +6 -4
- bluecellulab/tools.py +2 -15
- bluecellulab/utils.py +14 -0
- {bluecellulab-2.3.4.dist-info → bluecellulab-2.3.6.dist-info}/METADATA +1 -1
- {bluecellulab-2.3.4.dist-info → bluecellulab-2.3.6.dist-info}/RECORD +10 -10
- {bluecellulab-2.3.4.dist-info → bluecellulab-2.3.6.dist-info}/AUTHORS.txt +0 -0
- {bluecellulab-2.3.4.dist-info → bluecellulab-2.3.6.dist-info}/LICENSE +0 -0
- {bluecellulab-2.3.4.dist-info → bluecellulab-2.3.6.dist-info}/WHEEL +0 -0
- {bluecellulab-2.3.4.dist-info → bluecellulab-2.3.6.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""A simple ball and stick model."""
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import importlib_resources as resources
|
|
4
4
|
from bluecellulab.cell import Cell
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def create_ball_stick() -> Cell:
|
|
8
8
|
"""Creates a ball and stick model by using package's hoc and asc."""
|
|
9
|
-
hoc =
|
|
10
|
-
morphology =
|
|
9
|
+
hoc = resources.files("bluecellulab") / "cell/ballstick/emodel.hoc"
|
|
10
|
+
morphology = resources.files("bluecellulab") / "cell/ballstick/morphology.asc"
|
|
11
11
|
return Cell(template_path=hoc, morphology_path=morphology)
|
bluecellulab/importer.py
CHANGED
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
"""Main importer of bluecellulab."""
|
|
15
15
|
|
|
16
|
+
import importlib_resources as resources
|
|
16
17
|
import logging
|
|
17
18
|
import os
|
|
18
19
|
from types import ModuleType
|
|
19
|
-
import pkg_resources
|
|
20
20
|
|
|
21
21
|
import neuron
|
|
22
22
|
|
|
23
23
|
from bluecellulab.exceptions import BluecellulabError
|
|
24
|
-
from bluecellulab.utils import run_once
|
|
24
|
+
from bluecellulab.utils import CaptureOutput, run_once
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
logger = logging.getLogger(__name__)
|
|
@@ -62,8 +62,10 @@ def import_neurodamus(neuron: ModuleType) -> None:
|
|
|
62
62
|
]
|
|
63
63
|
|
|
64
64
|
for hoc_file in hoc_files:
|
|
65
|
-
hoc_file_path =
|
|
66
|
-
|
|
65
|
+
hoc_file_path = str(resources.files("bluecellulab") / f"hoc/{hoc_file}")
|
|
66
|
+
with CaptureOutput() as stdoud:
|
|
67
|
+
neuron.h.load_file(hoc_file_path)
|
|
68
|
+
logger.debug(f"Loaded {hoc_file}. stdout from the hoc: {stdoud}")
|
|
67
69
|
|
|
68
70
|
|
|
69
71
|
def print_header(neuron: ModuleType, mod_lib_path: str) -> None:
|
bluecellulab/tools.py
CHANGED
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
from __future__ import annotations
|
|
18
|
-
import io
|
|
19
18
|
import json
|
|
20
19
|
import math
|
|
21
20
|
import multiprocessing
|
|
22
21
|
import multiprocessing.pool
|
|
23
22
|
import os
|
|
24
23
|
from pathlib import Path
|
|
25
|
-
import sys
|
|
26
24
|
from typing import Any, Optional, Tuple
|
|
27
25
|
import logging
|
|
28
26
|
|
|
@@ -32,6 +30,7 @@ import numpy as np
|
|
|
32
30
|
import bluecellulab
|
|
33
31
|
from bluecellulab.circuit.circuit_access import EmodelProperties
|
|
34
32
|
from bluecellulab.exceptions import UnsteadyCellError
|
|
33
|
+
from bluecellulab.utils import CaptureOutput
|
|
35
34
|
|
|
36
35
|
logger = logging.getLogger(__name__)
|
|
37
36
|
|
|
@@ -652,21 +651,9 @@ class NumpyEncoder(json.JSONEncoder):
|
|
|
652
651
|
return json.JSONEncoder.default(self, obj)
|
|
653
652
|
|
|
654
653
|
|
|
655
|
-
class get_stdout(list):
|
|
656
|
-
def __enter__(self):
|
|
657
|
-
self.orig_stdout = sys.stdout
|
|
658
|
-
sys.stdout = self.stringio = io.StringIO()
|
|
659
|
-
return self
|
|
660
|
-
|
|
661
|
-
def __exit__(self, *args):
|
|
662
|
-
self.extend(self.stringio.getvalue().splitlines())
|
|
663
|
-
del self.stringio
|
|
664
|
-
sys.stdout = self.orig_stdout
|
|
665
|
-
|
|
666
|
-
|
|
667
654
|
def check_empty_topology() -> bool:
|
|
668
655
|
"""Return true if NEURON simulator topology command is empty."""
|
|
669
|
-
with
|
|
656
|
+
with CaptureOutput() as stdout:
|
|
670
657
|
neuron.h.topology()
|
|
671
658
|
|
|
672
659
|
return stdout == ['', '']
|
bluecellulab/utils.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"""Utility functions."""
|
|
2
|
+
import contextlib
|
|
3
|
+
import io
|
|
2
4
|
|
|
3
5
|
|
|
4
6
|
def run_once(func):
|
|
@@ -9,3 +11,15 @@ def run_once(func):
|
|
|
9
11
|
return func(*args, **kwargs)
|
|
10
12
|
wrapper.has_run = False
|
|
11
13
|
return wrapper
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CaptureOutput(list):
|
|
17
|
+
def __enter__(self):
|
|
18
|
+
self._stringio = io.StringIO()
|
|
19
|
+
self._redirect_stdout = contextlib.redirect_stdout(self._stringio)
|
|
20
|
+
self._redirect_stdout.__enter__()
|
|
21
|
+
return self
|
|
22
|
+
|
|
23
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
24
|
+
self._redirect_stdout.__exit__(exc_type, exc_val, exc_tb)
|
|
25
|
+
self.extend(self._stringio.getvalue().splitlines())
|
|
@@ -3,16 +3,16 @@ bluecellulab/connection.py,sha256=volV2YKtmqAF7MOEJar5ldF1ARAo7k2vF9MB1NXybUY,46
|
|
|
3
3
|
bluecellulab/dendrogram.py,sha256=w0vvv0Q169DolTX1j9dAZIvHIl4H258gAjQ1xQaNiGk,6427
|
|
4
4
|
bluecellulab/exceptions.py,sha256=KIxF7s_7gPVJ07TiQ-Z1D8de7ylV74gNMhzl0339CVM,2379
|
|
5
5
|
bluecellulab/graph.py,sha256=ODiQy4xjRVxtNITXeXpYnqHas0wR7gZ_aXuDAF7jMq4,3419
|
|
6
|
-
bluecellulab/importer.py,sha256=
|
|
6
|
+
bluecellulab/importer.py,sha256=l5nvD0y41-AheqoDNBGAX5qFTCG6_UFlLmqyFbUo77E,2998
|
|
7
7
|
bluecellulab/neuron_interpreter.py,sha256=hXig_u3T6JmEHbkV8ZblEZtX0kY80ate4VpRtANNFrM,2185
|
|
8
8
|
bluecellulab/plotwindow.py,sha256=UVHzml-BB83m5Qr-YGkjR9kB-vSW8mM0Owh2j95yIaU,2721
|
|
9
9
|
bluecellulab/psection.py,sha256=EgAS8IS9DcYv2xOkNISgfg_CfRc0nDfRFjvgQhyi9eY,6328
|
|
10
10
|
bluecellulab/psegment.py,sha256=rBryDYHC_uDK9itfXXrFZ0DL9F6WgRICL0j5EHN56QM,3125
|
|
11
11
|
bluecellulab/rngsettings.py,sha256=SLvkgM8K26Z-zTTN__CnFl_KjIJNuF4n_jzviyei5P4,3986
|
|
12
12
|
bluecellulab/ssim.py,sha256=_MyUObeKIHhuT4cbB1uSD7izpZZHNRACiPlO9R1TNa8,33552
|
|
13
|
-
bluecellulab/tools.py,sha256=
|
|
13
|
+
bluecellulab/tools.py,sha256=z8jU4XO5tWMHwxr2IRo5BG0wnGCfCZPsEKz9L6gkwfc,23943
|
|
14
14
|
bluecellulab/type_aliases.py,sha256=EMrunY-pIgZrsmetpAM8lA7tr0TFEzFoU5SX9sBuiOk,312
|
|
15
|
-
bluecellulab/utils.py,sha256=
|
|
15
|
+
bluecellulab/utils.py,sha256=xF-qXb1uCH6_EmchSH6aQxhFI4P8SD08z-t_AZz3lF0,736
|
|
16
16
|
bluecellulab/cell/__init__.py,sha256=Sbc0QOsJ8E7tSwf3q7fsXuE_SevBN6ZmoCVyyU5zfII,208
|
|
17
17
|
bluecellulab/cell/cell_dict.py,sha256=PVmZsjhZ9jp3HC-8QmdFqp-crAcVMSVeLWujcOPLlpo,1346
|
|
18
18
|
bluecellulab/cell/core.py,sha256=UtPjq_SYX8wOehQe7GqkbPxDWG1vIIJQ5-e3T_g29YU,31480
|
|
@@ -24,7 +24,7 @@ bluecellulab/cell/serialized_sections.py,sha256=UQUecO07ChRZ7xHuDp-QAQRUpUiIwROz
|
|
|
24
24
|
bluecellulab/cell/sonata_proxy.py,sha256=dLT9mLlGVpXxj2O2lXN0g7Sq4BwroPLVdPikR2yNMv4,1529
|
|
25
25
|
bluecellulab/cell/stimuli_generator.py,sha256=cJwjNwsQeEBHLjuJIFv6VBSqd9IpmbR7CuSMyotCiWc,6320
|
|
26
26
|
bluecellulab/cell/template.py,sha256=EGZDS7Lb7kScwh0LqKl7BcvA6r5UdNx1_HiYo7ALbPs,8015
|
|
27
|
-
bluecellulab/cell/ballstick/__init__.py,sha256=
|
|
27
|
+
bluecellulab/cell/ballstick/__init__.py,sha256=v1Z8tHFfbpWShxOBdShCUaE0utoz-7rZumuNBQtNOFI,439
|
|
28
28
|
bluecellulab/cell/ballstick/emodel.hoc,sha256=7WcuepK-wB9bASRvNdCwO9Woc9-SpBCFqBqCXKgjsV8,1517
|
|
29
29
|
bluecellulab/cell/ballstick/morphology.asc,sha256=EO0VIRilJAwpiDP2hIevwusfvYptNYhvsu1f5GgbSQo,190
|
|
30
30
|
bluecellulab/circuit/__init__.py,sha256=Khpa13nzNvDlDS2JduyoFTukEduEkWCc5ML_JwGpmZs,361
|
|
@@ -57,9 +57,9 @@ bluecellulab/stimulus/factory.py,sha256=AOby3Sp2g8BJsRccz3afazfCyysyWIgLtcliWlye
|
|
|
57
57
|
bluecellulab/synapse/__init__.py,sha256=RW8XoAMXOvK7OG1nHl_q8jSEKLj9ZN4oWf2nY9HAwuk,192
|
|
58
58
|
bluecellulab/synapse/synapse_factory.py,sha256=ZBRpjvIRyHc4hBfBvtLukLf7E2PjHhzwqGt9O4MBOTk,6862
|
|
59
59
|
bluecellulab/synapse/synapse_types.py,sha256=wWVBfvPYF6g3dSoaXsjJ6QI929yWYrTh_OmauS5Y-Uk,17027
|
|
60
|
-
bluecellulab-2.3.
|
|
61
|
-
bluecellulab-2.3.
|
|
62
|
-
bluecellulab-2.3.
|
|
63
|
-
bluecellulab-2.3.
|
|
64
|
-
bluecellulab-2.3.
|
|
65
|
-
bluecellulab-2.3.
|
|
60
|
+
bluecellulab-2.3.6.dist-info/AUTHORS.txt,sha256=EDs3H-2HXBojbma10psixk3C2rFiOCTIREi2ZAbXYNQ,179
|
|
61
|
+
bluecellulab-2.3.6.dist-info/LICENSE,sha256=xOouu1gC1GGklDxkITlaVl60I9Ab860O-nZsFbWydvU,11749
|
|
62
|
+
bluecellulab-2.3.6.dist-info/METADATA,sha256=sceGz_1cnk0708w26E4YdIx8t1APJltWN45xjmBakD8,6907
|
|
63
|
+
bluecellulab-2.3.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
64
|
+
bluecellulab-2.3.6.dist-info/top_level.txt,sha256=VSyEP8w9l3pXdRkyP_goeMwiNA8KWwitfAqUkveJkdQ,13
|
|
65
|
+
bluecellulab-2.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|