dendrotweaks 0.3.1__py3-none-any.whl → 0.4.0__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.
- dendrotweaks/__init__.py +2 -2
- dendrotweaks/analysis/ephys_analysis.py +12 -8
- dendrotweaks/biophys/__init__.py +7 -0
- dendrotweaks/{membrane → biophys}/default_templates/NEURON_template.py +5 -3
- dendrotweaks/{membrane → biophys}/default_templates/default.py +2 -1
- dendrotweaks/{membrane → biophys}/default_templates/standard_channel.mod +5 -1
- dendrotweaks/{membrane → biophys}/groups.py +2 -2
- dendrotweaks/biophys/io/__init__.py +11 -0
- dendrotweaks/{membrane → biophys}/io/ast.py +6 -0
- dendrotweaks/{membrane → biophys}/io/code_generators.py +7 -1
- dendrotweaks/{membrane → biophys}/io/converter.py +3 -3
- dendrotweaks/{membrane → biophys}/io/factories.py +8 -6
- dendrotweaks/biophys/io/loader.py +190 -0
- dendrotweaks/{membrane → biophys}/io/parser.py +8 -8
- dendrotweaks/{membrane → biophys}/mechanisms.py +14 -10
- dendrotweaks/model.py +65 -32
- dendrotweaks/morphology/sec_trees.py +1 -1
- dendrotweaks/path_manager.py +9 -11
- dendrotweaks/simulators.py +82 -48
- dendrotweaks/stimuli/populations.py +11 -0
- {dendrotweaks-0.3.1.dist-info → dendrotweaks-0.4.0.dist-info}/METADATA +2 -2
- dendrotweaks-0.4.0.dist-info/RECORD +56 -0
- {dendrotweaks-0.3.1.dist-info → dendrotweaks-0.4.0.dist-info}/WHEEL +1 -1
- dendrotweaks/membrane/__init__.py +0 -6
- dendrotweaks/membrane/io/__init__.py +0 -11
- dendrotweaks/membrane/io/loader.py +0 -90
- dendrotweaks-0.3.1.dist-info/RECORD +0 -56
- /dendrotweaks/{membrane → biophys}/default_mod/AMPA.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_mod/AMPA_NMDA.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_mod/CaDyn.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_mod/GABAa.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_mod/Leak.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_mod/NMDA.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_mod/vecstim.mod +0 -0
- /dendrotweaks/{membrane → biophys}/default_templates/template_jaxley.py +0 -0
- /dendrotweaks/{membrane → biophys}/default_templates/template_jaxley_new.py +0 -0
- /dendrotweaks/{membrane → biophys}/distributions.py +0 -0
- /dendrotweaks/{membrane → biophys}/io/grammar.py +0 -0
- /dendrotweaks/{membrane → biophys}/io/reader.py +0 -0
- {dendrotweaks-0.3.1.dist-info → dendrotweaks-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {dendrotweaks-0.3.1.dist-info → dendrotweaks-0.4.0.dist-info}/top_level.txt +0 -0
| @@ -1,90 +0,0 @@ | |
| 1 | 
            -
            import os
         | 
| 2 | 
            -
            import shutil
         | 
| 3 | 
            -
            import subprocess
         | 
| 4 | 
            -
            import neuron
         | 
| 5 | 
            -
            from neuron import h
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            from pprint import pprint
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            class MODFileLoader():
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                def __init__(self):
         | 
| 12 | 
            -
                    self._loaded_mechanisms = set()
         | 
| 13 | 
            -
                    self.verbose = False
         | 
| 14 | 
            -
                          
         | 
| 15 | 
            -
                # LOADING METHODS
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                def _get_mechanism_dir(self, path_to_mod_file: str) -> str:
         | 
| 18 | 
            -
                    """
         | 
| 19 | 
            -
                    Get the subdirectory for the given mod file.
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                    Parameters
         | 
| 22 | 
            -
                    ----------
         | 
| 23 | 
            -
                    path_to_mod_file : str
         | 
| 24 | 
            -
                        Path to the .mod file.
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                    Returns
         | 
| 27 | 
            -
                    -------
         | 
| 28 | 
            -
                    str
         | 
| 29 | 
            -
                        Path to the subdirectory for the mechanism.
         | 
| 30 | 
            -
                    """
         | 
| 31 | 
            -
                    mechanism_name = os.path.basename(path_to_mod_file).replace('.mod', '')
         | 
| 32 | 
            -
                    parent_dir = os.path.dirname(path_to_mod_file)
         | 
| 33 | 
            -
                    return os.path.join(parent_dir, mechanism_name)
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                def load_mechanism(self, path_to_mod_file: str, 
         | 
| 36 | 
            -
                                   recompile: bool = False) -> None:
         | 
| 37 | 
            -
                    """
         | 
| 38 | 
            -
                    Load a mechanism from the specified mod file.
         | 
| 39 | 
            -
                    Uses the NEURON neuron.load_mechanisms method to make
         | 
| 40 | 
            -
                    the mechanism available in the hoc interpreter.
         | 
| 41 | 
            -
                    Creates a temporary directory for the mechanism files
         | 
| 42 | 
            -
                    to be able to dynamically load mechanisms.
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                    Parameters
         | 
| 45 | 
            -
                    ----------
         | 
| 46 | 
            -
                    path_to_mod_file : str
         | 
| 47 | 
            -
                        Path to the .mod file.
         | 
| 48 | 
            -
                    recompile : bool
         | 
| 49 | 
            -
                        Force recompilation even if already compiled.
         | 
| 50 | 
            -
                    """
         | 
| 51 | 
            -
                    mechanism_name = os.path.basename(path_to_mod_file).replace('.mod', '')
         | 
| 52 | 
            -
                    mechanism_dir = self._get_mechanism_dir(path_to_mod_file)
         | 
| 53 | 
            -
                    x86_64_dir = os.path.join(mechanism_dir, 'x86_64')
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                    if self.verbose: print(f"{'=' * 60}\nLoading mechanism {mechanism_name} to NEURON...\n{'=' * 60}")
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                    if mechanism_name in self._loaded_mechanisms:
         | 
| 58 | 
            -
                        if self.verbose: print(f'Mechanism "{mechanism_name}" already loaded')
         | 
| 59 | 
            -
                        return
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                    if recompile and os.path.exists(mechanism_dir):
         | 
| 62 | 
            -
                        shutil.rmtree(mechanism_dir)
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                    if not os.path.exists(x86_64_dir):
         | 
| 65 | 
            -
                        if self.verbose: print(f'Compiling mechanism "{mechanism_name}"...')
         | 
| 66 | 
            -
                        os.makedirs(mechanism_dir, exist_ok=True)
         | 
| 67 | 
            -
                        shutil.copy(path_to_mod_file, mechanism_dir)
         | 
| 68 | 
            -
                        self._compile_files(mechanism_dir)
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                    if hasattr(h, mechanism_name):
         | 
| 71 | 
            -
                        if self.verbose: print(f'Mechanism "{mechanism_name}" already exists in hoc')
         | 
| 72 | 
            -
                    else:
         | 
| 73 | 
            -
                        try:
         | 
| 74 | 
            -
                            neuron.load_mechanisms(mechanism_dir)
         | 
| 75 | 
            -
                        except Exception as e:
         | 
| 76 | 
            -
                            print(f"Failed to load mechanism {mechanism_name}: {e}")
         | 
| 77 | 
            -
                            return
         | 
| 78 | 
            -
                    self._loaded_mechanisms.add(mechanism_name)
         | 
| 79 | 
            -
                    if self.verbose: print(f'Loaded mechanism "{mechanism_name}"')
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                # HELPER METHODS
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                
         | 
| 84 | 
            -
                def _compile_files(self, path: str) -> None:
         | 
| 85 | 
            -
                    """Compile the MOD files in the specified directory."""
         | 
| 86 | 
            -
                    try:
         | 
| 87 | 
            -
                        subprocess.run(["nrnivmodl"], cwd=path, check=True)
         | 
| 88 | 
            -
                    except subprocess.CalledProcessError as e:
         | 
| 89 | 
            -
                        print(f"Compilation failed: {e}")
         | 
| 90 | 
            -
             | 
| @@ -1,56 +0,0 @@ | |
| 1 | 
            -
            dendrotweaks/__init__.py,sha256=Oty4wVcVFs_9w7L9peCncnzQKFubqkRHyf4c3HKfwWY,385
         | 
| 2 | 
            -
            dendrotweaks/model.py,sha256=wy17K85d95bD1ioibhDxs8rcNCzow3BP1OVam1b1bTM,67445
         | 
| 3 | 
            -
            dendrotweaks/model_io.py,sha256=xwXKMcUle-Y0HoWFYVZu3G8v4pdQXmeaDfl2Xi65eHw,2137
         | 
| 4 | 
            -
            dendrotweaks/path_manager.py,sha256=SfZ7Br-WmUhpvdRTgeOqMzaYVgLpXoSGbekxJvNkZT4,8794
         | 
| 5 | 
            -
            dendrotweaks/simulators.py,sha256=cVbzbhE48D1ovn7Rg8bU0pI9ztbEqQF2da5gnEMu8Ec,6137
         | 
| 6 | 
            -
            dendrotweaks/utils.py,sha256=jaUJNb39Bsevg3WJByP56bO7CLj1wzlh-uGZl-lxi1I,7131
         | 
| 7 | 
            -
            dendrotweaks/analysis/__init__.py,sha256=SEYpoQ5iXiQXyHB20-IAdDHYI-7CR5GYFXIwr-O05Ug,858
         | 
| 8 | 
            -
            dendrotweaks/analysis/ephys_analysis.py,sha256=oXRjad34tKMDiqEO11uZibHpe2auB2GCetcgd2rVP-o,14124
         | 
| 9 | 
            -
            dendrotweaks/analysis/morphometric_analysis.py,sha256=5zohjGssyx-wezI-yY3Q-kYM_wzAQLLFBJ9Xk950_JY,3571
         | 
| 10 | 
            -
            dendrotweaks/membrane/__init__.py,sha256=H3KsbVQonC1BKBnuchAIxGXj5Zl-xN3egOanVUkgs-o,322
         | 
| 11 | 
            -
            dendrotweaks/membrane/distributions.py,sha256=ADPFPA-CN7AbRJj0Ry4TxFZJhdYXJm87iIGWZSDr5vI,10299
         | 
| 12 | 
            -
            dendrotweaks/membrane/groups.py,sha256=qN4Q-YodXVLmpGRYvWlZ7Kd9gVnLSK1l4g2Qc0T8dYs,3483
         | 
| 13 | 
            -
            dendrotweaks/membrane/mechanisms.py,sha256=F4b6VqI3IjyoOQ6GAFvcy7er5-BFCca8JFnQB_HmjmI,18352
         | 
| 14 | 
            -
            dendrotweaks/membrane/default_mod/AMPA.mod,sha256=HY_pWzYvaSDV-w7qruenG2mnll8v79s40HFHjUCIi4U,980
         | 
| 15 | 
            -
            dendrotweaks/membrane/default_mod/AMPA_NMDA.mod,sha256=ztv2ePUiEQZ93-23FTkGO2DC91rehQuqo0NUIbHZ368,2318
         | 
| 16 | 
            -
            dendrotweaks/membrane/default_mod/CaDyn.mod,sha256=gwc69K_rxu2w_mV7CnOSOnVaCMc8Z-MfdBFf6lAj4kg,1298
         | 
| 17 | 
            -
            dendrotweaks/membrane/default_mod/GABAa.mod,sha256=jdGRid-Wzw4y9kHvq74oSMogLhSiS-Ac2DDaLOrxVi8,983
         | 
| 18 | 
            -
            dendrotweaks/membrane/default_mod/Leak.mod,sha256=u0lwMYGgl5kNZN5W4N6YHgRSeVxb-z2oM9fqou5rCV8,420
         | 
| 19 | 
            -
            dendrotweaks/membrane/default_mod/NMDA.mod,sha256=tT4Q5UPoeztXcQ45uZc2PUO3-8OkDLCmrS7WDsn1yQQ,1185
         | 
| 20 | 
            -
            dendrotweaks/membrane/default_mod/vecstim.mod,sha256=iSpJgR96O2Z3pLNUFIsZ7YJ529ncKUBaZqDJvA0_oV0,965
         | 
| 21 | 
            -
            dendrotweaks/membrane/default_templates/NEURON_template.py,sha256=BlvA48B48f0AyiepXmrOmGJL5Xe5XDshG9w6h5gDEEs,14874
         | 
| 22 | 
            -
            dendrotweaks/membrane/default_templates/default.py,sha256=vDxND86RJEw7XHajkg5P0vM2Oss5dyW5m_ugLMeCbT0,2145
         | 
| 23 | 
            -
            dendrotweaks/membrane/default_templates/standard_channel.mod,sha256=Jpu2rxldAE6kxaylIlPc80F5wpKETodpOvoMbFXhWTA,2861
         | 
| 24 | 
            -
            dendrotweaks/membrane/default_templates/template_jaxley.py,sha256=t-GsCSUyQ7rDoaLmyuWd9bIxB8W3bCqJdnikD59EVvI,3676
         | 
| 25 | 
            -
            dendrotweaks/membrane/default_templates/template_jaxley_new.py,sha256=I62KhnOYNV1bT-nPsDTxjIISYmDcso2X8rnsos28nYs,3631
         | 
| 26 | 
            -
            dendrotweaks/membrane/io/__init__.py,sha256=r84iLBrdmCgGP-dG9iaamBHUGldtAgPyqSujU-3U8ik,584
         | 
| 27 | 
            -
            dendrotweaks/membrane/io/ast.py,sha256=wnJNy2ga1DsZWQ1lpp1QhK2jvM4aDph7u_27VmyJcXw,5894
         | 
| 28 | 
            -
            dendrotweaks/membrane/io/code_generators.py,sha256=jhyjvTisV-tavz_yuQ-tOa3JJ56UNUk_pkN9xS6GEqQ,11407
         | 
| 29 | 
            -
            dendrotweaks/membrane/io/converter.py,sha256=vNCKDk0JqdoqxMWGi2AxT-TZ2YS2itUc7bpm9pRX-6o,3374
         | 
| 30 | 
            -
            dendrotweaks/membrane/io/factories.py,sha256=rCfZiubZPmikB8nxfjh3Dzg4ZHUXgZX79kmJZDLovwI,4979
         | 
| 31 | 
            -
            dendrotweaks/membrane/io/grammar.py,sha256=TJLTDlr8Ajp3J9DJ4IvulOCcpUkYr7HnoI0TGnNuEPc,11677
         | 
| 32 | 
            -
            dendrotweaks/membrane/io/loader.py,sha256=vUh6YMozKD-MvrP2mNyW4-vRoYxXJwK1W4QFUSgcLGU,3042
         | 
| 33 | 
            -
            dendrotweaks/membrane/io/parser.py,sha256=-SuY9PxlIS5l0bAGuEgLAn89n3F2Ss-X24ehGGZY81o,17921
         | 
| 34 | 
            -
            dendrotweaks/membrane/io/reader.py,sha256=JWm5WM9illvSfDkhWEmWBcj8Y7PSi8zeZX9j1ARUHVU,6576
         | 
| 35 | 
            -
            dendrotweaks/morphology/__init__.py,sha256=aqJTQOpRVOYcbWqZ2q4e-Oy735r9_ubW-uE_5cFZVtI,323
         | 
| 36 | 
            -
            dendrotweaks/morphology/domains.py,sha256=Y4txcGdBdl2aK1DfbTRziNtDyd6bChczwpCWE7lTFzg,2391
         | 
| 37 | 
            -
            dendrotweaks/morphology/point_trees.py,sha256=5dUPaQXYPdJbWoD3pFI2DV2XnuFRhB5d0wTBlfmmIeI,21600
         | 
| 38 | 
            -
            dendrotweaks/morphology/sec_trees.py,sha256=FMreuh5mN3oXtvy13oqEc8t-r8a36CPfdkaOqeNo2ts,36894
         | 
| 39 | 
            -
            dendrotweaks/morphology/seg_trees.py,sha256=uwL1X9qeFNyJVHua1I3rhp0fLSRrS2TAVyb1Fnw4RwQ,3595
         | 
| 40 | 
            -
            dendrotweaks/morphology/trees.py,sha256=NrNvPMR-U0clt63eqwVJqU0H8NJgY53QGA_BkdcwkQI,16033
         | 
| 41 | 
            -
            dendrotweaks/morphology/io/__init__.py,sha256=gAZqZdf5VKPb6ksK8Lwt7MbTAq8TDP8uq3Vs_ebNFEY,324
         | 
| 42 | 
            -
            dendrotweaks/morphology/io/factories.py,sha256=NngNINw73diGK7fud314JzWVhxv2aYLuA9wUuQA0Diw,6344
         | 
| 43 | 
            -
            dendrotweaks/morphology/io/reader.py,sha256=hW3c541WtG1rNag_YreEhvrLzm8-OTtw0fQREeHDthM,1913
         | 
| 44 | 
            -
            dendrotweaks/morphology/io/validation.py,sha256=lVkYw9y9yG5QpRh_N0YQ3FbZwuSUsQfSqJTMumMcDdc,7872
         | 
| 45 | 
            -
            dendrotweaks/morphology/reduce/__init__.py,sha256=p6Mg3KDHxTt8S4DtI0m7L7MqV6dS2pdIYAwB7B-toVw,921
         | 
| 46 | 
            -
            dendrotweaks/morphology/reduce/reduce.py,sha256=5czZDrG3xsvHn3c_tbYhUOlXgST989-RS-ntbhlvvA0,6361
         | 
| 47 | 
            -
            dendrotweaks/morphology/reduce/reduced_cylinder.py,sha256=jGJ4J-amukRr-3DPirVR5pzNO-6H7_sZF1N_X57ZGdw,5132
         | 
| 48 | 
            -
            dendrotweaks/stimuli/__init__.py,sha256=bFfSEZhCVpwOVEBgLe65iiY3SdpjKPhyLemC1z5OX9I,153
         | 
| 49 | 
            -
            dendrotweaks/stimuli/iclamps.py,sha256=NjkhhwZKJR1f_g3N9BVxMVoO9ubBk5WkQ6h9Bnf9xgA,1681
         | 
| 50 | 
            -
            dendrotweaks/stimuli/populations.py,sha256=wZwy3PC1uRmQa-WnTLZLy7PGKCQrRJgmmhRIaGdJlLU,7991
         | 
| 51 | 
            -
            dendrotweaks/stimuli/synapses.py,sha256=g4MgWTske2TZ2i9FIIOE8-KXNx_3dWa3zEhB2rcqYig,5470
         | 
| 52 | 
            -
            dendrotweaks-0.3.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
         | 
| 53 | 
            -
            dendrotweaks-0.3.1.dist-info/METADATA,sha256=jcnz3Eq3NdoALKHhwoE8lnrA5iSNAcO6oPBU3yZ0GJs,2687
         | 
| 54 | 
            -
            dendrotweaks-0.3.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
         | 
| 55 | 
            -
            dendrotweaks-0.3.1.dist-info/top_level.txt,sha256=OzT_2BSI5j5zxC447K6Y-0W-GHbued7iX-_hFGAKMxY,13
         | 
| 56 | 
            -
            dendrotweaks-0.3.1.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         |