├── .coveragerc ├── .docker ├── Dockerfile_python └── Dockerfile_uncertainpy ├── .dockerignore ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── MANIFEST.in ├── README.md ├── binder ├── apt.txt ├── postBuild └── requirements.txt ├── codecov.yaml ├── docs ├── Makefile ├── images │ ├── coffee_cup.png │ └── diagram.png └── source │ ├── conf.py │ ├── core.rst │ ├── core │ ├── base.rst │ ├── parallel.rst │ ├── run_model.rst │ └── uncertainty_calculations.rst │ ├── data.rst │ ├── data │ ├── data.rst │ └── data_feature.rst │ ├── distribution.rst │ ├── examples.rst │ ├── examples │ ├── bahl.rst │ ├── brunel.rst │ ├── coffee_cup.rst │ ├── coffee_cup_dependent.rst │ ├── hodgkin_huxley.rst │ └── interneuron.rst │ ├── faq.rst │ ├── features.rst │ ├── features │ ├── efel_features.rst │ ├── general_network_features.rst │ ├── general_spiking_features.rst │ ├── master_features.rst │ ├── network_features.rst │ ├── spikes.rst │ └── spiking_features.rst │ ├── index.rst │ ├── installation.rst │ ├── logging.rst │ ├── models.rst │ ├── models │ ├── main_model.rst │ ├── multiple_outputs.rst │ ├── nest_model.rst │ └── neuron_model.rst │ ├── parameters.rst │ ├── parameters │ ├── parameter.rst │ └── parameters.rst │ ├── plotting.rst │ ├── quickstart.rst │ ├── theory.rst │ ├── theory │ ├── pce.rst │ ├── problem.rst │ ├── qmc.rst │ ├── rosenblatt.rst │ ├── sa.rst │ └── uq.rst │ ├── uncertainty_estimation.rst │ └── utilities.rst ├── examples ├── bahl │ ├── Bahl2012.pdf │ ├── bahl_model │ │ ├── ca_spike1.ses │ │ ├── ca_spike2.ses │ │ ├── channels │ │ │ ├── IKM.mod │ │ │ ├── SlowCa.mod │ │ │ ├── cad.mod │ │ │ ├── h.mod │ │ │ ├── kca.mod │ │ │ ├── kfast.mod │ │ │ ├── kslow.mod │ │ │ ├── nap.mod │ │ │ ├── nat.mod │ │ │ └── x86_64 │ │ │ │ ├── IKM.c │ │ │ │ ├── IKM.lo │ │ │ │ ├── IKM.mod │ │ │ │ ├── SlowCa.c │ │ │ │ ├── SlowCa.lo │ │ │ │ ├── SlowCa.mod │ │ │ │ ├── cad.c │ │ │ │ ├── cad.lo │ │ │ │ ├── cad.mod │ │ │ │ ├── h.c │ │ │ │ ├── h.lo │ │ │ │ ├── h.mod │ │ │ │ ├── kca.c │ │ │ │ ├── kca.lo │ │ │ │ ├── kca.mod │ │ │ │ ├── kfast.c │ │ │ │ ├── kfast.lo │ │ │ │ ├── kfast.mod │ │ │ │ ├── kslow.c │ │ │ │ ├── kslow.lo │ │ │ │ ├── kslow.mod │ │ │ │ ├── libnrnmech.la │ │ │ │ ├── mod_func.c │ │ │ │ ├── mod_func.lo │ │ │ │ ├── nap.c │ │ │ │ ├── nap.lo │ │ │ │ ├── nap.mod │ │ │ │ ├── nat.c │ │ │ │ ├── nat.lo │ │ │ │ ├── nat.mod │ │ │ │ └── special │ │ ├── example1.hoc │ │ ├── example2.hoc │ │ ├── example3.hoc │ │ ├── init_models_with_ca │ │ │ ├── init_model1.hoc │ │ │ ├── init_model2.hoc │ │ │ ├── init_model3.hoc │ │ │ ├── init_model6.hoc │ │ │ ├── init_model7.hoc │ │ │ └── init_model8.hoc │ │ ├── init_models_without_ca │ │ │ ├── init_model1.hoc │ │ │ ├── init_model10.hoc │ │ │ ├── init_model2.hoc │ │ │ ├── init_model3.hoc │ │ │ ├── init_model4.hoc │ │ │ ├── init_model5.hoc │ │ │ ├── init_model6.hoc │ │ │ ├── init_model7.hoc │ │ │ ├── init_model8.hoc │ │ │ ├── init_model9.hoc │ │ │ └── init_model_avg1_6.hoc │ │ ├── mosinit.hoc │ │ ├── readme.html │ │ ├── reduced_geometry_20com.hoc │ │ ├── reduced_model.hoc │ │ ├── regular_spiking.ses │ │ └── screenshot.png │ ├── modelDB_link.txt │ └── uq_bahl.py ├── brunel │ ├── brunel.pdf │ ├── brunel.py │ └── uq_brunel.py ├── coffee_cup │ ├── coffee_cup.ipynb │ ├── uq_coffee_class.py │ └── uq_coffee_function.py ├── coffee_cup_dependent │ ├── uq_coffee_dependent_class.py │ └── uq_coffee_dependent_function.py ├── hodgkin_huxley │ ├── hodgkin_huxley.py │ └── uq_hodgkin_huxley.py ├── interneuron │ ├── halnes.pdf │ ├── interneuron_model │ │ ├── 091008A2.hoc │ │ ├── Cad.mod │ │ ├── HH_traub.mod │ │ ├── INmodel.hoc │ │ ├── INmodel.ses │ │ ├── Ican.mod │ │ ├── Parameters1.hoc │ │ ├── Parameters2.hoc │ │ ├── fixnseg.hoc │ │ ├── iahp.mod │ │ ├── iar.mod │ │ ├── ical.mod │ │ ├── it2.mod │ │ ├── mosinit.hoc │ │ ├── readme.html │ │ ├── screenshot1.jpg │ │ ├── screenshot2.jpg │ │ ├── screenshot3.jpg │ │ ├── screenshot4.jpg │ │ └── x86_64 │ │ │ ├── .libs │ │ │ ├── Cad.o │ │ │ ├── HH_traub.o │ │ │ ├── Ican.o │ │ │ ├── iahp.o │ │ │ ├── iar.o │ │ │ ├── ical.o │ │ │ ├── it2.o │ │ │ ├── libnrnmech.la │ │ │ ├── libnrnmech.lai │ │ │ ├── libnrnmech.so │ │ │ ├── libnrnmech.so.0 │ │ │ ├── libnrnmech.so.0.0.0 │ │ │ └── mod_func.o │ │ │ ├── Cad.c │ │ │ ├── Cad.lo │ │ │ ├── Cad.mod │ │ │ ├── HH_traub.c │ │ │ ├── HH_traub.lo │ │ │ ├── HH_traub.mod │ │ │ ├── Ican.c │ │ │ ├── Ican.lo │ │ │ ├── Ican.mod │ │ │ ├── iahp.c │ │ │ ├── iahp.lo │ │ │ ├── iahp.mod │ │ │ ├── iar.c │ │ │ ├── iar.lo │ │ │ ├── iar.mod │ │ │ ├── ical.c │ │ │ ├── ical.lo │ │ │ ├── ical.mod │ │ │ ├── it2.c │ │ │ ├── it2.lo │ │ │ ├── it2.mod │ │ │ ├── libnrnmech.la │ │ │ ├── mod_func.c │ │ │ ├── mod_func.lo │ │ │ └── special │ ├── modelDB_link.txt │ └── uq_interneuron.py ├── izhikevich │ ├── izhikevich.pdf │ ├── izhikevich_class.py │ ├── izhikevich_function.py │ ├── uq_izhikevich_class.py │ └── uq_izhikevich_function.py ├── mc_vc_pc │ ├── analyse.py │ ├── generate.py │ ├── plot.py │ └── valderrama.py ├── paper_figures │ ├── figures.ipynb │ └── paper_requirements.txt └── valderrama │ ├── uq_valderrama.py │ ├── valderrama.pdf │ └── valderrama.py ├── logo ├── HodgkinHuxley.py ├── hh.pdf ├── hh_illustration.py ├── uncertainpy.pdf ├── uncertainpy.png ├── uncertainpy.svg ├── uncertainpy_small.pdf ├── uncertainpy_small.png └── uncertainpy_small.svg ├── run_docker.sh ├── run_tests.sh ├── setup.py ├── src └── uncertainpy │ ├── __init__.py │ ├── _version.py │ ├── core │ ├── __init__.py │ ├── base.py │ ├── parallel.py │ ├── run_model.py │ └── uncertainty_calculations.py │ ├── data.py │ ├── distribution.py │ ├── features │ ├── __init__.py │ ├── efel_features.py │ ├── features.py │ ├── general_network_features.py │ ├── general_spiking_features.py │ ├── network_features.py │ ├── spikes.py │ └── spiking_features.py │ ├── models │ ├── __init__.py │ ├── model.py │ ├── nest_model.py │ └── neuron_model.py │ ├── parameters.py │ ├── plotting │ ├── __init__.py │ ├── plot_uncertainty.py │ └── prettyplot │ │ ├── .gitignore │ │ ├── .gitrepo │ │ ├── README.md │ │ ├── __init__.py │ │ ├── prettyplot.py │ │ ├── setup.py │ │ └── test_prettyplot.py │ ├── uncertainty.py │ └── utils │ ├── __init__.py │ ├── logger.py │ └── utility.py ├── test.py └── tests ├── __init__.py ├── data ├── TestingModel0d.h5 ├── TestingModel1d.h5 ├── TestingModel1d_MC.h5 ├── TestingModel1d_MC_a.h5 ├── TestingModel1d_MC_b.h5 ├── TestingModel1d_Rosenblatt.h5 ├── TestingModel1d_Rosenblatt_spectral.h5 ├── TestingModel1d_a.h5 ├── TestingModel1d_b.h5 ├── TestingModel1d_spectral.h5 ├── TestingModel2d.h5 ├── U_test.npy ├── UncertaintyCalculations_a.h5 ├── UncertaintyCalculations_b.h5 ├── V_noise.npy ├── V_spike.npy ├── example_hoc.hoc ├── example_hoc_control.hoc ├── example_hoc_control_parameters.hoc ├── model_function.h5 ├── t_noise.npy ├── t_spike.npy ├── t_test.npy ├── test_save_empty ├── test_save_mock ├── test_save_mock_irregular └── test_save_mock_missing ├── generate_docker_images.py ├── generate_test_data.py ├── generate_test_plots.py ├── models ├── __init__.py ├── brunel_network_function.py ├── coffee_cup_class.py ├── hodgkin_huxley.py ├── interneuron_modelDB │ ├── 091008A2.hoc │ ├── Cad.mod │ ├── HH_traub.mod │ ├── INmodel.hoc │ ├── INmodel.ses │ ├── Ican.mod │ ├── Parameters1.hoc │ ├── Parameters2.hoc │ ├── fixnseg.hoc │ ├── iahp.mod │ ├── iar.mod │ ├── ical.mod │ ├── it2.mod │ ├── mosinit.hoc │ ├── readme.html │ ├── screenshot1.jpg │ ├── screenshot2.jpg │ ├── screenshot3.jpg │ ├── screenshot4.jpg │ └── x86_64 │ │ ├── .libs │ │ ├── Cad.o │ │ ├── HH_traub.o │ │ ├── Ican.o │ │ ├── iahp.o │ │ ├── iar.o │ │ ├── ical.o │ │ ├── it2.o │ │ ├── libnrnmech.la │ │ ├── libnrnmech.lai │ │ ├── libnrnmech.so │ │ ├── libnrnmech.so.0 │ │ ├── libnrnmech.so.0.0.0 │ │ └── mod_func.o │ │ ├── Cad.c │ │ ├── Cad.lo │ │ ├── Cad.mod │ │ ├── HH_traub.c │ │ ├── HH_traub.lo │ │ ├── HH_traub.mod │ │ ├── Ican.c │ │ ├── Ican.lo │ │ ├── Ican.mod │ │ ├── iahp.c │ │ ├── iahp.lo │ │ ├── iahp.mod │ │ ├── iar.c │ │ ├── iar.lo │ │ ├── iar.mod │ │ ├── ical.c │ │ ├── ical.lo │ │ ├── ical.mod │ │ ├── it2.c │ │ ├── it2.lo │ │ ├── it2.mod │ │ ├── libnrnmech.la │ │ ├── mod_func.c │ │ ├── mod_func.lo │ │ └── special └── izhikevich_function.py ├── test_base.py ├── test_data.py ├── test_distribution.py ├── test_examples.py ├── test_features.py ├── test_logger.py ├── test_models.py ├── test_parallel.py ├── test_parameters.py ├── test_plot_uncertainty.py ├── test_run_model.py ├── test_spike.py ├── test_spikes.py ├── test_uncertainty.py ├── test_uncertainty_calculations.py ├── test_utility.py └── testing_classes ├── __init__.py ├── load_python_test.py ├── testcase_plot.py ├── testing_features.py ├── testing_models.py └── testing_uncertainty.py /.coveragerc: -------------------------------------------------------------------------------- 1 | # .coveragerc to control coverage.py 2 | [run] 3 | source = src/uncertainpy 4 | omit = tests/* 5 | src/uncertainpy/plotting/prettyplot/* 6 | 7 | [report] 8 | # Regexes for lines to exclude from consideration 9 | exclude_lines = 10 | # Have to re-enable the standard pragma 11 | pragma: no cover 12 | 13 | # Don't complain if tests don't hit defensive assertion code: 14 | raise AssertionError 15 | raise NotImplementedError 16 | -------------------------------------------------------------------------------- /.docker/Dockerfile_python: -------------------------------------------------------------------------------- 1 | #FROM python:3.7 2 | FROM ubuntu:latest 3 | 4 | ENV DEBIAN_FRONTEND=noninteractive 5 | 6 | ENV LC_ALL=C.UTF-8 7 | ENV LANG=C.UTF-8 8 | 9 | # Python prerequisites 10 | RUN apt-get update --fix-missing 11 | RUN apt-get -y install python3-pip software-properties-common > /dev/null 12 | 13 | 14 | ENV HOME=/home/docker 15 | RUN mkdir $HOME 16 | 17 | RUN pip3 install neuron 18 | 19 | RUN add-apt-repository ppa:nest-simulator/nest 20 | RUN apt-get update 21 | RUN apt-get install -y nest 22 | 23 | WORKDIR /home/docker/ 24 | 25 | # Install uncertainpy dependencies 26 | RUN apt-get -y install xvfb hdf5-tools 27 | 28 | RUN pip3 install coverage setuptools xvfbwrapper 29 | 30 | # Make sure matplotlib uses agg 31 | RUN mkdir .config/ 32 | RUN mkdir .config/matplotlib 33 | RUN echo "backend : Agg" >> .config/matplotlib/matplotlibrc 34 | 35 | 36 | RUN echo 'alias python="/usr/bin/python3"' >> /root/.bash_aliases && \ 37 | echo 'alias pip="/usr/bin/pip3"' >> /root/.bash_aliases -------------------------------------------------------------------------------- /.docker/Dockerfile_uncertainpy: -------------------------------------------------------------------------------- 1 | FROM python 2 | 3 | COPY . uncertainpy/ 4 | RUN cd uncertainpy; python3 setup.py develop --all_extras -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .docker 3 | .vscode 4 | .eggs 5 | .X11-unix 6 | dist 7 | *.h5 8 | examples/mc_vc_pc/data -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Folder for div tests 2 | random_tests/ 3 | 4 | # Log files 5 | .log 6 | 7 | # Deprecated code 8 | deprecated 9 | 10 | # fish 11 | .fish 12 | 13 | 14 | # Data files 15 | *.dat 16 | *.h5 17 | *.png 18 | *.pdf 19 | x86_64/ 20 | *.mod 21 | *.txt 22 | *.hoc 23 | *.eps 24 | 25 | 26 | # Byte-compiled / optimized / DLL files 27 | __pycache__/ 28 | *.py[cod] 29 | *$py.class 30 | *.pyc 31 | 32 | # C extensions 33 | *.so 34 | 35 | # Distribution / packaging 36 | .Python 37 | build/ 38 | develop-eggs/ 39 | dist/ 40 | downloads/ 41 | eggs/ 42 | .eggs/ 43 | lib/ 44 | lib64/ 45 | parts/ 46 | sdist/ 47 | var/ 48 | wheels/ 49 | *.egg-info/ 50 | .installed.cfg 51 | *.egg 52 | MANIFEST 53 | 54 | # PyInstaller 55 | # Usually these files are written by a python script from a template 56 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 57 | *.manifest 58 | *.spec 59 | 60 | # Installer logs 61 | pip-log.txt 62 | pip-delete-this-directory.txt 63 | 64 | # Unit test / coverage reports 65 | htmlcov/ 66 | .tox/ 67 | .coverage 68 | .coverage.* 69 | .cache 70 | nosetests.xml 71 | coverage.xml 72 | *.cover 73 | .hypothesis/ 74 | 75 | # Translations 76 | *.mo 77 | *.pot 78 | 79 | # Django stuff: 80 | *.log 81 | .static_storage/ 82 | .media/ 83 | local_settings.py 84 | 85 | # Flask stuff: 86 | instance/ 87 | .webassets-cache 88 | 89 | # Scrapy stuff: 90 | .scrapy 91 | 92 | # Sphinx documentation 93 | docs/_build/ 94 | 95 | # PyBuilder 96 | target/ 97 | 98 | # Jupyter Notebook 99 | .ipynb_checkpoints 100 | 101 | # pyenv 102 | .python-version 103 | 104 | # celery beat schedule file 105 | celerybeat-schedule 106 | 107 | # SageMath parsed files 108 | *.sage.py 109 | 110 | # Environments 111 | .env 112 | .venv 113 | env/ 114 | venv/ 115 | ENV/ 116 | env.bak/ 117 | venv.bak/ 118 | 119 | # Spyder project settings 120 | .spyderproject 121 | .spyproject 122 | 123 | # Rope project settings 124 | .ropeproject 125 | 126 | # mkdocs documentation 127 | /site 128 | 129 | # mypy 130 | .mypy_cache/ 131 | 132 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: docker 3 | language: python 4 | python: 5 | - "3.6" # Placeholder only 6 | install: 7 | - pip install codecov 8 | before_script: 9 | - docker build -t python -f .docker/Dockerfile_python . 10 | - docker build -t uncertainpy -f .docker/Dockerfile_uncertainpy . 11 | - ci_env=`bash <(curl -s https://codecov.io/env)` 12 | script: 13 | - docker run $ci_env -t uncertainpy uncertainpy/run_tests.sh 14 | # before_deploy: 15 | # - sudo rm -rf src/uncertainpy.egg-info 16 | deploy: 17 | provider: pypi 18 | user: simetenn 19 | skip_cleanup: true 20 | password: 21 | secure: Fjr/QrjgahFHGVmttpRDMwiGnHUAxGdNLzcR27JGn4ayHAbN3KXakoVY2iJ3mxIt/TE4GEL/s6709xziJGlEdCzoiXChOevqX/YGlZU/gmg1rDl59MTq7tjiVK3SPiBYC++PmkAlZUs7RxeDRIyyccHaKntlRp7/r57eEffdpw5QQmNHzrm4tcXsI4AlBznhn3bZ4ooQXHsmO6cF9q0l+nUteXn0K1pjPJhw/HRGiTAXcHk97oXVg/L9BheFyWybXwcEDairw2DaFd7YeNJDK1TwXiyNWm89Q4b9z/e2zznxW0tkOSX4cTXha+7aQD3JVvUa3AWLyIEx/6iWz0fw1L4Me9navsMFq5ApTVabP6XbVW8vSPmteBO4JdiDLgWAjjoG1a5iC3dR5ltJEH0VW1N7ENaGTt4CW9MvxZqAjnEwcDPdVpk1a5kw/nBeU3lV8rMv4uGIOgEOiTGSQeu/ISEBSNUuZclHBMOj6HrWx5NJGsvPH8Ktn1XyVACzUt3tDaoN1bSRZbwl1ku4Hxsof9Yoo2WCP2txzzoKgdgGUBw6Z9ZzWa8SrMr5OVsLpsoI3gMISgyYDb8lDRqsiu7v/u1EX6L/Tflea3E80/q8svgqgCei37SxdIIcVn30S1VsJ2sIJu6iKez+GLqTAMTyESNWWFdWTGhZGfLmsn0kIeE= 22 | on: 23 | python: 3.6 24 | tags: true 25 | distributions: sdist bdist_wheel 26 | repo: simetenn/uncertainpy 27 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE.txt -------------------------------------------------------------------------------- /binder/apt.txt: -------------------------------------------------------------------------------- 1 | xvfb -------------------------------------------------------------------------------- /binder/postBuild: -------------------------------------------------------------------------------- 1 | python setup.py install -------------------------------------------------------------------------------- /binder/requirements.txt: -------------------------------------------------------------------------------- 1 | chaospy 2 | tqdm 3 | h5py 4 | multiprocess 5 | numpy 6 | scipy 7 | seaborn 8 | matplotlib 9 | xvfbwrapper 10 | six -------------------------------------------------------------------------------- /codecov.yaml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: nearest 4 | 5 | ignore: 6 | - "src/uncertainpy/plotting/prettyplot" 7 | 8 | codecov: 9 | branch: master 10 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = Uncertainpy 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/images/coffee_cup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/docs/images/coffee_cup.png -------------------------------------------------------------------------------- /docs/images/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/docs/images/diagram.png -------------------------------------------------------------------------------- /docs/source/core.rst: -------------------------------------------------------------------------------- 1 | .. _core: 2 | 3 | Core 4 | ==== 5 | 6 | This module contains the classes that are responsible for running the model and 7 | calculate features of the model, both in parallel (:ref:`RunModel ` and 8 | :ref:`Parallel `), as well as the class for performing the 9 | uncertainty calculations (:ref:`UncertaintyCalculations `). 10 | It also contains the base classes that are responsible for setting and updating 11 | parameters, models and features across classes (:ref:`Base and ParameterBase `). 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | 16 | core/uncertainty_calculations 17 | core/base 18 | core/parallel 19 | core/run_model -------------------------------------------------------------------------------- /docs/source/core/base.rst: -------------------------------------------------------------------------------- 1 | .. _Base: 2 | 3 | Base and ParameterBase 4 | ====================== 5 | 6 | These classes enable setting and updating the model, features and parameters 7 | (not in all classes) across classes from the top of the hierarchy 8 | (:ref:`UncertaintyQuantification `) and down 9 | (:ref:`Parallel `). 10 | To add updating of the current class, as well as the classes further down the 11 | setters can be overridden. 12 | One example of this from :ref:`RunModel `):: 13 | 14 | @ParameterBase.model.setter 15 | def model(self, new_model): 16 | ParameterBase.model.fset(self, new_model) 17 | 18 | self._parallel.model = self.model 19 | 20 | 21 | 22 | 23 | 24 | API Reference 25 | ------------- 26 | 27 | Base 28 | .... 29 | 30 | .. autoclass:: uncertainpy.core.Base 31 | :members: 32 | :inherited-members: 33 | 34 | ParameterBase 35 | ............. 36 | 37 | .. autoclass:: uncertainpy.core.ParameterBase 38 | :members: 39 | :inherited-members: 40 | -------------------------------------------------------------------------------- /docs/source/core/parallel.rst: -------------------------------------------------------------------------------- 1 | .. _parallel: 2 | 3 | Parallel 4 | ======== 5 | 6 | :py:class:`~uncertainpy.core.Parallel` calculates the model and features of the 7 | model for one specific set of model parameters. 8 | ``Parallel`` is the class that is run in parallel. 9 | 10 | API Reference 11 | ------------- 12 | 13 | .. autoclass:: uncertainpy.core.Parallel 14 | :members: 15 | :inherited-members: -------------------------------------------------------------------------------- /docs/source/core/run_model.rst: -------------------------------------------------------------------------------- 1 | .. _run_model: 2 | 3 | RunModel 4 | ======== 5 | 6 | :py:class:`~uncertainpy.core.RunModel` is responsible for running the model in 7 | parallel for all selected sets of parameters. It runs :ref:`Parallel ` 8 | in Parallel. ``RunModel`` organizes the results in a :ref:`Data ` object. 9 | 10 | 11 | API Reference 12 | ------------- 13 | 14 | .. autoclass:: uncertainpy.core.RunModel 15 | :members: 16 | :inherited-members: 17 | -------------------------------------------------------------------------------- /docs/source/data.rst: -------------------------------------------------------------------------------- 1 | .. _data: 2 | 3 | Data 4 | ==== 5 | 6 | 7 | Uncertainpy stores all results from the uncertainty quantification and 8 | sensitivity analysis in ``UncertaintyQuantification.data``, 9 | as a ``Data`` object. 10 | The ``Data`` class works similarly to a Python dictionary. 11 | The name of the model or feature is the key, 12 | while the values are ``DataFeature`` objects that stores each 13 | statistical metric in in the table below as attributes. 14 | Results can be saved and loaded through 15 | ``Data.save`` and ``Data.load``. 16 | 17 | 18 | ================================================ ======================== ======================== 19 | Calculated statistical metric Symbol Variable 20 | ================================================ ======================== ======================== 21 | Model and feature evaluations :math:`U` ``evaluations`` 22 | Model and feature times :math:`t` ``time`` 23 | Mean :math:`\mathbb{E}` ``mean`` 24 | Variance :math:`\mathbb{V}` ``variance`` 25 | 5th percentile :math:`P_{5}` ``percentile_5`` 26 | 95th percentile :math:`P_{95}` ``percentile_95`` 27 | First order Sobol indices :math:`S` ``sobol_first`` 28 | Total order Sobol indices :math:`S_T` ``sobol_total`` 29 | Average of the first order Sobol indices :math:`\widehat{S}` ``sobol_first_average`` 30 | Average of the total order Sobol indices :math:`\widehat{S}_{T}` ``sobol_total_average`` 31 | ================================================ ======================== ======================== 32 | 33 | 34 | An example: if we have performed uncertainty quantification of a spiking 35 | neuron model with the number of spikes as one of the features, 36 | we get load the data file and get the variance of the number of spikes by typing:: 37 | 38 | data = un.Data() 39 | data.load("filename") 40 | variance = data["nr_spikes"].variance 41 | 42 | 43 | API reference 44 | ------------- 45 | 46 | .. toctree:: 47 | :maxdepth: 1 48 | 49 | data/data 50 | data/data_feature -------------------------------------------------------------------------------- /docs/source/data/data.rst: -------------------------------------------------------------------------------- 1 | Data 2 | ==== 3 | 4 | .. autoclass:: uncertainpy.Data 5 | :members: 6 | :inherited-members: 7 | :special-members: __delitem__, __getitem__, __iter__, __len__, __setitem__, __str__ -------------------------------------------------------------------------------- /docs/source/data/data_feature.rst: -------------------------------------------------------------------------------- 1 | DataFeature 2 | =========== 3 | 4 | .. autoclass:: uncertainpy.DataFeature 5 | :members: 6 | :inherited-members: 7 | :special-members: __delitem__, __getitem__, __iter__, __len__, __setitem__ -------------------------------------------------------------------------------- /docs/source/distribution.rst: -------------------------------------------------------------------------------- 1 | .. _distributions: 2 | 3 | Distribution 4 | ============ 5 | 6 | Functions (that work as closures) used to set the distribution of a 7 | parameter to an `interval` around their original value through for example 8 | :py:meth:`~uncertainpy.Parameters.set_all_distributions`. 9 | An example:: 10 | 11 | # Define a parameter list 12 | parameter_list = [["parameter_1", -67], 13 | ["parameter_2", 22]] 14 | 15 | # Create the parameters 16 | parameters = un.Parameters(parameter_list) 17 | 18 | # Set all parameters to have a uniform distribution 19 | # within a 5% interval around their fixed value 20 | parameters.set_all_distributions(un.uniform(0.05)) 21 | 22 | 23 | 24 | 25 | 26 | API Reference 27 | ------------- 28 | 29 | .. autofunction:: uncertainpy.uniform 30 | 31 | .. autofunction:: uncertainpy.normal 32 | -------------------------------------------------------------------------------- /docs/source/examples.rst: -------------------------------------------------------------------------------- 1 | Examples 2 | ======== 3 | 4 | This is a collection of examples that shows the use of Uncertainpy for a few 5 | different case studies. 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | examples/coffee_cup 11 | examples/coffee_cup_dependent 12 | examples/hodgkin_huxley 13 | examples/interneuron 14 | examples/brunel 15 | examples/bahl -------------------------------------------------------------------------------- /docs/source/faq.rst: -------------------------------------------------------------------------------- 1 | .. _faq: 2 | 3 | Frequently asked questions 4 | ========================== 5 | 6 | Here is a collection of frequently asked questions. 7 | 8 | 9 | Is Uncertainpy usable with multiple model outputs? 10 | -------------------------------------------------- 11 | 12 | Yes, however it does unfortunately not have direct support for this. 13 | Uncertainpy by default only performs an uncertainty quantification of the first 14 | model output returned. 15 | But you can return the additional model outputs in the 16 | info dictionary, 17 | and then define new features that extract each model output from the info 18 | dictionary, see the code example in :ref:`Multiple model outputs `. 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/source/features/general_network_features.rst: -------------------------------------------------------------------------------- 1 | .. _general_network: 2 | 3 | GeneralNetworkFeatures 4 | ====================== 5 | 6 | :py:class:`~uncertainpy.features.GeneralNetworkFeatures` implements the 7 | preprocessing of spiketrains, and create `NEO`_ spiketrains, 8 | but does not implement any features in itself. 9 | This set of features require that the model returns the simulation end time and 10 | a list of spiketrains, which are the times a given neuron spikes. 11 | The :py:meth:`~uncertainpy.features.GeneralNetworkFeatures.preprocess` method 12 | changes the input given to the feature functions, 13 | and as such each network feature function has the following input arguments: 14 | 15 | 1. End time of the simulation (``end_time``). 16 | 2. A list of `NEO`_ spiketrains (``spiketrains``). 17 | 18 | .. _NEO: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3930095/ 19 | 20 | API Reference 21 | ------------- 22 | 23 | .. autoclass:: uncertainpy.features.GeneralNetworkFeatures 24 | :members: 25 | :inherited-members: -------------------------------------------------------------------------------- /docs/source/features/general_spiking_features.rst: -------------------------------------------------------------------------------- 1 | .. _general_spiking: 2 | 3 | GeneralSpikingFeatures 4 | ====================== 5 | 6 | :py:class:`~uncertainpy.features.GeneralSpikingFeatures` implements the 7 | preprocessing of voltage traces, and locate spikes in the voltage traces, 8 | but does not implement any features in itself. 9 | The :py:meth:`~uncertainpy.features.GeneralSpikingFeatures.preprocess` method 10 | changes the input given to the feature functions, 11 | and as such each spiking feature function has the following input arguments: 12 | 13 | 1. The ``time`` array returned by the model simulation. 14 | 2. An :ref:`Spikes ` object (``spikes``) which contain the spikes found in the model output. 15 | 3. An ``info`` dictionary with ``info["stimulus_start"]`` and ``info["stimulus_end"]`` set. 16 | 17 | 18 | API Reference 19 | ------------- 20 | 21 | .. autoclass:: uncertainpy.features.GeneralSpikingFeatures 22 | :members: 23 | :inherited-members: -------------------------------------------------------------------------------- /docs/source/features/spikes.rst: -------------------------------------------------------------------------------- 1 | .. _spikes: 2 | 3 | Spikes 4 | ====== 5 | 6 | :py:class:`~uncertainpy.features.Spikes` is responsible for locating spikes in a voltage trace, and is 7 | a container for all spikes found. 8 | Each spike is stored in a :py:class:`~uncertainpy.features.Spike` object. 9 | ``Spikes`` is used in :ref:`SpikingFeatures ` 10 | 11 | 12 | API Reference 13 | ------------- 14 | 15 | Spikes 16 | ...... 17 | 18 | .. autoclass:: uncertainpy.features.Spikes 19 | :members: 20 | :inherited-members: 21 | 22 | Spike 23 | ..... 24 | 25 | .. autoclass:: uncertainpy.features.Spike 26 | :members: 27 | :inherited-members: 28 | 29 | 30 | -------------------------------------------------------------------------------- /docs/source/logging.rst: -------------------------------------------------------------------------------- 1 | .. _logging: 2 | 3 | Logging 4 | ======= 5 | 6 | Uncertainpy uses the logging module to log to both file and to screen. 7 | All loggers are named 8 | ``class_instance.__module__ + "." + class_instance.__class__.__name__``. 9 | An example, the logger in a ``Data```object is named 10 | ``uncertainpy.data.Data``. 11 | If the the module name does not start with "uncertainpy.", "uncertainpy." 12 | as added as a prefix. 13 | 14 | A file handler is only added to the logging by ``UncertaintyQuantification``. 15 | If level is set to None, no logging in Uncertainpy is set up and the logging can 16 | be customized as necessary by using the logging module. 17 | This should only be done if you know what you are doing. Be warned that 18 | logging is performed in parallel. If the ``MultiprocessLoggingHandler()`` is not 19 | used when trying to write to a single log file, Uncertainpy will hang. This 20 | happens because several processes try to log to the same file. 21 | 22 | Logging can easily be added to custom models and features by:: 23 | 24 | # Import the functions and libraries needed 25 | from uncertainpy.utils import create_logger 26 | import logging 27 | 28 | # Set up a logger. This adds a screen handlers to the "uncertainpy" logger 29 | # if it does not already exist 30 | # All log messages with level "info" or higher will be logged. 31 | setup_logger("uncertainpy.logger_name", level="info") 32 | 33 | # Get the logger recently created 34 | logger = logging.getLogger("uncertainpy.logger_name") 35 | 36 | # Log a message with the level "info". 37 | logger.info("info logging message here") 38 | 39 | Note that if you want to use the logger setup in Uncertainpy, the name of your 40 | loggers should start with ``uncertainpy.``. 41 | 42 | 43 | API Reference 44 | ------------- 45 | 46 | .. automodule:: uncertainpy.utils.logger 47 | :members: -------------------------------------------------------------------------------- /docs/source/models.rst: -------------------------------------------------------------------------------- 1 | .. _models: 2 | 3 | Models 4 | ====== 5 | 6 | In order to perform the uncertainty quantification and sensitivity 7 | analysis of a model, 8 | Uncertainpy needs to set the parameters of the model, 9 | run the model using those parameters, 10 | and receive the model output. 11 | The main class for models is :ref:`Model `, which is used to create 12 | custom models. 13 | Uncertainpy has built-in support for NEURON and NEST models, 14 | found in the :ref:`NeuronModel ` and :ref:`NestModel ` classes 15 | respectively. 16 | Uncertainpy also has support for multiple model outputs through the use of 17 | additional features. 18 | It should be noted that while Uncertainpy is tailored towards neuroscience, 19 | it is not restricted to only neuroscience models. 20 | Uncertainpy can be used on any model that meets the criteria in 21 | this section. 22 | 23 | 24 | 25 | .. toctree:: 26 | :maxdepth: 1 27 | 28 | models/main_model 29 | models/neuron_model 30 | models/nest_model 31 | models/multiple_outputs 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/source/models/nest_model.rst: -------------------------------------------------------------------------------- 1 | .. _nest_model: 2 | 3 | NestModel 4 | ========= 5 | 6 | `NEST`_ is a simulator for large networks of spiking neurons. 7 | NEST models are supported through the :py:class:`~uncertainpy.model.NestModel` class, 8 | another subclass of :ref:`Model `:: 9 | 10 | model = un.NestModel(run=nest_model_function) 11 | 12 | ``NestModel`` requires the model function to be specified through 13 | the ``run`` argument, unlike ``NeuronModel``. 14 | The NEST model function has the same requirements as a regular model function, 15 | except it is restricted to return only two objects: 16 | the final simulation time (denoted ``simulation_end``), 17 | and a list of spike times for each neuron in the network, 18 | which we refer to as spiketrains (denoted ``spiketrains``). 19 | 20 | .. _NEST: http://www.nest-simulator.org/ 21 | 22 | A spike train returned by a NEST model is a set of irregularly spaced time 23 | points where a neuron fired a spike. 24 | NEST models therefore require postprocessing to make the model output regular. 25 | Such a postprocessing is provided by the implemented 26 | :py:meth:`~uncertainpy.models.NestModel.postprocess` method, which converts a spiketrain to a 27 | list of zeros (no spike) and ones (a spike) for each time step in the simulation. 28 | For example, if a NEST simulation returns the spiketrain ``[0, 2, 3.5]``, 29 | it means the neuron fired three spikes occurring at 30 | :math:`t= 0, 2, \text{and } 3.5` ms. 31 | If the simulation have a time resolution of :math:`0.5` ms and ends 32 | after :math:`4` ms, 33 | ``NestModel.postprocess`` returns the 34 | postprocessed spiketrain ``[1, 0, 0, 0, 1, 0, 0, 1, 0]``, 35 | and the postprocessed time array ``[0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4]``. 36 | The final uncertainty quantification of a NEST network therefore predicts the 37 | probability for a spike to occur at any specific time point in the simulation. 38 | An example on how to use ``NestModel`` is found in the 39 | :ref:`Brunel exampel `. 40 | 41 | 42 | API Reference 43 | ------------- 44 | 45 | .. autoclass:: uncertainpy.models.NestModel 46 | :members: 47 | :inherited-members: 48 | :undoc-members: 49 | -------------------------------------------------------------------------------- /docs/source/models/neuron_model.rst: -------------------------------------------------------------------------------- 1 | .. _neuron_model: 2 | 3 | NeuronModel 4 | =========== 5 | 6 | `NEURON`_ is a widely used simulator for multi-compartmental neural models. 7 | Uncertainpy has support for NEURON models through the 8 | :py:class:`~uncertainpy.model.NeuronModel` class, a subclass of :ref:`Model `. 9 | Among others, ``NeuronModel`` takes the arguments:: 10 | 11 | model = un.NeuronModel(path="path/to/neuron_model", 12 | interpolate=True, 13 | stimulus_start=1000, # ms 14 | stimulus_end=1900) # ms 15 | 16 | ``path`` is the path to the folder where the NEURON model is saved 17 | (the location of the ``mosinit.hoc`` file). 18 | ``interpolate`` indicates whether the NEURON model uses adaptive time steps. 19 | ``stimulus_start`` and ``stimulus_end`` denotes the start and 20 | end time of any stimulus given to the neuron. 21 | ``NeuronModel`` loads the NEURON model from ``mosinit.hoc``, 22 | sets the parameters of the model, 23 | evaluates the model and returns the somatic membrane potential of the neuron. 24 | ``NeuronModel`` therefore does not require a model function. 25 | An example of a NEURON model analysed with Uncertainpy is found in the 26 | :ref:`interneuron example `. 27 | 28 | .. _NEURON: https://www.neuron.yale.edu/neuron/ 29 | 30 | If changes are needed to the standard ``NeuronModel``, 31 | such as measuring the voltage from other locations than the soma, 32 | or recalculate properties after the parameters have been set, 33 | the :ref:`Model ` class with an appropriate model function should be used 34 | instead. 35 | Alternatively, 36 | ``NeuronModel`` can be subclassed and 37 | the existing methods customized as required. 38 | An example of the later is shown in :ref:`/examples/bahl/ `. 39 | 40 | 41 | 42 | 43 | API Reference 44 | ------------- 45 | 46 | .. autoclass:: uncertainpy.models.NeuronModel 47 | :members: 48 | :inherited-members: 49 | :undoc-members: -------------------------------------------------------------------------------- /docs/source/parameters/parameter.rst: -------------------------------------------------------------------------------- 1 | .. _Parameter: 2 | 3 | Parameter 4 | ========= 5 | 6 | .. autoclass:: uncertainpy.Parameter 7 | :members: 8 | :special-members: __str__ 9 | 10 | -------------------------------------------------------------------------------- /docs/source/parameters/parameters.rst: -------------------------------------------------------------------------------- 1 | .. _Parameters class: 2 | 3 | Parameters 4 | ========== 5 | 6 | .. autoclass:: uncertainpy.Parameters 7 | :members: 8 | :inherited-members: 9 | :special-members: __delitem__, __getitem__, __iter__, __len__, __setitem__, __str__ -------------------------------------------------------------------------------- /docs/source/plotting.rst: -------------------------------------------------------------------------------- 1 | .. _plotting: 2 | 3 | Plotting 4 | ======== 5 | 6 | :py:class:`~uncertainpy.plotting.PlotUncertainty` creates plot of the data 7 | from the uncertainty quantification and sensitivity analysis. 8 | ``PlotUncertainpy`` plots the results for all zero and one dimensional statistical 9 | metrics, and some of the two dimensional statistical metrics 10 | It is intended as a quick way to get an overview of the data, and does not 11 | create publication ready plots. 12 | Custom plots of the data can easily be created by retrieving the results from 13 | the :ref:`Data ` class. 14 | 15 | API Reference 16 | ------------- 17 | 18 | .. autoclass:: uncertainpy.plotting.PlotUncertainty 19 | :members: 20 | :inherited-members: 21 | :undoc-members: -------------------------------------------------------------------------------- /docs/source/theory/problem.rst: -------------------------------------------------------------------------------- 1 | .. _problem: 2 | 3 | The problem definition 4 | ====================== 5 | 6 | Consider a model :math:`U` that depends on space :math:`\boldsymbol{x}` and time :math:`t`, 7 | has :math:`D` uncertain input parameters :math:`\boldsymbol{Q} = \left[Q_1, Q_2, \ldots, Q_D \right]`, 8 | and gives the output :math:`Y`: 9 | 10 | .. math:: 11 | 12 | Y = U(\boldsymbol{x}, t, \boldsymbol{Q}). 13 | 14 | The output :math:`Y` can be any value within the output space :math:`\Omega_Y` 15 | and has an unknown probability density function :math:`\rho_Y`. 16 | The goal of an uncertainty quantification is to describe the unknown :math:`\rho_Y` 17 | through statistical metrics. 18 | We are only interested in the input and output of the model, 19 | and we ignore all details on how the model works. 20 | The model :math:`U` is thus considered a black box, 21 | and may represent any model, for example a spiking neuron model that returns a 22 | voltage trace, 23 | or a network model that return a spike train. 24 | 25 | We assume the model includes uncertain parameters that can be described 26 | by a multivariate probability density function :math:`\rho_{\boldsymbol{Q}}`. 27 | Examples of parameters that can be uncertain in neuroscience are the 28 | conductance of a single ion channel, 29 | or the synaptic weight between two species of neurons in a network. 30 | If the uncertain parameters are independent, 31 | the multivariate probability density function :math:`\rho_{\boldsymbol{Q}}` can be given as 32 | separate univariate probability density functions :math:`\rho_{Q_i}`, 33 | one for each uncertain parameter :math:`Q_i`. 34 | The joint multivariate probability density function for the independent 35 | uncertain parameters is then: 36 | 37 | .. math:: 38 | 39 | \rho_{\boldsymbol{Q}} = \prod_{i=1}^D \rho_{Q_i}. 40 | 41 | In cases where the uncertain input parameters are dependent, 42 | the multivariate probability density function :math:`\rho_{\boldsymbol{Q}}` must be defined directly. 43 | We assume the probability density functions are known, and are not here 44 | concerned with how they are determined. 45 | They may be the product of a series of measurements, a parameter estimation, 46 | or educated guesses made by experts. -------------------------------------------------------------------------------- /docs/source/theory/uq.rst: -------------------------------------------------------------------------------- 1 | .. _uq: 2 | 3 | Uncertainty quantification 4 | ========================== 5 | 6 | The goal of an uncertainty quantification is to describe the unknown 7 | distribution of the model output :math:`\rho_Y` through statistical metrics. 8 | The two most common statistical metrics used in this context are the 9 | mean :math:`\mathbb{E}` (also called the expectation value) 10 | and the variance :math:`\mathbb{V}`. 11 | The mean is defined as: 12 | 13 | .. math:: 14 | 15 | \mathbb{E}[Y] = \int_{\Omega_Y} y\rho_Y(y)dy, 16 | 17 | and tells us the expected value of the model output :math:`Y`. 18 | The variance is defined as: 19 | 20 | .. math:: 21 | 22 | \mathbb{V}[Y] = \int_{\Omega_Y} {\left(y - \mathbb{E}[Y]\right)}^2\rho_Y(y)dy, 23 | 24 | and tells us how much the output varies around the mean. 25 | 26 | Another useful metric is the :math:`(100\cdot x)`-th percentile :math:`P_x` of :math:`Y`, 27 | which defines a value below which :math:`100 \cdot x` percent of the simulation 28 | outputs are located. 29 | For example, 5% of the simulations of a model will give an output lower than 30 | the :math:`5`-th percentile. 31 | The :math:`(100\cdot x)`-th percentile is defined as: 32 | 33 | .. math:: 34 | 35 | x = \int_{-\infty}^{P_x}\rho_Y(y)dy. 36 | 37 | 38 | We can combine two percentiles to create a prediction interval :math:`I_x`, 39 | which is a range of values such that a :math:`100\cdot x` percentage of the outputs 40 | :math:`Y` occur within this range: 41 | 42 | .. math:: 43 | 44 | I_x = \left[P_{(x/2)}, P_{(1-x/2)}\right]. \label{eq:prediction} 45 | 46 | The :math:`90\%` prediction interval gives us the interval within :math:`90\%` of the :math:`Y` outcomes occur, 47 | which also means that :math:`5\%` of the outcomes are above and :math:`5\%` below this interval. 48 | -------------------------------------------------------------------------------- /docs/source/utilities.rst: -------------------------------------------------------------------------------- 1 | .. _utilities: 2 | 3 | Utilities 4 | ========= 5 | 6 | Various utility functions. 7 | 8 | API Reference 9 | ------------- 10 | 11 | .. automodule:: uncertainpy.utils.utility 12 | :members: 13 | :inherited-members: 14 | -------------------------------------------------------------------------------- /examples/bahl/Bahl2012.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/bahl/Bahl2012.pdf -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/IKM.mod: -------------------------------------------------------------------------------- 1 | TITLE Cortical M current 2 | : 3 | : M-current, responsible for the adaptation of firing rate and the 4 | : afterhyperpolarization (AHP) of cortical pyramidal cells 5 | : 6 | : First-order model described by hodgkin-Hyxley like equations. 7 | : K+ current, activated by depolarization, noninactivating. 8 | : 9 | : Model taken from Yamada, W.M., Koch, C. and Adams, P.R. Multiple 10 | : channels and calcium dynamics. In: Methods in Neuronal Modeling, 11 | : edited by C. Koch and I. Segev, MIT press, 1989, p 97-134. 12 | : 13 | : See also: McCormick, D.A., Wang, Z. and Huguenard, J. Neurotransmitter 14 | : control of neocortical neuronal activity and excitability. 15 | : Cerebral Cortex 3: 387-398, 1993. 16 | : 17 | : Written by Alain Destexhe, Laval University, 1995 18 | : 19 | 20 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 21 | 22 | NEURON { 23 | SUFFIX km : renamend (Armin Jul 09) 24 | USEION k READ ek WRITE ik 25 | RANGE gkbar, m_inf, tau_m, gk, m, vshift 26 | GLOBAL taumax 27 | 28 | } 29 | 30 | UNITS { 31 | (mA) = (milliamp) 32 | (mV) = (millivolt) 33 | } 34 | 35 | 36 | PARAMETER { 37 | v (mV) 38 | vshift = 0 39 | celsius = 36 (degC) 40 | ek (mV) 41 | gbar = 0 (pS/um2) 42 | taumax = 1000 (ms) : peak value of tau 43 | } 44 | 45 | 46 | 47 | STATE { 48 | m 49 | } 50 | 51 | ASSIGNED { 52 | ik (mA/cm2) 53 | m_inf 54 | tau_m (ms) 55 | tau_peak (ms) 56 | tadj 57 | gk (mho/cm2) 58 | } 59 | 60 | BREAKPOINT { 61 | SOLVE states METHOD euler 62 | gk = gbar * m 63 | ik = (1e-4)*gk * (v - ek) 64 | } 65 | 66 | DERIVATIVE states { 67 | evaluate_fct(v-vshift) 68 | 69 | m' = (m_inf - m) / tau_m 70 | } 71 | 72 | UNITSOFF 73 | INITIAL { 74 | evaluate_fct(v-vshift) 75 | m = m_inf : changed from 0 to m_inf (Armin) 76 | : 77 | : The Q10 value is assumed to be 2.3 78 | : 79 | tadj = 2.3 ^ ((celsius-36)/10) 80 | tau_peak = taumax / tadj 81 | } 82 | 83 | PROCEDURE evaluate_fct(v(mV)) { 84 | 85 | m_inf = 1 / ( 1 + exptable(-(v+35)/10) ) 86 | tau_m = tau_peak / ( 3.3 * exptable((v+35)/20) + exptable(-(v+35)/20) ) 87 | } 88 | UNITSON 89 | 90 | 91 | FUNCTION exptable(x) { 92 | TABLE FROM -25 TO 25 WITH 10000 93 | 94 | if ((x > -25) && (x < 25)) { 95 | exptable = exp(x) 96 | } else { 97 | exptable = 0. 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/SlowCa.mod: -------------------------------------------------------------------------------- 1 | 2 | COMMENT 3 | 4 | changed from (AS Oct0899) 5 | ca.mod 6 | Uses fixed eca instead of GHK eqn 7 | 8 | HVA Ca current 9 | Based on Reuveni, Friedman, Amitai and Gutnick (1993) J. Neurosci. 13: 10 | 4609-4621. 11 | 12 | Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu 13 | modified by Armin Bahl to allow variable time step January 2012 14 | ENDCOMMENT 15 | 16 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 17 | 18 | NEURON { 19 | SUFFIX sca 20 | USEION ca READ eca WRITE ica 21 | RANGE m, h, gca, gbar 22 | RANGE minf, hinf, mtau, htau, inactF, actF 23 | GLOBAL q10, temp, tadj, vmin, vmax, vshift 24 | } 25 | 26 | PARAMETER { 27 | inactF = 3 28 | actF = 1 29 | gbar = 0 (pS/um2) : 0.12 mho/cm2 30 | vshift = 0 (mV) : voltage shift (affects all) 31 | 32 | cao = 2.5 (mM) : external ca concentration 33 | cai (mM) 34 | 35 | temp = 23 (degC) : original temp 36 | q10 = 2.3 : temperature sensitivity 37 | 38 | v (mV) 39 | dt (ms) 40 | celsius (degC) 41 | vmin = -120 (mV) 42 | vmax = 100 (mV) 43 | } 44 | 45 | 46 | UNITS { 47 | (mA) = (milliamp) 48 | (mV) = (millivolt) 49 | (pS) = (picosiemens) 50 | (um) = (micron) 51 | } 52 | 53 | ASSIGNED { 54 | ica (mA/cm2) 55 | gca (pS/um2) 56 | eca (mV) 57 | minf 58 | hinf 59 | mtau (ms) 60 | htau (ms) 61 | tadj 62 | } 63 | 64 | 65 | STATE { m h } 66 | 67 | INITIAL { 68 | rates(v-vshift) 69 | m = minf 70 | h = hinf 71 | } 72 | 73 | BREAKPOINT { 74 | SOLVE states METHOD cnexp 75 | gca = tadj*gbar*m*m*h 76 | ica = (1e-4) * gca * (v - eca) 77 | } 78 | 79 | DERIVATIVE states { 80 | rates(v-vshift) 81 | m' = (minf-m)/mtau 82 | h' = (hinf-h)/htau 83 | } 84 | 85 | PROCEDURE rates(vm) { 86 | LOCAL a, b 87 | tadj = q10^((celsius - temp)/10) 88 | 89 | a = 0.055*(-27 - vm)/(exp((-27-vm)/3.8) - 1)/actF 90 | b = 0.94*exp((-75-vm)/17)/actF 91 | 92 | mtau = 1/tadj/(a+b) 93 | minf = a/(a+b) 94 | 95 | :"h" inactivation 96 | 97 | a = 0.000457*exp((-13-vm)/50)/inactF 98 | b = 0.0065/(exp((-vm-15)/28) + 1)/inactF 99 | 100 | htau = 1/tadj/(a+b) 101 | hinf = a/(a+b) 102 | } 103 | 104 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/cad.mod: -------------------------------------------------------------------------------- 1 | 2 | :26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. 3 | : Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal 4 | 5 | 6 | 7 | 8 | TITLE decay of internal calcium concentration 9 | : 10 | : Internal calcium concentration due to calcium currents and pump. 11 | : Differential equations. 12 | : 13 | : Simple model of ATPase pump with 3 kinetic constants (Destexhe 92) 14 | : Cai + P <-> CaP -> Cao + P (k1,k2,k3) 15 | : A Michaelis-Menten approximation is assumed, which reduces the complexity 16 | : of the system to 2 parameters: 17 | : kt = * k3 -> TIME CONSTANT OF THE PUMP 18 | : kd = k2/k1 (dissociation constant) -> EQUILIBRIUM CALCIUM VALUE 19 | : The values of these parameters are chosen assuming a high affinity of 20 | : the pump to calcium and a low transport capacity (cfr. Blaustein, 21 | : TINS, 11: 438, 1988, and references therein). 22 | : 23 | : Units checked using "modlunit" -> factor 10000 needed in ca entry 24 | : 25 | : VERSION OF PUMP + DECAY (decay can be viewed as simplified buffering) 26 | : 27 | : All variables are range variables 28 | : 29 | : 30 | : This mechanism was published in: Destexhe, A. Babloyantz, A. and 31 | : Sejnowski, TJ. Ionic mechanisms for intrinsic slow oscillations in 32 | : thalamic relay neurons. Biophys. J. 65: 1538-1552, 1993) 33 | : 34 | : Written by Alain Destexhe, Salk Institute, Nov 12, 1992 35 | : 36 | 37 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 38 | 39 | NEURON { 40 | SUFFIX cad 41 | USEION ca READ ica, cai WRITE cai 42 | RANGE ca 43 | GLOBAL depth,cainf,taur 44 | } 45 | 46 | UNITS { 47 | (molar) = (1/liter) : moles do not appear in units 48 | (mM) = (millimolar) 49 | (um) = (micron) 50 | (mA) = (milliamp) 51 | (msM) = (ms mM) 52 | FARADAY = (faraday) (coulomb) 53 | } 54 | 55 | 56 | PARAMETER { 57 | depth = .1 (um) : depth of shell 58 | taur = 200 (ms) : rate of calcium removal 59 | cainf = 100e-6(mM) 60 | cai (mM) 61 | } 62 | 63 | STATE { 64 | ca (mM) <1e-5> 65 | } 66 | 67 | INITIAL { 68 | ca = cainf 69 | cai = ca 70 | } 71 | 72 | ASSIGNED { 73 | ica (mA/cm2) 74 | drive_channel (mM/ms) 75 | } 76 | 77 | BREAKPOINT { 78 | SOLVE state METHOD euler 79 | } 80 | 81 | DERIVATIVE state { 82 | 83 | drive_channel = - (10000) * ica / (2 * FARADAY * depth) 84 | if (drive_channel <= 0.) { drive_channel = 0. } : cannot pump inward 85 | 86 | ca' = drive_channel + (cainf-ca)/taur 87 | cai = ca 88 | } 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/h.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | Deterministic model of kinetics and voltage-dependence of Ih-currents 4 | in layer 5 pyramidal neuron, see Kole et al., 2006. Implemented by 5 | Stefan Hallermann. 6 | 7 | Added possibility to shift voltage activiation (vshift) and allowed access to gating variables, Armin Bahl 2009 8 | 9 | Predominantly HCN1 / HCN2 10 | 11 | ENDCOMMENT 12 | 13 | TITLE Ih-current 14 | 15 | UNITS { 16 | (mA) = (milliamp) 17 | (mV) = (millivolt) 18 | (mM) = (milli/liter) 19 | 20 | } 21 | 22 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 23 | 24 | PARAMETER { 25 | dt (ms) 26 | v (mV) 27 | ehd=-47 (mV) 28 | gbar=0 (pS/um2) 29 | gamma_ih :not used 30 | seed :not used 31 | vshift = 0 32 | } 33 | 34 | 35 | NEURON { 36 | SUFFIX ih 37 | NONSPECIFIC_CURRENT Iqq 38 | RANGE Iqq,gbar,vshift,ehd, qtau, qinf, gq 39 | } 40 | 41 | STATE { 42 | qq 43 | } 44 | 45 | ASSIGNED { 46 | Iqq (mA/cm2) 47 | qtau (ms) 48 | qinf 49 | gq (pS/um2) 50 | 51 | } 52 | 53 | INITIAL { 54 | qq=alpha(v-vshift)/(beta(v-vshift)+alpha(v-vshift)) 55 | 56 | qtau = 1./(alpha(v-vshift) + beta(v-vshift)) 57 | qinf = alpha(v)/(alpha(v-vshift) + beta(v-vshift)) 58 | } 59 | 60 | BREAKPOINT { 61 | SOLVE state METHOD cnexp 62 | 63 | qtau = 1./(alpha(v-vshift) + beta(v-vshift)) 64 | qinf = alpha(v-vshift)/(alpha(v-vshift) + beta(v-vshift)) 65 | 66 | gq = gbar*qq 67 | Iqq = (1e-4)*gq*(v-ehd) 68 | 69 | } 70 | 71 | FUNCTION alpha(v(mV)) { 72 | 73 | alpha = 0.001*6.43*(v+154.9)/(exp((v+154.9)/11.9)-1) 74 | : parameters are estimated by direct fitting of HH model to 75 | : activation time constants and voltage activation curve 76 | : recorded at 34C 77 | 78 | } 79 | 80 | FUNCTION beta(v(mV)) { 81 | beta = 0.001*193*exp(v/33.1) 82 | } 83 | 84 | DERIVATIVE state { : exact when v held constant; integrates over dt step 85 | qq' = (1-qq)*alpha(v-vshift) - qq*beta(v-vshift) 86 | } 87 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/kca.mod: -------------------------------------------------------------------------------- 1 | 2 | COMMENT 3 | 26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. 4 | Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal 5 | 6 | kca.mod 7 | 8 | Calcium-dependent potassium channel 9 | Based on 10 | Pennefather (1990) -- sympathetic ganglion cells 11 | taken from 12 | Reuveni et al (1993) -- neocortical cells 13 | 14 | Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu 15 | 16 | ENDCOMMENT 17 | 18 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 19 | 20 | NEURON { 21 | SUFFIX kca 22 | USEION k READ ek WRITE ik 23 | USEION ca READ cai 24 | RANGE n, gk, gbar 25 | RANGE ninf, ntau 26 | GLOBAL Ra, Rb, caix 27 | GLOBAL q10, temp, tadj, vmin, vmax 28 | } 29 | 30 | UNITS { 31 | (mA) = (milliamp) 32 | (mV) = (millivolt) 33 | (pS) = (picosiemens) 34 | (um) = (micron) 35 | } 36 | 37 | PARAMETER { 38 | gbar = 10 (pS/um2) : 0.03 mho/cm2 39 | v (mV) 40 | cai (mM) 41 | caix = 1 42 | 43 | Ra = 0.01 (/ms) : max act rate 44 | Rb = 0.02 (/ms) : max deact rate 45 | 46 | dt (ms) 47 | celsius (degC) 48 | temp = 23 (degC) : original temp 49 | q10 = 2.3 : temperature sensitivity 50 | 51 | vmin = -120 (mV) 52 | vmax = 100 (mV) 53 | } 54 | 55 | 56 | ASSIGNED { 57 | a (/ms) 58 | b (/ms) 59 | ik (mA/cm2) 60 | gk (pS/um2) 61 | ek (mV) 62 | ninf 63 | ntau (ms) 64 | tadj 65 | } 66 | 67 | 68 | STATE { n } 69 | 70 | INITIAL { 71 | rates(cai) 72 | n = ninf 73 | } 74 | 75 | BREAKPOINT { 76 | SOLVE states METHOD cnexp 77 | gk = tadj*gbar*n 78 | ik = (1e-4) * gk * (v - ek) 79 | } 80 | 81 | LOCAL nexp 82 | 83 | DERIVATIVE states { :Computes state variable n 84 | rates(cai) : at the current v and dt. 85 | n' = (ninf-n)/ntau 86 | 87 | } 88 | 89 | PROCEDURE rates(cai(mM)) { 90 | 91 | 92 | 93 | a = Ra * cai^caix 94 | b = Rb 95 | 96 | tadj = q10^((celsius - temp)/10) 97 | 98 | ntau = 1/tadj/(a+b) 99 | ninf = a/(a+b) 100 | 101 | 102 | : tinc = -dt * tadj 103 | : nexp = 1 - exp(tinc/ntau) 104 | } 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/nap.mod: -------------------------------------------------------------------------------- 1 | TITLE Sodium persistent current for RD Traub, J Neurophysiol 89:909-921, 2003 2 | 3 | COMMENT 4 | 5 | Implemented by Maciej Lazarewicz 2003 (mlazarew@seas.upenn.edu) 6 | 7 | ENDCOMMENT 8 | 9 | INDEPENDENT { t FROM 0 TO 1 WITH 1 (ms) } 10 | 11 | UNITS { 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | NEURON { 16 | SUFFIX nap 17 | USEION na READ ena WRITE ina 18 | RANGE gbar, ina, minf, mtau, gna, vshift 19 | } 20 | 21 | PARAMETER { 22 | gbar = 0.0 (pS/um2) 23 | vshift = 0 24 | v ena (mV) 25 | } 26 | ASSIGNED { 27 | ina (mA/cm2) 28 | minf (1) 29 | mtau (ms) 30 | gna (mho/cm2) 31 | } 32 | STATE { 33 | m 34 | } 35 | 36 | BREAKPOINT { 37 | SOLVE states METHOD cnexp 38 | gna = gbar * m 39 | ina = (1e-4)*gna * ( v - ena ) 40 | } 41 | 42 | INITIAL { 43 | settables(v-vshift) 44 | m = minf 45 | :m = 0 46 | } 47 | 48 | DERIVATIVE states { 49 | settables(v-vshift) 50 | m' = ( minf - m ) / mtau 51 | } 52 | UNITSOFF 53 | 54 | PROCEDURE settables(v) { 55 | TABLE minf, mtau FROM -120 TO 40 WITH 641 56 | 57 | minf = 1 / ( 1 + exp( ( - v - 48 ) / 10 ) ) 58 | if( v < -40.0 ) { 59 | mtau = 0.025 + 0.14 * exp( ( v + 40 ) / 10 ) 60 | }else{ 61 | mtau = 0.02 + 0.145 * exp( ( - v - 40 ) / 10 ) 62 | } 63 | } 64 | UNITSON 65 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/IKM.lo: -------------------------------------------------------------------------------- 1 | # IKM.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/IKM.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/IKM.mod: -------------------------------------------------------------------------------- 1 | TITLE Cortical M current 2 | : 3 | : M-current, responsible for the adaptation of firing rate and the 4 | : afterhyperpolarization (AHP) of cortical pyramidal cells 5 | : 6 | : First-order model described by hodgkin-Hyxley like equations. 7 | : K+ current, activated by depolarization, noninactivating. 8 | : 9 | : Model taken from Yamada, W.M., Koch, C. and Adams, P.R. Multiple 10 | : channels and calcium dynamics. In: Methods in Neuronal Modeling, 11 | : edited by C. Koch and I. Segev, MIT press, 1989, p 97-134. 12 | : 13 | : See also: McCormick, D.A., Wang, Z. and Huguenard, J. Neurotransmitter 14 | : control of neocortical neuronal activity and excitability. 15 | : Cerebral Cortex 3: 387-398, 1993. 16 | : 17 | : Written by Alain Destexhe, Laval University, 1995 18 | : 19 | 20 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 21 | 22 | NEURON { 23 | SUFFIX km : renamend (Armin Jul 09) 24 | USEION k READ ek WRITE ik 25 | RANGE gkbar, m_inf, tau_m, gk, m, vshift 26 | GLOBAL taumax 27 | 28 | } 29 | 30 | UNITS { 31 | (mA) = (milliamp) 32 | (mV) = (millivolt) 33 | } 34 | 35 | 36 | PARAMETER { 37 | v (mV) 38 | vshift = 0 39 | celsius = 36 (degC) 40 | ek (mV) 41 | gbar = 0 (pS/um2) 42 | taumax = 1000 (ms) : peak value of tau 43 | } 44 | 45 | 46 | 47 | STATE { 48 | m 49 | } 50 | 51 | ASSIGNED { 52 | ik (mA/cm2) 53 | m_inf 54 | tau_m (ms) 55 | tau_peak (ms) 56 | tadj 57 | gk (mho/cm2) 58 | } 59 | 60 | BREAKPOINT { 61 | SOLVE states METHOD euler 62 | gk = gbar * m 63 | ik = (1e-4)*gk * (v - ek) 64 | } 65 | 66 | DERIVATIVE states { 67 | evaluate_fct(v-vshift) 68 | 69 | m' = (m_inf - m) / tau_m 70 | } 71 | 72 | UNITSOFF 73 | INITIAL { 74 | evaluate_fct(v-vshift) 75 | m = m_inf : changed from 0 to m_inf (Armin) 76 | : 77 | : The Q10 value is assumed to be 2.3 78 | : 79 | tadj = 2.3 ^ ((celsius-36)/10) 80 | tau_peak = taumax / tadj 81 | } 82 | 83 | PROCEDURE evaluate_fct(v(mV)) { 84 | 85 | m_inf = 1 / ( 1 + exptable(-(v+35)/10) ) 86 | tau_m = tau_peak / ( 3.3 * exptable((v+35)/20) + exptable(-(v+35)/20) ) 87 | } 88 | UNITSON 89 | 90 | 91 | FUNCTION exptable(x) { 92 | TABLE FROM -25 TO 25 WITH 10000 93 | 94 | if ((x > -25) && (x < 25)) { 95 | exptable = exp(x) 96 | } else { 97 | exptable = 0. 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/SlowCa.lo: -------------------------------------------------------------------------------- 1 | # SlowCa.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/SlowCa.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/SlowCa.mod: -------------------------------------------------------------------------------- 1 | 2 | COMMENT 3 | 4 | changed from (AS Oct0899) 5 | ca.mod 6 | Uses fixed eca instead of GHK eqn 7 | 8 | HVA Ca current 9 | Based on Reuveni, Friedman, Amitai and Gutnick (1993) J. Neurosci. 13: 10 | 4609-4621. 11 | 12 | Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu 13 | modified by Armin Bahl to allow variable time step January 2012 14 | ENDCOMMENT 15 | 16 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 17 | 18 | NEURON { 19 | SUFFIX sca 20 | USEION ca READ eca WRITE ica 21 | RANGE m, h, gca, gbar 22 | RANGE minf, hinf, mtau, htau, inactF, actF 23 | GLOBAL q10, temp, tadj, vmin, vmax, vshift 24 | } 25 | 26 | PARAMETER { 27 | inactF = 3 28 | actF = 1 29 | gbar = 0 (pS/um2) : 0.12 mho/cm2 30 | vshift = 0 (mV) : voltage shift (affects all) 31 | 32 | cao = 2.5 (mM) : external ca concentration 33 | cai (mM) 34 | 35 | temp = 23 (degC) : original temp 36 | q10 = 2.3 : temperature sensitivity 37 | 38 | v (mV) 39 | dt (ms) 40 | celsius (degC) 41 | vmin = -120 (mV) 42 | vmax = 100 (mV) 43 | } 44 | 45 | 46 | UNITS { 47 | (mA) = (milliamp) 48 | (mV) = (millivolt) 49 | (pS) = (picosiemens) 50 | (um) = (micron) 51 | } 52 | 53 | ASSIGNED { 54 | ica (mA/cm2) 55 | gca (pS/um2) 56 | eca (mV) 57 | minf 58 | hinf 59 | mtau (ms) 60 | htau (ms) 61 | tadj 62 | } 63 | 64 | 65 | STATE { m h } 66 | 67 | INITIAL { 68 | rates(v-vshift) 69 | m = minf 70 | h = hinf 71 | } 72 | 73 | BREAKPOINT { 74 | SOLVE states METHOD cnexp 75 | gca = tadj*gbar*m*m*h 76 | ica = (1e-4) * gca * (v - eca) 77 | } 78 | 79 | DERIVATIVE states { 80 | rates(v-vshift) 81 | m' = (minf-m)/mtau 82 | h' = (hinf-h)/htau 83 | } 84 | 85 | PROCEDURE rates(vm) { 86 | LOCAL a, b 87 | tadj = q10^((celsius - temp)/10) 88 | 89 | a = 0.055*(-27 - vm)/(exp((-27-vm)/3.8) - 1)/actF 90 | b = 0.94*exp((-75-vm)/17)/actF 91 | 92 | mtau = 1/tadj/(a+b) 93 | minf = a/(a+b) 94 | 95 | :"h" inactivation 96 | 97 | a = 0.000457*exp((-13-vm)/50)/inactF 98 | b = 0.0065/(exp((-vm-15)/28) + 1)/inactF 99 | 100 | htau = 1/tadj/(a+b) 101 | hinf = a/(a+b) 102 | } 103 | 104 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/cad.lo: -------------------------------------------------------------------------------- 1 | # cad.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/cad.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/cad.mod: -------------------------------------------------------------------------------- 1 | 2 | :26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. 3 | : Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal 4 | 5 | 6 | 7 | 8 | TITLE decay of internal calcium concentration 9 | : 10 | : Internal calcium concentration due to calcium currents and pump. 11 | : Differential equations. 12 | : 13 | : Simple model of ATPase pump with 3 kinetic constants (Destexhe 92) 14 | : Cai + P <-> CaP -> Cao + P (k1,k2,k3) 15 | : A Michaelis-Menten approximation is assumed, which reduces the complexity 16 | : of the system to 2 parameters: 17 | : kt = * k3 -> TIME CONSTANT OF THE PUMP 18 | : kd = k2/k1 (dissociation constant) -> EQUILIBRIUM CALCIUM VALUE 19 | : The values of these parameters are chosen assuming a high affinity of 20 | : the pump to calcium and a low transport capacity (cfr. Blaustein, 21 | : TINS, 11: 438, 1988, and references therein). 22 | : 23 | : Units checked using "modlunit" -> factor 10000 needed in ca entry 24 | : 25 | : VERSION OF PUMP + DECAY (decay can be viewed as simplified buffering) 26 | : 27 | : All variables are range variables 28 | : 29 | : 30 | : This mechanism was published in: Destexhe, A. Babloyantz, A. and 31 | : Sejnowski, TJ. Ionic mechanisms for intrinsic slow oscillations in 32 | : thalamic relay neurons. Biophys. J. 65: 1538-1552, 1993) 33 | : 34 | : Written by Alain Destexhe, Salk Institute, Nov 12, 1992 35 | : 36 | 37 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 38 | 39 | NEURON { 40 | SUFFIX cad 41 | USEION ca READ ica, cai WRITE cai 42 | RANGE ca 43 | GLOBAL depth,cainf,taur 44 | } 45 | 46 | UNITS { 47 | (molar) = (1/liter) : moles do not appear in units 48 | (mM) = (millimolar) 49 | (um) = (micron) 50 | (mA) = (milliamp) 51 | (msM) = (ms mM) 52 | FARADAY = (faraday) (coulomb) 53 | } 54 | 55 | 56 | PARAMETER { 57 | depth = .1 (um) : depth of shell 58 | taur = 200 (ms) : rate of calcium removal 59 | cainf = 100e-6(mM) 60 | cai (mM) 61 | } 62 | 63 | STATE { 64 | ca (mM) <1e-5> 65 | } 66 | 67 | INITIAL { 68 | ca = cainf 69 | cai = ca 70 | } 71 | 72 | ASSIGNED { 73 | ica (mA/cm2) 74 | drive_channel (mM/ms) 75 | } 76 | 77 | BREAKPOINT { 78 | SOLVE state METHOD euler 79 | } 80 | 81 | DERIVATIVE state { 82 | 83 | drive_channel = - (10000) * ica / (2 * FARADAY * depth) 84 | if (drive_channel <= 0.) { drive_channel = 0. } : cannot pump inward 85 | 86 | ca' = drive_channel + (cainf-ca)/taur 87 | cai = ca 88 | } 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/h.lo: -------------------------------------------------------------------------------- 1 | # h.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/h.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/h.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | Deterministic model of kinetics and voltage-dependence of Ih-currents 4 | in layer 5 pyramidal neuron, see Kole et al., 2006. Implemented by 5 | Stefan Hallermann. 6 | 7 | Added possibility to shift voltage activiation (vshift) and allowed access to gating variables, Armin Bahl 2009 8 | 9 | Predominantly HCN1 / HCN2 10 | 11 | ENDCOMMENT 12 | 13 | TITLE Ih-current 14 | 15 | UNITS { 16 | (mA) = (milliamp) 17 | (mV) = (millivolt) 18 | (mM) = (milli/liter) 19 | 20 | } 21 | 22 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 23 | 24 | PARAMETER { 25 | dt (ms) 26 | v (mV) 27 | ehd=-47 (mV) 28 | gbar=0 (pS/um2) 29 | gamma_ih :not used 30 | seed :not used 31 | vshift = 0 32 | } 33 | 34 | 35 | NEURON { 36 | SUFFIX ih 37 | NONSPECIFIC_CURRENT Iqq 38 | RANGE Iqq,gbar,vshift,ehd, qtau, qinf, gq 39 | } 40 | 41 | STATE { 42 | qq 43 | } 44 | 45 | ASSIGNED { 46 | Iqq (mA/cm2) 47 | qtau (ms) 48 | qinf 49 | gq (pS/um2) 50 | 51 | } 52 | 53 | INITIAL { 54 | qq=alpha(v-vshift)/(beta(v-vshift)+alpha(v-vshift)) 55 | 56 | qtau = 1./(alpha(v-vshift) + beta(v-vshift)) 57 | qinf = alpha(v)/(alpha(v-vshift) + beta(v-vshift)) 58 | } 59 | 60 | BREAKPOINT { 61 | SOLVE state METHOD cnexp 62 | 63 | qtau = 1./(alpha(v-vshift) + beta(v-vshift)) 64 | qinf = alpha(v-vshift)/(alpha(v-vshift) + beta(v-vshift)) 65 | 66 | gq = gbar*qq 67 | Iqq = (1e-4)*gq*(v-ehd) 68 | 69 | } 70 | 71 | FUNCTION alpha(v(mV)) { 72 | 73 | alpha = 0.001*6.43*(v+154.9)/(exp((v+154.9)/11.9)-1) 74 | : parameters are estimated by direct fitting of HH model to 75 | : activation time constants and voltage activation curve 76 | : recorded at 34C 77 | 78 | } 79 | 80 | FUNCTION beta(v(mV)) { 81 | beta = 0.001*193*exp(v/33.1) 82 | } 83 | 84 | DERIVATIVE state { : exact when v held constant; integrates over dt step 85 | qq' = (1-qq)*alpha(v-vshift) - qq*beta(v-vshift) 86 | } 87 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/kca.lo: -------------------------------------------------------------------------------- 1 | # kca.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/kca.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/kca.mod: -------------------------------------------------------------------------------- 1 | 2 | COMMENT 3 | 26 Ago 2002 Modification of original channel to allow variable time step and to correct an initialization error. 4 | Done by Michael Hines(michael.hines@yale.e) and Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course in Computational Neuroscience. Obidos, Portugal 5 | 6 | kca.mod 7 | 8 | Calcium-dependent potassium channel 9 | Based on 10 | Pennefather (1990) -- sympathetic ganglion cells 11 | taken from 12 | Reuveni et al (1993) -- neocortical cells 13 | 14 | Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu 15 | 16 | ENDCOMMENT 17 | 18 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 19 | 20 | NEURON { 21 | SUFFIX kca 22 | USEION k READ ek WRITE ik 23 | USEION ca READ cai 24 | RANGE n, gk, gbar 25 | RANGE ninf, ntau 26 | GLOBAL Ra, Rb, caix 27 | GLOBAL q10, temp, tadj, vmin, vmax 28 | } 29 | 30 | UNITS { 31 | (mA) = (milliamp) 32 | (mV) = (millivolt) 33 | (pS) = (picosiemens) 34 | (um) = (micron) 35 | } 36 | 37 | PARAMETER { 38 | gbar = 10 (pS/um2) : 0.03 mho/cm2 39 | v (mV) 40 | cai (mM) 41 | caix = 1 42 | 43 | Ra = 0.01 (/ms) : max act rate 44 | Rb = 0.02 (/ms) : max deact rate 45 | 46 | dt (ms) 47 | celsius (degC) 48 | temp = 23 (degC) : original temp 49 | q10 = 2.3 : temperature sensitivity 50 | 51 | vmin = -120 (mV) 52 | vmax = 100 (mV) 53 | } 54 | 55 | 56 | ASSIGNED { 57 | a (/ms) 58 | b (/ms) 59 | ik (mA/cm2) 60 | gk (pS/um2) 61 | ek (mV) 62 | ninf 63 | ntau (ms) 64 | tadj 65 | } 66 | 67 | 68 | STATE { n } 69 | 70 | INITIAL { 71 | rates(cai) 72 | n = ninf 73 | } 74 | 75 | BREAKPOINT { 76 | SOLVE states METHOD cnexp 77 | gk = tadj*gbar*n 78 | ik = (1e-4) * gk * (v - ek) 79 | } 80 | 81 | LOCAL nexp 82 | 83 | DERIVATIVE states { :Computes state variable n 84 | rates(cai) : at the current v and dt. 85 | n' = (ninf-n)/ntau 86 | 87 | } 88 | 89 | PROCEDURE rates(cai(mM)) { 90 | 91 | 92 | 93 | a = Ra * cai^caix 94 | b = Rb 95 | 96 | tadj = q10^((celsius - temp)/10) 97 | 98 | ntau = 1/tadj/(a+b) 99 | ninf = a/(a+b) 100 | 101 | 102 | : tinc = -dt * tadj 103 | : nexp = 1 - exp(tinc/ntau) 104 | } 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/kfast.lo: -------------------------------------------------------------------------------- 1 | # kfast.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/kfast.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/kslow.lo: -------------------------------------------------------------------------------- 1 | # kslow.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/kslow.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/libnrnmech.la: -------------------------------------------------------------------------------- 1 | # libnrnmech.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libnrnmech.so.0' 9 | 10 | # Names of this library. 11 | library_names='libnrnmech.so.0.0.0 libnrnmech.so.0 libnrnmech.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags=' -pthread' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/usr/local/nrn/x86_64/lib /usr/local/nrn/x86_64/lib/libnrnoc.la /usr/local/nrn/x86_64/lib/liboc.la -lX11 /usr/local/nrn/x86_64/lib/libmemacs.la /usr/local/nrn/x86_64/lib/libscopmath.la /usr/local/nrn/x86_64/lib/libsparse13.la /usr/local/nrn/x86_64/lib/libreadline.la -lncurses /usr/local/nrn/x86_64/lib/libnrniv.la /usr/local/nrn/x86_64/lib/libivoc.la /usr/local/nrn/x86_64/lib/libneuron_gnu.la /usr/local/nrn/x86_64/lib/libmeschach.la /usr/local/nrn/x86_64/lib/libsundials.la -lm -ldl' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libnrnmech. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=no 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/nrn/x86_64/lib' 42 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/mod_func.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hocdec.h" 3 | extern int nrnmpi_myid; 4 | extern int nrn_nobanner_; 5 | 6 | extern void _IKM_reg(void); 7 | extern void _SlowCa_reg(void); 8 | extern void _cad_reg(void); 9 | extern void _h_reg(void); 10 | extern void _kca_reg(void); 11 | extern void _kfast_reg(void); 12 | extern void _kslow_reg(void); 13 | extern void _nap_reg(void); 14 | extern void _nat_reg(void); 15 | 16 | void modl_reg(){ 17 | if (!nrn_nobanner_) if (nrnmpi_myid < 1) { 18 | fprintf(stderr, "Additional mechanisms from files\n"); 19 | 20 | fprintf(stderr," IKM.mod"); 21 | fprintf(stderr," SlowCa.mod"); 22 | fprintf(stderr," cad.mod"); 23 | fprintf(stderr," h.mod"); 24 | fprintf(stderr," kca.mod"); 25 | fprintf(stderr," kfast.mod"); 26 | fprintf(stderr," kslow.mod"); 27 | fprintf(stderr," nap.mod"); 28 | fprintf(stderr," nat.mod"); 29 | fprintf(stderr, "\n"); 30 | } 31 | _IKM_reg(); 32 | _SlowCa_reg(); 33 | _cad_reg(); 34 | _h_reg(); 35 | _kca_reg(); 36 | _kfast_reg(); 37 | _kslow_reg(); 38 | _nap_reg(); 39 | _nat_reg(); 40 | } 41 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/mod_func.lo: -------------------------------------------------------------------------------- 1 | # mod_func.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/mod_func.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/nap.lo: -------------------------------------------------------------------------------- 1 | # nap.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/nap.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/nap.mod: -------------------------------------------------------------------------------- 1 | TITLE Sodium persistent current for RD Traub, J Neurophysiol 89:909-921, 2003 2 | 3 | COMMENT 4 | 5 | Implemented by Maciej Lazarewicz 2003 (mlazarew@seas.upenn.edu) 6 | 7 | ENDCOMMENT 8 | 9 | INDEPENDENT { t FROM 0 TO 1 WITH 1 (ms) } 10 | 11 | UNITS { 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | NEURON { 16 | SUFFIX nap 17 | USEION na READ ena WRITE ina 18 | RANGE gbar, ina, minf, mtau, gna, vshift 19 | } 20 | 21 | PARAMETER { 22 | gbar = 0.0 (pS/um2) 23 | vshift = 0 24 | v ena (mV) 25 | } 26 | ASSIGNED { 27 | ina (mA/cm2) 28 | minf (1) 29 | mtau (ms) 30 | gna (mho/cm2) 31 | } 32 | STATE { 33 | m 34 | } 35 | 36 | BREAKPOINT { 37 | SOLVE states METHOD cnexp 38 | gna = gbar * m 39 | ina = (1e-4)*gna * ( v - ena ) 40 | } 41 | 42 | INITIAL { 43 | settables(v-vshift) 44 | m = minf 45 | :m = 0 46 | } 47 | 48 | DERIVATIVE states { 49 | settables(v-vshift) 50 | m' = ( minf - m ) / mtau 51 | } 52 | UNITSOFF 53 | 54 | PROCEDURE settables(v) { 55 | TABLE minf, mtau FROM -120 TO 40 WITH 641 56 | 57 | minf = 1 / ( 1 + exp( ( - v - 48 ) / 10 ) ) 58 | if( v < -40.0 ) { 59 | mtau = 0.025 + 0.14 * exp( ( v + 40 ) / 10 ) 60 | }else{ 61 | mtau = 0.02 + 0.145 * exp( ( - v - 40 ) / 10 ) 62 | } 63 | } 64 | UNITSON 65 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/nat.lo: -------------------------------------------------------------------------------- 1 | # nat.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/nat.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/channels/x86_64/special: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if test "x${NRNHOME}" = "x" ; then 3 | NRNHOME="/usr/local/nrn" 4 | fi 5 | if test "x${NRNBIN}" = "x" ; then 6 | NRNBIN="/usr/local/nrn/x86_64/bin/" 7 | fi 8 | if test "" = "yes" ; then 9 | NRNIV="${NRNBIN}nrniv.app/Contents/MacOS/nrniv" 10 | else 11 | NRNIV="${NRNBIN}nrniv" 12 | fi 13 | "${NRNIV}" -dll "/home/simen/Dropbox/phd/uncertainpy/examples/bahl/bahl_neuron_model/channels/x86_64/.libs/libnrnmech.so" "$@" 14 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/example1.hoc: -------------------------------------------------------------------------------- 1 | load_file("./init_models_with_ca/init_model2.hoc") 2 | load_file("regular_spiking.ses") 3 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/example2.hoc: -------------------------------------------------------------------------------- 1 | load_file("./init_models_with_ca/init_model2.hoc") 2 | load_file("ca_spike1.ses") -------------------------------------------------------------------------------- /examples/bahl/bahl_model/example3.hoc: -------------------------------------------------------------------------------- 1 | load_file("./init_models_with_ca/init_model2.hoc") 2 | load_file("ca_spike2.ses") 3 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_with_ca/init_model1.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.056442 5 | Rm_axosomatic = 23823.061083 6 | forsec axosomatic_list cm = 2.298892 7 | spinefactor = 0.860211 8 | soma gbar_nat = 284.546493 9 | soma gbar_kfast = 50.802287 10 | soma gbar_kslow = 361.584735 11 | soma gbar_nap = 0.873246 12 | soma gbar_km = 7.123963 13 | basal gbar_ih = 15.709707 14 | tuft gbar_ih = 17.694744 15 | tuft gbar_nat = 6.558244 16 | decay_kfast = 58.520995 17 | decay_kslow = 42.208044 18 | hillock gbar_nat = 8810.657100 19 | iseg gbar_nat = 13490.395442 20 | iseg vshift2_nat = -9.802976 21 | 22 | Ra_apical = 454.05939784 23 | apical Ra = Ra_apical 24 | tuft gbar_sca = 3.67649485 25 | tuft vshift_sca = 7.4783781 26 | tuft gbar_kca = 9.75672674 27 | 28 | recalculate_passive_properties() 29 | recalculate_channel_densities() 30 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_with_ca/init_model2.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.398657 5 | Rm_axosomatic = 20587.734598 6 | forsec axosomatic_list cm = 2.230408 7 | spinefactor = 0.784797 8 | soma gbar_nat = 236.616175 9 | soma gbar_kfast = 67.197508 10 | soma gbar_kslow = 475.820646 11 | soma gbar_nap = 1.443953 12 | soma gbar_km = 10.459916 13 | basal gbar_ih = 11.039583 14 | tuft gbar_ih = 16.194815 15 | tuft gbar_nat = 47.817841 16 | decay_kfast = 20.075497 17 | decay_kslow = 37.711817 18 | hillock gbar_nat = 9512.289205 19 | iseg gbar_nat = 13326.766938 20 | iseg vshift2_nat = -10.612583 21 | 22 | Ra_apical = 382.22414867 23 | apical Ra = Ra_apical 24 | tuft gbar_sca = 0.45423528 25 | tuft vshift_sca = 7.19485311 26 | tuft gbar_kca = 6.15058501 27 | 28 | recalculate_passive_properties() 29 | recalculate_channel_densities() 30 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_with_ca/init_model3.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.495767 5 | Rm_axosomatic = 20513.848207 6 | forsec axosomatic_list cm = 2.411070 7 | spinefactor = 0.691767 8 | soma gbar_nat = 238.879842 9 | soma gbar_kfast = 59.256783 10 | soma gbar_kslow = 433.798677 11 | soma gbar_nap = 1.479049 12 | soma gbar_km = 11.118662 13 | basal gbar_ih = 10.720289 14 | tuft gbar_ih = 17.796075 15 | tuft gbar_nat = 29.006481 16 | decay_kfast = 55.581656 17 | decay_kslow = 88.716317 18 | hillock gbar_nat = 8302.875131 19 | iseg gbar_nat = 17623.525167 20 | iseg vshift2_nat = -9.567698 21 | 22 | Ra_apical = 4.44130503e+02 23 | apical Ra = Ra_apical 24 | tuft gbar_sca = 2.12343632e+00 25 | tuft vshift_sca = 8.34639038e+00 26 | tuft gbar_kca = 8.22978203e+00 27 | 28 | recalculate_passive_properties() 29 | recalculate_channel_densities() 30 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_with_ca/init_model6.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -84.998432 5 | Rm_axosomatic = 15158.600592 6 | forsec axosomatic_list cm = 2.708710 7 | spinefactor = 0.500131 8 | soma gbar_nat = 295.471939 9 | soma gbar_kfast = 43.229568 10 | soma gbar_kslow = 630.252495 11 | soma gbar_nap = 3.524026 12 | soma gbar_km = 11.911267 13 | basal gbar_ih = 12.871974 14 | tuft gbar_ih = 23.929821 15 | tuft gbar_nat = 45.917053 16 | decay_kfast = 65.606365 17 | decay_kslow = 34.325297 18 | hillock gbar_nat = 9451.076984 19 | iseg gbar_nat = 17193.545673 20 | iseg vshift2_nat = -8.920295 21 | 22 | Ra_apical = 4.45008826e+02 23 | apical Ra = Ra_apical 24 | tuft gbar_sca = 4.86650161e-01 25 | tuft vshift_sca = 7.95615680e-01 26 | tuft gbar_kca = 9.68514833e+00 27 | 28 | recalculate_passive_properties() 29 | recalculate_channel_densities() 30 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_with_ca/init_model7.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.681797 5 | Rm_axosomatic = 21298.371768 6 | forsec axosomatic_list cm = 2.371953 7 | spinefactor = 0.548509 8 | soma gbar_nat = 447.254408 9 | soma gbar_kfast = 43.784070 10 | soma gbar_kslow = 190.331780 11 | soma gbar_nap = 0.852072 12 | soma gbar_km = 11.049652 13 | basal gbar_ih = 3.121003 14 | tuft gbar_ih = 40.673635 15 | tuft gbar_nat = 0.408584 16 | decay_kfast = 82.070143 17 | decay_kslow = 65.182920 18 | hillock gbar_nat = 8171.378905 19 | iseg gbar_nat = 19582.667257 20 | iseg vshift2_nat = -5.357797 21 | 22 | Ra_apical = 332.92 23 | apical Ra = Ra_apical 24 | tuft gbar_sca = 2.81 25 | tuft vshift_sca = 2.35 26 | tuft gbar_kca = 9.55 27 | 28 | recalculate_passive_properties() 29 | recalculate_channel_densities() 30 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_with_ca/init_model8.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.735127 5 | Rm_axosomatic = 11594.384797 6 | forsec axosomatic_list cm = 2.336857 7 | spinefactor = 0.500000 8 | soma gbar_nat = 402.172079 9 | soma gbar_kfast = 41.351830 10 | soma gbar_kslow = 264.787820 11 | soma gbar_nap = 4.179878 12 | soma gbar_km = 14.917361 13 | basal gbar_ih = 11.921506 14 | tuft gbar_ih = 15.266638 15 | tuft gbar_nat = 11.555568 16 | decay_kfast = 91.798929 17 | decay_kslow = 75.607992 18 | hillock gbar_nat = 8030.326751 19 | iseg gbar_nat = 17591.201145 20 | iseg vshift2_nat = -5.982169 21 | 22 | Ra_apical = 358.47 23 | apical Ra = Ra_apical 24 | tuft gbar_sca = 3.86 25 | tuft vshift_sca = 3.79 26 | tuft gbar_kca = 9.60 27 | 28 | recalculate_passive_properties() 29 | recalculate_channel_densities() 30 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model1.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.056442 5 | Rm_axosomatic = 18000//23823.061083 6 | forsec axosomatic_list cm = 2.298892 7 | spinefactor = 0.860211 8 | soma gbar_nat = 284.546493 9 | soma gbar_kfast = 50.802287 10 | soma gbar_kslow = 361.584735 11 | soma gbar_nap = 0.873246 12 | soma gbar_km = 7.123963 13 | basal gbar_ih = 15.709707 14 | tuft gbar_ih = 17.694744 15 | tuft gbar_nat = 6.558244 16 | decay_kfast = 58.520995 17 | decay_kslow = 42.208044 18 | hillock gbar_nat = 8810.657100 19 | iseg gbar_nat = 13490.395442 20 | iseg vshift2_nat = -9.802976 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model10.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.753389 5 | Rm_axosomatic = 14711.977820 6 | forsec axosomatic_list cm = 2.506244 7 | spinefactor = 0.500000 8 | soma gbar_nat = 371.426181 9 | soma gbar_kfast = 48.253662 10 | soma gbar_kslow = 621.740747 11 | soma gbar_nap = 4.160887 12 | soma gbar_km = 7.001287 13 | basal gbar_ih = 22.091222 14 | tuft gbar_ih = 3.344451 15 | tuft gbar_nat = 87.601656 16 | decay_kfast = 67.524548 17 | decay_kslow = 83.026382 18 | hillock gbar_nat = 8407.043322 19 | iseg gbar_nat = 15509.309335 20 | iseg vshift2_nat = -8.471039 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model2.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.398657 5 | Rm_axosomatic = 20587.734598 6 | forsec axosomatic_list cm = 2.230408 7 | spinefactor = 0.784797 8 | soma gbar_nat = 236.616175 9 | soma gbar_kfast = 67.197508 10 | soma gbar_kslow = 475.820646 11 | soma gbar_nap = 1.443953 12 | soma gbar_km = 10.459916 13 | basal gbar_ih = 11.039583 14 | tuft gbar_ih = 16.194815 15 | tuft gbar_nat = 47.817841 16 | decay_kfast = 20.075497 17 | decay_kslow = 37.711817 18 | hillock gbar_nat = 9512.289205 19 | iseg gbar_nat = 13326.766938 20 | iseg vshift2_nat = -10.612583 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model3.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.495767 5 | Rm_axosomatic = 20513.848207 6 | forsec axosomatic_list cm = 2.411070 7 | spinefactor = 0.691767 8 | soma gbar_nat = 238.879842 9 | soma gbar_kfast = 59.256783 10 | soma gbar_kslow = 433.798677 11 | soma gbar_nap = 1.479049 12 | soma gbar_km = 11.118662 13 | basal gbar_ih = 10.720289 14 | tuft gbar_ih = 17.796075 15 | tuft gbar_nat = 29.006481 16 | decay_kfast = 55.581656 17 | decay_kslow = 88.716317 18 | hillock gbar_nat = 8302.875131 19 | iseg gbar_nat = 17623.525167 20 | iseg vshift2_nat = -9.567698 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model4.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -78.966512 5 | Rm_axosomatic = 10784.189375 6 | forsec axosomatic_list cm = 1.788598 7 | spinefactor = 0.500568 8 | soma gbar_nat = 182.173855 9 | soma gbar_kfast = 45.426969 10 | soma gbar_kslow = 467.500517 11 | soma gbar_nap = 3.330850 12 | soma gbar_km = 12.989793 13 | basal gbar_ih = 7.941981 14 | tuft gbar_ih = 18.885964 15 | tuft gbar_nat = 76.648697 16 | decay_kfast = 2.148619 17 | decay_kslow = 55.487859 18 | hillock gbar_nat = 5996.557122 19 | iseg gbar_nat = 12625.200405 20 | iseg vshift2_nat = -10.156329 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model5.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -82.554655 5 | Rm_axosomatic = 17386.667401 6 | forsec axosomatic_list cm = 2.016321 7 | spinefactor = 0.518562 8 | soma gbar_nat = 248.748930 9 | soma gbar_kfast = 44.769677 10 | soma gbar_kslow = 523.268577 11 | soma gbar_nap = 2.290082 12 | soma gbar_km = 14.199808 13 | basal gbar_ih = 13.617138 14 | tuft gbar_ih = 15.730344 15 | tuft gbar_nat = 40.380139 16 | decay_kfast = 8.912988 17 | decay_kslow = 49.669151 18 | hillock gbar_nat = 4988.053500 19 | iseg gbar_nat = 10730.280021 20 | iseg vshift2_nat = -10.748579 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model6.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -84.998432 5 | Rm_axosomatic = 24000//15158.600592 6 | forsec axosomatic_list cm = 2.708710 7 | spinefactor = 0.500131 8 | soma gbar_nat = 295.471939 9 | soma gbar_kfast = 43.229568 10 | soma gbar_kslow = 630.252495 11 | soma gbar_nap = 3.524026 12 | soma gbar_km = 11.911267 13 | basal gbar_ih = 12.871974 14 | tuft gbar_ih = 23.929821 15 | tuft gbar_nat = 45.917053 16 | decay_kfast = 65.606365 17 | decay_kslow = 34.325297 18 | hillock gbar_nat = 9451.076984 19 | iseg gbar_nat = 17193.545673 20 | iseg vshift2_nat = -8.920295 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model7.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.681797 5 | Rm_axosomatic = 21298.371768 6 | forsec axosomatic_list cm = 2.371953 7 | spinefactor = 0.548509 8 | soma gbar_nat = 447.254408 9 | soma gbar_kfast = 43.784070 10 | soma gbar_kslow = 190.331780 11 | soma gbar_nap = 0.852072 12 | soma gbar_km = 11.049652 13 | basal gbar_ih = 3.121003 14 | tuft gbar_ih = 40.673635 15 | tuft gbar_nat = 0.408584 16 | decay_kfast = 82.070143 17 | decay_kslow = 65.182920 18 | hillock gbar_nat = 8171.378905 19 | iseg gbar_nat = 19582.667257 20 | iseg vshift2_nat = -5.357797 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model8.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -80.735127 5 | Rm_axosomatic = 11594.384797 6 | forsec axosomatic_list cm = 2.336857 7 | spinefactor = 0.500000 8 | soma gbar_nat = 402.172079 9 | soma gbar_kfast = 41.351830 10 | soma gbar_kslow = 264.787820 11 | soma gbar_nap = 4.179878 12 | soma gbar_km = 14.917361 13 | basal gbar_ih = 11.921506 14 | tuft gbar_ih = 15.266638 15 | tuft gbar_nat = 11.555568 16 | decay_kfast = 91.798929 17 | decay_kslow = 75.607992 18 | hillock gbar_nat = 8030.326751 19 | iseg gbar_nat = 17591.201145 20 | iseg vshift2_nat = -5.982169 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model9.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -84.366298 5 | Rm_axosomatic = 11081.475290 6 | forsec axosomatic_list cm = 1.403833 7 | spinefactor = 0.500000 8 | soma gbar_nat = 277.350705 9 | soma gbar_kfast = 32.413487 10 | soma gbar_kslow = 187.871780 11 | soma gbar_nap = 2.206920 12 | soma gbar_km = 12.217082 13 | basal gbar_ih = 13.902853 14 | tuft gbar_ih = 51.840951 15 | tuft gbar_nat = 46.940022 16 | decay_kfast = 73.466007 17 | decay_kslow = 69.606947 18 | hillock gbar_nat = 4903.968147 19 | iseg gbar_nat = 10776.841823 20 | iseg vshift2_nat = -10.260551 21 | 22 | 23 | recalculate_passive_properties() 24 | recalculate_channel_densities() 25 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/init_models_without_ca/init_model_avg1_6.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -81.75 5 | Rm_axosomatic = 18042.35 6 | forsec axosomatic_list cm = 2.24 7 | spinefactor = 0.64 8 | soma gbar_nat = 247.74 9 | soma gbar_kfast = 51.78 10 | soma gbar_kslow = 482.04 11 | soma gbar_nap = 2.16 12 | soma gbar_km = 11.30 13 | basal gbar_ih = 11.98 14 | tuft gbar_ih = 18.37 15 | tuft gbar_nat = 41.05 16 | decay_kfast = 35.14 17 | decay_kslow = 51.35 18 | hillock gbar_nat = 7843.58 19 | iseg gbar_nat = 14164.95 20 | iseg vshift2_nat = -9.97 21 | 22 | recalculate_passive_properties() 23 | recalculate_channel_densities() 24 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/mosinit.hoc: -------------------------------------------------------------------------------- 1 | //moddir channels 2 | load_file("nrngui.hoc") 3 | load_file("example1.hoc") 4 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/readme.html: -------------------------------------------------------------------------------- 1 |
 2 | These are the NEURON files for 10 different models of a reduced L5
 3 | pyramidal neuron. The parameters were obtained by automatically
 4 | fitting the models to experimental data using a multi objective
 5 | evolutionary search strategy. Details on the algorithm can be found at
 6 | www.g-node.org/emoo and in Bahl et al. (2012).
 7 | 
 8 | For testing: 
 9 | 
10 | - Compile the channels with nrnivmodl (this model was developed under
11 |   linux). You might then have to correct the path in reduced_model.hoc
12 | - Test regular firing and ca-Spike examples: nrngui example1.hoc etc.
13 |   By default the auto-launch button on ModelDB will start this file.
14 |   After the example1.hoc is started press Init & Run.  You should see:
15 | 
16 | screenshot
17 | 
18 | - You can also load the models directly: hoc files init_models_with_ca
19 |   are models with calcium parameters properly set, while the hoc files
20 |   in init_models_without_ca describe models with inactivated dendritic
21 |   calcium dynamics.
22 | 
23 | Please contact me if you have problems or questions concerning the
24 | models or the search algorithm.
25 | 
26 | Armin Bahl
27 | 
28 | References:
29 | 
30 | Bahl, A., Stemmler, M. B., Herz, A. V. M., & Roth, A. (2012).
31 | Automated optimization of a reduced layer 5 pyramidal cell model based
32 | on experimental data. Journal of Neuroscience Methods, 210(1), 22-34.
33 | doi:10.1016/j.jneumeth.2012.04.006
34 | 
35 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/regular_spiking.ses: -------------------------------------------------------------------------------- 1 | {load_file("nrngui.hoc")} 2 | objectvar save_window_, rvp_ 3 | objectvar scene_vector_[4] 4 | objectvar ocbox_, ocbox_list_, scene_, scene_list_ 5 | {ocbox_list_ = new List() scene_list_ = new List()} 6 | {pwman_place(0,0,0)} 7 | 8 | //Begin PointProcessManager 9 | { 10 | load_file("pointman.hoc") 11 | } 12 | { 13 | soma ocbox_ = new PointProcessManager(0) 14 | } 15 | {object_push(ocbox_)} 16 | { 17 | mt.select("IClamp") i = mt.selected() 18 | ms[i] = new MechanismStandard("IClamp") 19 | ms[i].set("del", 100, 0) 20 | ms[i].set("dur", 500, 0) 21 | ms[i].set("amp", 0.4, 0) 22 | mt.select("IClamp") i = mt.selected() maction(i) 23 | hoc_ac_ = 0.5 24 | sec.sec move() d1.flip_to(0) 25 | } 26 | {object_pop() doNotify()} 27 | { 28 | ocbox_ = ocbox_.v1 29 | ocbox_.map("PointProcessManager", 403, 304, 208.32, 326.4) 30 | } 31 | objref ocbox_ 32 | //End PointProcessManager 33 | 34 | { 35 | xpanel("RunControl", 0) 36 | v_init = -65 37 | xvalue("Init","v_init", 1,"stdinit()", 1, 1 ) 38 | xbutton("Init & Run","run()") 39 | xbutton("Stop","stoprun=1") 40 | runStopAt = 5 41 | xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 ) 42 | runStopIn = 1 43 | xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 ) 44 | xbutton("Single Step","steprun()") 45 | t = 800 46 | xvalue("t","t", 2 ) 47 | tstop = 800 48 | xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 ) 49 | dt = 5.54201 50 | xvalue("dt","dt", 1,"setdt()", 0, 1 ) 51 | steps_per_ms = 40 52 | xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 ) 53 | screen_update_invl = 0.05 54 | xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 ) 55 | realtime = 0.19 56 | xvalue("Real Time","realtime", 0,"", 0, 1 ) 57 | xpanel(77,170) 58 | } 59 | { 60 | save_window_ = new Graph(0) 61 | save_window_.size(0,800,-160.2,137.8) 62 | scene_vector_[3] = save_window_ 63 | {save_window_.view(0, -160.2, 800, 298, 665, 0, 651.84, 430.72)} 64 | graphList[0].append(save_window_) 65 | save_window_.save_name("graphList[0].") 66 | save_window_.addexpr("v(.5)", 1, 3, 0.8, 0.9, 2) 67 | save_window_.addexpr("tuft.v(0.5)", 2, 3, 0.794744, 0.867056, 2) 68 | save_window_.addexpr("apical.v(0.5)", 3, 3, 0.794109, 0.940119, 2) 69 | } 70 | 71 | //Begin VariableTimeStep 72 | { 73 | ocbox_ = NumericalMethodPanel[0] 74 | } 75 | {object_push(ocbox_)} 76 | { 77 | atol_ = 0.001 CVode[0].atol(atol_) 78 | restore(301, 1) 79 | } 80 | {object_pop()} 81 | { 82 | ocbox_.map("VariableTimeStep", 71, 583, 277.44, 113.28) 83 | } 84 | objref ocbox_ 85 | //End VariableTimeStep 86 | 87 | objectvar scene_vector_[1] 88 | {doNotify()} 89 | -------------------------------------------------------------------------------- /examples/bahl/bahl_model/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/bahl/bahl_model/screenshot.png -------------------------------------------------------------------------------- /examples/bahl/modelDB_link.txt: -------------------------------------------------------------------------------- 1 | https://senselab.med.yale.edu/ModelDB/ShowModel.cshtml?model=146026 2 | -------------------------------------------------------------------------------- /examples/bahl/uq_bahl.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp 3 | 4 | # Subclassing NeuronModel 5 | class NeuronModelBahl(un.NeuronModel): 6 | def __init__(self, stimulus_start=None, stimulus_end=None): 7 | # Hardcode the path of the Bahl neuron model 8 | super(NeuronModelBahl, self).__init__(interpolate=True, 9 | path="bahl_model", 10 | stimulus_start=stimulus_start, 11 | stimulus_end=stimulus_end) 12 | 13 | # Reimplement the set_parameters method used by run 14 | def set_parameters(self, parameters): 15 | for parameter in parameters: 16 | self.h(parameter + " = " + str(parameters[parameter])) 17 | 18 | # These commands must be added for this specific 19 | # model to recalculate the parameters after they have been set 20 | self.h("recalculate_passive_properties()") 21 | self.h("recalculate_channel_densities()") 22 | 23 | 24 | # Initialize the model with the start and end time of the stimulus 25 | model = NeuronModelBahl(stimulus_start=100, stimulus_end=600) 26 | 27 | # Define a parameter list and use it directly 28 | parameters = {"e_pas": cp.Uniform(-60, -85), 29 | "apical Ra": cp.Uniform(150, 300)} 30 | 31 | # Initialize the features 32 | features = un.SpikingFeatures() 33 | 34 | # Perform the uncertainty quantification 35 | UQ = un.UncertaintyQuantification(model=model, 36 | parameters=parameters, 37 | features=features) 38 | data = UQ.quantify() 39 | -------------------------------------------------------------------------------- /examples/brunel/brunel.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/brunel/brunel.pdf -------------------------------------------------------------------------------- /examples/brunel/uq_brunel.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp 3 | 4 | from brunel import brunel_network 5 | 6 | # Create a Nest model from the brunel network function 7 | # We set ``ignore=True`` since we are not interested in 8 | # the model result itself. 9 | # This is recommended for NEST models as long as you do not 10 | # need the model results, since the uncertainty calculations for the 11 | # for the model results require much time and memory. 12 | model = un.NestModel(run=brunel_network, ignore=True) 13 | 14 | 15 | # Parametes for the synchronous regular (SR) state 16 | parameters = {"eta": cp.Uniform(1.5, 3.5), 17 | "g": cp.Uniform(1, 3), 18 | "delay": cp.Uniform(1.5, 3)} 19 | parameters_SR = un.Parameters(parameters) 20 | 21 | # Parameter for the asynchronous irregular (AI) state 22 | parameters = {"eta": cp.Uniform(1.5, 2.2), 23 | "g": cp.Uniform(5, 8), 24 | "delay": cp.Uniform(1.5, 3)} 25 | parameters_AI = un.Parameters(parameters) 26 | 27 | # Initialize network features 28 | features = un.NetworkFeatures() 29 | 30 | # Set up the problem 31 | UQ = un.UncertaintyQuantification(model, 32 | parameters=parameters_SR, 33 | features=features) 34 | 35 | # Perform uncertainty quantification 36 | # and save the data and plots under their own name 37 | # We set the seed to easier be able to reproduce the result 38 | UQ.quantify(figure_folder="figures_brunel_SR", 39 | filename="brunel_SR", 40 | seed=10) 41 | 42 | 43 | # Change the set of parameters 44 | UQ.parameters = parameters_AI 45 | 46 | # Perform uncertainty quantification on the new parameter set 47 | # and save the data and plots under their own name 48 | # We set the seed to easier be able to reproduce the result 49 | data = UQ.quantify(figure_folder="figures_brunel_AI", 50 | filename="brunel_AI", 51 | seed=10) -------------------------------------------------------------------------------- /examples/coffee_cup/uq_coffee_class.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp # To create distributions 3 | import numpy as np # For the time array 4 | from scipy.integrate import odeint # To integrate our equation 5 | 6 | 7 | # Create the coffee cup model 8 | class CoffeeCup(un.Model): 9 | # Add labels to the model by calling the constructor of the parent un.Model 10 | def __init__(self): 11 | super(CoffeeCup, self).__init__(labels=["Time (s)", "Temperature (C)"]) 12 | 13 | 14 | # Define the run method 15 | def run(self, kappa, T_env): 16 | # Initial temperature and time array 17 | time = np.linspace(0, 200, 150) # Minutes 18 | T_0 = 95 # Celsius 19 | 20 | # The equation describing the model 21 | def f(T, time, kappa, T_env): 22 | return -kappa*(T - T_env) 23 | 24 | # Solving the equation by integration 25 | temperature = odeint(f, T_0, time, args=(kappa, T_env))[:, 0] 26 | 27 | # Return time and model output 28 | return time, temperature 29 | 30 | 31 | # Initialize the model 32 | model = CoffeeCup() 33 | 34 | # Create the distributions 35 | kappa_dist = cp.Uniform(0.025, 0.075) 36 | T_env_dist = cp.Uniform(15, 25) 37 | 38 | # Define the parameters dictionary 39 | parameters = {"kappa": kappa_dist, "T_env": T_env_dist} 40 | 41 | # Set up the uncertainty quantification 42 | UQ = un.UncertaintyQuantification(model=model, parameters=parameters) 43 | 44 | # Perform the uncertainty quantification using 45 | # polynomial chaos with point collocation (by default) 46 | # We set the seed to easier be able to reproduce the result 47 | data = UQ.quantify(seed=10) -------------------------------------------------------------------------------- /examples/coffee_cup/uq_coffee_function.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp # To create distributions 3 | import numpy as np # For the time array 4 | from scipy.integrate import odeint # To integrate our equation 5 | 6 | 7 | # Create the coffee cup model function 8 | def coffee_cup(kappa, T_env): 9 | # Initial temperature and time array 10 | time = np.linspace(0, 200, 150) # Minutes 11 | T_0 = 95 # Celsius 12 | 13 | # The equation describing the model 14 | def f(T, time, kappa, T_env): 15 | return -kappa*(T - T_env) 16 | 17 | # Solving the equation by integration 18 | temperature = odeint(f, T_0, time, args=(kappa, T_env))[:, 0] 19 | 20 | # Return time and model output 21 | return time, temperature 22 | 23 | 24 | # Create a model from the coffee_cup function and add labels 25 | model = un.Model(run=coffee_cup, labels=["Time (min)", "Temperature (C)"]) 26 | 27 | # Create the distributions 28 | kappa_dist = cp.Uniform(0.025, 0.075) 29 | T_env_dist = cp.Uniform(15, 25) 30 | 31 | # Define the parameter dictionary 32 | parameters = {"kappa": kappa_dist, "T_env": T_env_dist} 33 | 34 | # Set up the uncertainty quantification 35 | UQ = un.UncertaintyQuantification(model=model, parameters=parameters) 36 | 37 | # Perform the uncertainty quantification using 38 | # polynomial chaos with point collocation (by default) 39 | # We set the seed to easier be able to reproduce the result 40 | data = UQ.quantify(seed=10) -------------------------------------------------------------------------------- /examples/coffee_cup_dependent/uq_coffee_dependent_class.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import numpy as np 3 | from scipy.integrate import odeint 4 | import chaospy as cp 5 | 6 | 7 | # Create the coffee cup model 8 | class CoffeeCupDependent(un.Model): 9 | def __init__(self): 10 | # Add labels to the model by calling the constructor of the parent un.Model 11 | super(CoffeeCupDependent, self).__init__(labels=["Time (s)", "Temperature (C)"]) 12 | 13 | 14 | # Define the run function 15 | def run(self, kappa_hat, T_env, alpha): 16 | # Initial temperature and time 17 | time = np.linspace(0, 200, 150) # Minutes 18 | T_0 = 95 # Celsius 19 | 20 | # The equation describing the model 21 | def f(T, time, alpha, kappa_hat, T_env): 22 | return -alpha*kappa_hat*(T - T_env) 23 | 24 | # Solving the equation by integration. 25 | values = odeint(f, T_0, time, args=(alpha, kappa_hat, T_env))[:, 0] 26 | 27 | # Return time and model results 28 | return time, values 29 | 30 | 31 | # Initialize the model 32 | model = CoffeeCupDependent() 33 | 34 | # Create the distributions 35 | T_env_dist = cp.Uniform(15, 25) 36 | alpha_dist = cp.Uniform(0.5, 1.5) 37 | kappa_hat_dist = cp.Uniform(0.025, 0.075)/alpha_dist 38 | 39 | # Define the parameters dictionary 40 | parameters = {"alpha": alpha_dist, 41 | "kappa_hat": kappa_hat_dist, 42 | "T_env": T_env_dist} 43 | 44 | # We can use the parameters dictionary directly 45 | # when we set up the uncertainty quantification 46 | UQ = un.UncertaintyQuantification(model=model, parameters=parameters) 47 | 48 | # Perform the uncertainty quantification, 49 | # which automatically use the Rosenblatt transformation 50 | # We set the seed to easier be able to reproduce the result 51 | data = UQ.quantify(seed=10) 52 | -------------------------------------------------------------------------------- /examples/coffee_cup_dependent/uq_coffee_dependent_function.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp 3 | import numpy as np 4 | from scipy.integrate import odeint 5 | 6 | 7 | # Create the coffee cup model function 8 | def coffee_cup_dependent(kappa_hat, T_env, alpha): 9 | # Initial temperature and time 10 | time = np.linspace(0, 200, 150) # Minutes 11 | T_0 = 95 # Celsius 12 | 13 | # The equation describing the model 14 | def f(T, time, alpha, kappa_hat, T_env): 15 | return -alpha*kappa_hat*(T - T_env) 16 | 17 | # Solving the equation by integration. 18 | temperature = odeint(f, T_0, time, args=(alpha, kappa_hat, T_env))[:, 0] 19 | 20 | # Return time and model results 21 | return time, temperature 22 | 23 | 24 | # Create a model from the coffee_cup_dependent function and add labels 25 | model = un.Model(coffee_cup_dependent, labels=["Time (s)", "Temperature (C)"]) 26 | 27 | # Create the distributions 28 | T_env_dist = cp.Uniform(15, 25) 29 | alpha_dist = cp.Uniform(0.5, 1.5) 30 | kappa_hat_dist = cp.Uniform(0.025, 0.075)/alpha_dist 31 | 32 | # Define the parameters dictionary 33 | parameters = {"alpha": alpha_dist, 34 | "kappa_hat": kappa_hat_dist, 35 | "T_env": T_env_dist} 36 | 37 | # We can use the parameters dictionary directly 38 | # when we set up the uncertainty quantification 39 | UQ = un.UncertaintyQuantification(model=model, parameters=parameters) 40 | 41 | # Perform the uncertainty quantification, 42 | # which automatically use the Rosenblatt transformation 43 | # We set the seed to easier be able to reproduce the result 44 | data = UQ.quantify(seed=10) 45 | -------------------------------------------------------------------------------- /examples/hodgkin_huxley/uq_hodgkin_huxley.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp 3 | 4 | from hodgkin_huxley import HodgkinHuxley 5 | 6 | # Define a parameter list 7 | parameter_list = [["V_rest", -65, None], 8 | ["Cm", 1, cp.Uniform(0.8, 1.5)], 9 | ["gbar_Na", 120, cp.Uniform(80, 160)], 10 | ["gbar_K", 36, cp.Uniform(26, 49)], 11 | ["gbar_L", 0.3, cp.Uniform(0.13, 0.5)], 12 | ["E_Na", 50, cp.Uniform(30, 54)], 13 | ["E_K", -77, cp.Uniform(-74, -79)], 14 | ["E_l", -50.613, cp.Uniform(-61, -43)]] 15 | 16 | # Create the parameters using that parameter list 17 | parameters = un.Parameters(parameter_list) 18 | 19 | # Set all parameters to have a uniform distribution 20 | # within a 50% interval around their fixed value 21 | parameters.set_all_distributions(un.uniform(0.5)) 22 | 23 | # Initialize the model 24 | model = HodgkinHuxley() 25 | 26 | # Initialize features 27 | features = un.SpikingFeatures() 28 | 29 | # Perform the uncertainty quantification 30 | UQ = un.UncertaintyQuantification(model=model, 31 | parameters=parameters, 32 | features=features) 33 | data = UQ.quantify() 34 | -------------------------------------------------------------------------------- /examples/interneuron/halnes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/halnes.pdf -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/Cad.mod: -------------------------------------------------------------------------------- 1 | TITLE decay of internal calcium concentration 2 | : 3 | : Simple extrusion mechanism for internal calium dynamics 4 | : 5 | : Written by Alain Destexhe, Salk Institute, Nov 12, 1992 6 | : Modified by Geir Halnes, Norwegian Life Science University of Life Sciences, June 2011 7 | 8 | 9 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 10 | 11 | NEURON { 12 | SUFFIX Cad 13 | USEION Ca READ iCa, Cai WRITE Cai VALENCE 2 14 | RANGE Cainf,taur,k 15 | } 16 | 17 | UNITS { 18 | (molar) = (1/liter) : moles do not appear in units 19 | (mM) = (millimolar) 20 | (um) = (micron) 21 | (mA) = (milliamp) 22 | (msM) = (ms mM) 23 | } 24 | 25 | 26 | PARAMETER { 27 | depth = .1(um) : depth of shell 28 | taur = 50 (ms) : Zhu et al. used 2 decay terms w/ taus 80ms and 150ms. 1 term 50 ms gives similar decay. 29 | Cainf = 5e-5 (mM) : Basal Ca-level 30 | Cainit = 5e-5 (mM) : Initial Ca-level 31 | k = 0.0155458135 (mmol/C cm) : Phenomenological constant, estimated to give reasonable intracellular calcium concentration 32 | } 33 | 34 | 35 | STATE { 36 | Cai (mM) <1e-8> : to have tolerance of .01nM 37 | } 38 | 39 | 40 | INITIAL { 41 | Cai = Cainit 42 | } 43 | 44 | 45 | ASSIGNED { 46 | iCa (mA/cm2) 47 | drive_channel (mM/ms) 48 | drive_pump (mM/ms) 49 | } 50 | 51 | 52 | BREAKPOINT { 53 | SOLVE state METHOD cnexp 54 | } 55 | 56 | DERIVATIVE state { 57 | drive_channel = - k * iCa 58 | if (drive_channel<=0.) { drive_channel = 0. }: cannot pump inward 59 | Cai' = drive_channel +(Cainf-Cai)/taur 60 | } 61 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/INmodel.hoc: -------------------------------------------------------------------------------- 1 | // dLGN interneuron model 2 | // Geir Halnes, Norwegian University of Life Sciences, June 2011 3 | 4 | load_file("nrngui.hoc") 5 | cvode_active(1) 6 | 7 | load_file("091008A2.hoc") // uses Heggelund morphoplogy 8 | xopen("fixnseg.hoc") 9 | objref stim, hold 10 | 11 | dt = 0.1 12 | celsius = 36.0 13 | actdends = 1 14 | 15 | load_file("Parameters1.hoc") 16 | //load_file("Parameters2.hoc") 17 | 18 | 19 | // Channel distribution (ratio: g_dend/g_soma) 20 | nadendfac = 0.1 21 | ihdendfac = 1 22 | ldendfac = 0.25 23 | iahpdendfac = 0.1 24 | itinc = 2.39/60 25 | icaninc = itinc 26 | 27 | // Insert channels: 28 | forall {insert pas e_pas=Vrest g_pas=1/Rm Ra=rall cm=cap} 29 | forall { 30 | insert iar ghbar_iar=ghbar*ihdendfac 31 | insert Cad 32 | insert ical 33 | insert it2 34 | insert iahp 35 | insert hh2 ena=50 ek=-90 36 | insert ican 37 | } 38 | 39 | 40 | // Initialize 41 | proc init() { 42 | access soma 43 | forall {v=Vrest e_pas=Epas} 44 | forall {insert pas e_pas=Epas g_pas=1/Rm Ra=rall cm=cap} 45 | 46 | forall { 47 | gnabar_hh2 = gna*nadendfac vtraubNa_hh2 = nash 48 | gkbar_hh2 = 0.005 vtraubK_hh2 = kdrsh 49 | pcabar_ical = gcal*ldendfac 50 | gkbar_iahp = gahp*iahpdendfac 51 | ghbar_iar = ghbar*ihdendfac 52 | gcabar_it2 = gcat*(1 + itinc*distance(1))*actdends 53 | gbar_ican = gcanbar*(1 + itinc*distance(1))*actdends 54 | } 55 | 56 | soma { 57 | gnabar_hh2 = gna vtraubNa_hh2 = nash 58 | gkbar_hh2 = gkdr vtraubK_hh2 = kdrsh 59 | gcabar_it2 = gcat 60 | pcabar_ical = gcal 61 | gkbar_iahp = gahp 62 | ghbar_iar = ghbar 63 | gbar_ican = gcanbar 64 | } 65 | 66 | finitialize(Vrest) 67 | fcurrent() 68 | forall {taur_Cad = catau} // Calcium decay needs to know the the volume it enters 69 | cvode.re_init() 70 | } 71 | 72 | access soma 73 | freq=50 74 | geom_nseg() 75 | tot=0 76 | forall {tot=tot+nseg} 77 | distance() 78 | print "total # of segments (50Hz): ",tot 79 | 80 | stim= new IClamp(.5) 81 | stim.del=1000 82 | stim.dur=900 83 | stim.amp=0.055 84 | 85 | hold= new IClamp(.5) 86 | hold.del=0 87 | hold.dur=3000 88 | hold.amp=0.0 89 | 90 | 91 | 92 | ///////////////////////////////////////////////////////// 93 | // SESSIONS, FIGURES AND PANELS: 94 | load_file("INmodel.ses") 95 | PlotShape[0].exec_menu("Shape Plot") 96 | PlotShape[0].show(0) -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/INmodel.ses: -------------------------------------------------------------------------------- 1 | {load_file("nrngui.hoc")} 2 | objectvar save_window_, rvp_ 3 | objectvar scene_vector_[4] 4 | objectvar ocbox_, ocbox_list_, scene_, scene_list_ 5 | {ocbox_list_ = new List() scene_list_ = new List()} 6 | {pwman_place(0,0,0)} 7 | { 8 | xpanel("RunControl", 0) 9 | v_init = -65 10 | xvalue("Init","v_init", 1,"stdinit()", 1, 1 ) 11 | xbutton("Init & Run","run()") 12 | xbutton("Stop","stoprun=1") 13 | runStopAt = 5 14 | xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 ) 15 | runStopIn = 1 16 | xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 ) 17 | xbutton("Single Step","steprun()") 18 | t = 3000 19 | xvalue("t","t", 2 ) 20 | tstop = 3000 21 | xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 ) 22 | dt = 1e-08 23 | xvalue("dt","dt", 1,"setdt()", 0, 1 ) 24 | steps_per_ms = 40 25 | xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 ) 26 | screen_update_invl = 0.05 27 | xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 ) 28 | realtime = 8.7 29 | xvalue("Real Time","realtime", 0,"", 0, 1 ) 30 | xpanel(1290,30) 31 | } 32 | { 33 | xpanel("IClamp[0] at soma(0.5)", 0) 34 | xlabel("IClamp[0] at soma(0.5)") 35 | stim.del = 1000 36 | xvalue("del","stim.del", 1,"", 0, 1 ) 37 | stim.dur = 900 38 | xvalue("dur","stim.dur", 1,"", 0, 1 ) 39 | stim.amp = 0.055 40 | xvalue("amp","stim.amp", 1,"", 0, 1 ) 41 | stim.i = 0 42 | xvalue("i","stim.i", 0,"", 0, 1 ) 43 | xpanel(1302,474) 44 | } 45 | { 46 | save_window_ = new Graph(0) 47 | save_window_.size(0,3000,-80,40) 48 | scene_vector_[2] = save_window_ 49 | {save_window_.view(0, -80, 3000, 120, 858, 384, 300.6, 200.8)} 50 | graphList[0].append(save_window_) 51 | save_window_.save_name("graphList[0].") 52 | save_window_.addexpr("v(.5)", 1, 1, 0.8, 0.9, 2) 53 | } 54 | { 55 | save_window_ = new PlotShape(0) 56 | save_window_.size(-366.324,200.488,-277.361,289.734) 57 | save_window_.variable("v") 58 | scene_vector_[3] = save_window_ 59 | {save_window_.view(-366.324, -277.361, 566.812, 567.095, 972, 30, 200.7, 200.8)} 60 | fast_flush_list.append(save_window_) 61 | save_window_.save_name("fast_flush_list.") 62 | } 63 | objectvar scene_vector_[1] 64 | {doNotify()} 65 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/Ican.mod: -------------------------------------------------------------------------------- 1 | TITLE Slow Ca-dependent cation current 2 | : 3 | : Ca++ dependent nonspecific cation current ICAN 4 | : Differential equations 5 | : 6 | : This file was taken the study of Zhu et al.: Neuroscience 91, 1445-1460, 1999, 7 | : where kinetics were based on Partridge & Swandulla, TINS 11: 69-72, 1988 8 | 9 | : Modified by Geir Halnes, Norwegian University of Life Sciences, June 2011 10 | : (using only 1 of the two calcium pools applied by Zhu et al. 99) 11 | 12 | 13 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 14 | 15 | NEURON { 16 | SUFFIX ican 17 | USEION other WRITE iother VALENCE 1 18 | USEION Ca READ Cai VALENCE 2 19 | RANGE gbar, i, g 20 | GLOBAL m_inf, tau_m, beta, cac, taumin, erev, x 21 | } 22 | 23 | 24 | UNITS { 25 | (mA) = (milliamp) 26 | (mV) = (millivolt) 27 | (molar) = (1/liter) 28 | (mM) = (millimolar) 29 | } 30 | 31 | 32 | PARAMETER { 33 | v (mV) 34 | celsius = 36 (degC) 35 | erev = 10 (mV) 36 | Cai = .00005 (mM) : initial [Ca]i = 50 nM 37 | gbar = 1e-5 (mho/cm2) 38 | beta = 0.003 39 | cac = 1.1e-4 (mM) : middle point of activation fct 40 | taumin = 0.1 (ms) : minimal value of time constant 41 | x = 8 42 | } 43 | 44 | 45 | STATE { 46 | m 47 | } 48 | 49 | INITIAL { 50 | : activation kinetics are assumed to be at 22 deg. C 51 | : Q10 is assumed to be 3 52 | : 53 | VERBATIM 54 | Cai = _ion_Cai; 55 | ENDVERBATIM 56 | 57 | tadj = 3.0 ^ ((celsius-22.0)/10) 58 | evaluate_fct(v,Cai) 59 | m = m_inf 60 | } 61 | 62 | ASSIGNED { 63 | i (mA/cm2) 64 | iother (mA/cm2) 65 | g (mho/cm2) 66 | m_inf 67 | tau_m (ms) 68 | tadj 69 | } 70 | 71 | BREAKPOINT { 72 | SOLVE states METHOD cnexp 73 | g = gbar * m*m 74 | i = g * (v - erev) 75 | iother = i 76 | } 77 | 78 | DERIVATIVE states { 79 | evaluate_fct(v,Cai) 80 | m' = (m_inf - m) / tau_m 81 | } 82 | 83 | UNITSOFF 84 | 85 | PROCEDURE evaluate_fct(v(mV),Cai(mM)) { LOCAL alpha 86 | alpha = beta * (Cai/cac)^x 87 | tau_m = 1 / (alpha + beta) / tadj 88 | m_inf = alpha / (alpha + beta) 89 | if(tau_m < taumin) { tau_m = taumin } : min value of time cst 90 | } 91 | UNITSON 92 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/Parameters1.hoc: -------------------------------------------------------------------------------- 1 | // dLGN interneuron model 2 | // PARAMETERIZATION P1 3 | // Geir Halnes, Norwegian University of Life Sciences, June 2011 4 | 5 | // From fitting of passive properties: 6 | rall = 113 //most people find something like this 7 | cap = 1.1 8 | Rm = 22000 9 | Vrest = -63 10 | Epas = -67 11 | 12 | // Channel densities & shifts (for additional channels see May_dends.hoc) 13 | gna = 0.09 14 | nash = - 52.6 15 | gkdr = 0.37 16 | kdrsh = -51.2 17 | gahp = 6.4e-5 18 | gcat=1.17e-5 19 | gcal=0.0009 20 | ghbar=0.00011 21 | catau = 50 22 | gcanbar = 2e-8 -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/Parameters2.hoc: -------------------------------------------------------------------------------- 1 | // dLGN interneuron model 2 | // PARAMETERIZATION P2 3 | // Geir Halnes, Norwegian University of Life Sciences, June 2011 4 | 5 | 6 | // From fitting of passive properties: 7 | rall = 113 //most people find something like this 8 | cap = 1.1 9 | Rm = 45000 10 | Vrest = -69 11 | Epas = -71.6 12 | 13 | // Channel densities & shifts 14 | gna = 0.09 15 | nash = - 50.3 16 | gkdr = 0.5 17 | kdrsh = -48 18 | gahp = 0.00013 19 | gcat=8.5e-6 20 | gcal=0.0013 21 | ghbar=5e-6 22 | catau = 50 23 | gcanbar = 1e-7 -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/fixnseg.hoc: -------------------------------------------------------------------------------- 1 | /* Sets nseg in each section to an odd value 2 | so that its segments are no longer than 3 | d_lambda x the AC length constant 4 | at frequency freq in that section. 5 | 6 | Be sure to specify your own Ra and cm before calling geom_nseg() 7 | 8 | To understand why this works, 9 | and the advantages of using an odd value for nseg, 10 | see Hines, M.L. and Carnevale, N.T. 11 | NEURON: a tool for neuroscientists. 12 | The Neuroscientist 7:123-135, 2001. 13 | */ 14 | 15 | // these are reasonable values for most models 16 | freq = 100 // Hz, frequency at which AC length constant will be computed 17 | d_lambda = 0.1 18 | 19 | func lambda_f() { local i, x1, x2, d1, d2, lam 20 | if (n3d() < 2) { 21 | return 1e5*sqrt(diam/(4*PI*$1*Ra*cm)) 22 | } 23 | // above was too inaccurate with large variation in 3d diameter 24 | // so now we use all 3-d points to get a better approximate lambda 25 | x1 = arc3d(0) 26 | d1 = diam3d(0) 27 | lam = 0 28 | for i=1, n3d()-1 { 29 | x2 = arc3d(i) 30 | d2 = diam3d(i) 31 | lam += (x2 - x1)/sqrt(d1 + d2) 32 | x1 = x2 d1 = d2 33 | } 34 | // length of the section in units of lambda 35 | lam *= sqrt(2) * 1e-5*sqrt(4*PI*$1*Ra*cm) 36 | 37 | return L/lam 38 | } 39 | 40 | proc geom_nseg() { 41 | soma area(0.5) // make sure diam reflects 3d points 42 | forall { nseg = int((L/(d_lambda*lambda_f(freq))+0.9)/2)*2 + 1 } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/iahp.mod: -------------------------------------------------------------------------------- 1 | TITLE Medium duration Ca-dependent potassium current 2 | : 3 | : Ca++ dependent K+ current IC responsible for medium duration AHP 4 | : 5 | : Original file written by Alain Destexhe, Salk Institute, Nov 3, 1992 6 | : Modified by Geir Halnes, Norwegian University of Life Sciences, Mar 13, 2011 7 | 8 | 9 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 10 | 11 | NEURON { 12 | SUFFIX iahp 13 | USEION k READ ek WRITE ik VALENCE 1 14 | USEION Ca READ Cai VALENCE 2 15 | RANGE gkbar, g, minf, taum 16 | GLOBAL beta, cac, m_inf, tau_m, x 17 | } 18 | 19 | 20 | UNITS { 21 | (mA) = (milliamp) 22 | (mV) = (millivolt) 23 | (molar) = (1/liter) 24 | (mM) = (millimolar) 25 | } 26 | 27 | 28 | PARAMETER { 29 | v (mV) 30 | ek = -90 (mV) 31 | celsius = 36 (degC) 32 | Cai = 5e-5 (mM) : Initial [Ca]i = 50 nM (Cai is simulated by separate mod-file) 33 | gkbar = 1.3e-4 (mho/cm2) : Conductance (modified from hoc-file) 34 | beta = 0.02 (1/ms) : Backward rate constant 35 | cac = 4.3478e-4(mM) : Middle point of m_inf fcn 36 | taumin = 1 (ms) : Minimal value of the time cst 37 | x = 2 : Binding cites 38 | } 39 | 40 | 41 | 42 | 43 | STATE { 44 | m 45 | } 46 | 47 | 48 | ASSIGNED { 49 | ik (mA/cm2) 50 | g (mho/cm2) 51 | m_inf 52 | tau_m (ms) 53 | minf 54 | taum 55 | tadj 56 | } 57 | 58 | 59 | BREAKPOINT { 60 | SOLVE states METHOD cnexp 61 | minf = m_inf 62 | taum = tau_m 63 | g = gkbar*m*m 64 | ik = g * (v - ek) 65 | } 66 | 67 | DERIVATIVE states { 68 | evaluate_fct(v,Cai) 69 | m' = (m_inf - m) / tau_m 70 | } 71 | 72 | 73 | UNITSOFF 74 | INITIAL { 75 | : activation kinetics are assumed to be at 22 deg. C 76 | : Q10 is assumed to be 3 77 | 78 | VERBATIM 79 | Cai = _ion_Cai; 80 | ENDVERBATIM 81 | 82 | tadj = 3 ^ ((celsius-22.0)/10) 83 | evaluate_fct(v,Cai) 84 | m = m_inf 85 | minf = m_inf 86 | taum = tau_m 87 | } 88 | 89 | PROCEDURE evaluate_fct(v(mV),Cai(mM)) { LOCAL car, tcar 90 | car = (Cai/cac)^x 91 | m_inf = car / ( 1 + car ) 92 | tau_m = 1 / beta / (1 + car) / tadj 93 | if(tau_m < taumin) { tau_m = taumin } : min value of time cst 94 | } 95 | 96 | UNITSON 97 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/iar.mod: -------------------------------------------------------------------------------- 1 | TITLE anomalous rectifier channel 2 | : 3 | : Anomalous Rectifier Ih - cation (Na/K) channel for geniculate interneurons 4 | : Differential equations 5 | : 6 | : Written by Jun Zhu, Univ. Wisconsin, Jan 1996 7 | : Modified by Geir Halnes, Norwegian University of Life Sciences, June 2011 8 | : Fitted to data from mice dLGN interneurons. 9 | 10 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 11 | 12 | NEURON { 13 | SUFFIX iar 14 | USEION other WRITE iother VALENCE 1 15 | RANGE ghbar, iother 16 | GLOBAL h_inf, tauh, erev, stp, shift 17 | } 18 | 19 | 20 | UNITS { 21 | (molar) = (1/liter) 22 | (mM) = (millimolar) 23 | (mA) = (milliamp) 24 | (mV) = (millivolt) 25 | (msM) = (ms mM) 26 | } 27 | 28 | 29 | PARAMETER { 30 | v (mV) 31 | erev = -44 (mV) 32 | celsius = 36 (degC) 33 | ghbar = 1.1e-5 (mho/cm2) : Set from hoc-file 34 | shift = 0 (mV) 35 | 36 | : Kinetics fitted to new data from mice dLGN interneurons. 37 | : Halnes et al. 2011 38 | stp = 10 39 | a0 = 96 40 | a1 = 250 41 | a2 = 30.7 42 | a3 = 78.8 43 | a4 = 5.78 44 | } 45 | 46 | 47 | STATE { 48 | h 49 | } 50 | 51 | 52 | ASSIGNED { 53 | i (mA/cm2) 54 | iother (mA/cm2) 55 | h_inf 56 | tauh (ms) 57 | tadj 58 | } 59 | 60 | 61 | BREAKPOINT { 62 | SOLVE state METHOD cnexp 63 | iother = ghbar * h * (v - erev) 64 | } 65 | 66 | DERIVATIVE state { 67 | evaluate_fct(v) 68 | h' = (h_inf - h) / tauh 69 | } 70 | UNITSOFF 71 | 72 | INITIAL { 73 | evaluate_fct(v) 74 | h = h_inf 75 | } 76 | 77 | 78 | PROCEDURE evaluate_fct(v (mV)) { 79 | h_inf = 1 / ( 1 + exp((v+shift+a0)/stp) ) 80 | tauh = exp((v+shift+a1)/a2) / ( 1 + exp((v+shift+a3)/a4)) 81 | } 82 | 83 | 84 | 85 | UNITSON 86 | 87 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/mosinit.hoc: -------------------------------------------------------------------------------- 1 | load_file("nrngui.hoc") 2 | 3 | load_file("INmodel.hoc") 4 | 5 | xpanel("select parameterization") 6 | xbutton("Figure 4 A1, 4th trace. P1:MP = -63","runP1MP()") 7 | xbutton("Figure 4 B1. P1:HP = -57","runP1HP()") 8 | xbutton("Figure 4 A2, 4th trace. P2:MP = -69","runP2MP()") 9 | xbutton("Figure 4 B2. P1:MP = -58","runP2HP()") 10 | xpanel() 11 | 12 | 13 | proc runP1MP() { 14 | {print "Using Parameterization 1, Resting pot. -63mV"} 15 | {xopen("Parameters1.hoc")} 16 | {access soma} 17 | {Vrest = -63} 18 | {IClamp[0].amp = 0.055} 19 | {IClamp[1].amp = 0} 20 | } 21 | 22 | proc runP1HP() { 23 | {print "Using Parameterization 1, Holding pot. -57mV obtained by constant current injection (22pA)"} 24 | {xopen("Parameters1.hoc")} 25 | {access soma} 26 | {Vrest = -57} 27 | {IClamp[0].amp = -0.15} 28 | {IClamp[1].amp = 0.022} 29 | } 30 | 31 | proc runP2MP() { 32 | {print "Using Parameterization 2, Resting pot. -69mV"} 33 | {xopen("Parameters2.hoc")} 34 | {access soma} 35 | {Vrest = -69} 36 | {IClamp[0].amp = 0.04} 37 | {IClamp[1].amp = 0} 38 | } 39 | 40 | proc runP2HP() { 41 | {print "Using Parameterization 2, Holding pot. -58mV obtained by constant current injection (12pA)"} 42 | {xopen("Parameters2.hoc")} 43 | {access soma} 44 | {Vrest = -58} 45 | {IClamp[0].amp = -0.15} 46 | {IClamp[1].amp = 0.012} 47 | } 48 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/screenshot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/screenshot1.jpg -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/screenshot2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/screenshot2.jpg -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/screenshot3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/screenshot3.jpg -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/screenshot4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/screenshot4.jpg -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/Cad.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/Cad.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/HH_traub.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/HH_traub.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/Ican.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/Ican.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/iahp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/iahp.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/iar.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/iar.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/ical.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/ical.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/it2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/it2.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.la: -------------------------------------------------------------------------------- 1 | ../libnrnmech.la -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.lai: -------------------------------------------------------------------------------- 1 | # libnrnmech.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libnrnmech.so.0' 9 | 10 | # Names of this library. 11 | library_names='libnrnmech.so.0.0.0 libnrnmech.so.0 libnrnmech.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/home/docker/simulators/x86_64/lib /home/docker/simulators/x86_64/lib/libnrnoc.la /home/docker/simulators/x86_64/lib/liboc.la -lX11 /home/docker/simulators/x86_64/lib/libmemacs.la /home/docker/simulators/x86_64/lib/libnrnmpi.la /home/docker/simulators/x86_64/lib/libscopmath.la /home/docker/simulators/x86_64/lib/libsparse13.la -lreadline -lncurses /home/docker/simulators/x86_64/lib/libnrniv.la /home/docker/simulators/x86_64/lib/libivoc.la /home/docker/simulators/x86_64/lib/libneuron_gnu.la /home/docker/simulators/x86_64/lib/libmeschach.la /home/docker/simulators/x86_64/lib/libsundials.la /home/docker/simulators/x86_64/lib/libivos.la -lm -ldl' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libnrnmech. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/docker/simulators/x86_64/lib' 42 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.so: -------------------------------------------------------------------------------- 1 | libnrnmech.so.0.0.0 -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.so.0: -------------------------------------------------------------------------------- 1 | libnrnmech.so.0.0.0 -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.so.0.0.0 -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/.libs/mod_func.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/interneuron/interneuron_model/x86_64/.libs/mod_func.o -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/Cad.lo: -------------------------------------------------------------------------------- 1 | # Cad.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/Cad.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/Cad.mod: -------------------------------------------------------------------------------- 1 | .././Cad.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/HH_traub.lo: -------------------------------------------------------------------------------- 1 | # HH_traub.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/HH_traub.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/HH_traub.mod: -------------------------------------------------------------------------------- 1 | .././HH_traub.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/Ican.lo: -------------------------------------------------------------------------------- 1 | # Ican.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/Ican.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/Ican.mod: -------------------------------------------------------------------------------- 1 | .././Ican.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/iahp.lo: -------------------------------------------------------------------------------- 1 | # iahp.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/iahp.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/iahp.mod: -------------------------------------------------------------------------------- 1 | .././iahp.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/iar.lo: -------------------------------------------------------------------------------- 1 | # iar.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/iar.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/iar.mod: -------------------------------------------------------------------------------- 1 | .././iar.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/ical.lo: -------------------------------------------------------------------------------- 1 | # ical.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/ical.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/ical.mod: -------------------------------------------------------------------------------- 1 | .././ical.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/it2.lo: -------------------------------------------------------------------------------- 1 | # it2.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/it2.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/it2.mod: -------------------------------------------------------------------------------- 1 | .././it2.mod -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/libnrnmech.la: -------------------------------------------------------------------------------- 1 | # libnrnmech.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libnrnmech.so.0' 9 | 10 | # Names of this library. 11 | library_names='libnrnmech.so.0.0.0 libnrnmech.so.0 libnrnmech.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/home/docker/simulators/x86_64/lib /home/docker/simulators/x86_64/lib/libnrnoc.la /home/docker/simulators/x86_64/lib/liboc.la -lX11 /home/docker/simulators/x86_64/lib/libmemacs.la /home/docker/simulators/x86_64/lib/libnrnmpi.la /home/docker/simulators/x86_64/lib/libscopmath.la /home/docker/simulators/x86_64/lib/libsparse13.la -lreadline -lncurses /home/docker/simulators/x86_64/lib/libnrniv.la /home/docker/simulators/x86_64/lib/libivoc.la /home/docker/simulators/x86_64/lib/libneuron_gnu.la /home/docker/simulators/x86_64/lib/libmeschach.la /home/docker/simulators/x86_64/lib/libsundials.la /home/docker/simulators/x86_64/lib/libivos.la -lm -ldl' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libnrnmech. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=no 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/docker/simulators/x86_64/lib' 42 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/mod_func.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hocdec.h" 3 | extern int nrnmpi_myid; 4 | extern int nrn_nobanner_; 5 | 6 | extern void _Cad_reg(void); 7 | extern void _HH_traub_reg(void); 8 | extern void _Ican_reg(void); 9 | extern void _iahp_reg(void); 10 | extern void _iar_reg(void); 11 | extern void _ical_reg(void); 12 | extern void _it2_reg(void); 13 | 14 | void modl_reg(){ 15 | if (!nrn_nobanner_) if (nrnmpi_myid < 1) { 16 | fprintf(stderr, "Additional mechanisms from files\n"); 17 | 18 | fprintf(stderr," ./Cad.mod"); 19 | fprintf(stderr," ./HH_traub.mod"); 20 | fprintf(stderr," ./Ican.mod"); 21 | fprintf(stderr," ./iahp.mod"); 22 | fprintf(stderr," ./iar.mod"); 23 | fprintf(stderr," ./ical.mod"); 24 | fprintf(stderr," ./it2.mod"); 25 | fprintf(stderr, "\n"); 26 | } 27 | _Cad_reg(); 28 | _HH_traub_reg(); 29 | _Ican_reg(); 30 | _iahp_reg(); 31 | _iar_reg(); 32 | _ical_reg(); 33 | _it2_reg(); 34 | } 35 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/mod_func.lo: -------------------------------------------------------------------------------- 1 | # mod_func.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/mod_func.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /examples/interneuron/interneuron_model/x86_64/special: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if test "x${NRNHOME}" = "x" ; then 3 | NRNHOME="/home/docker/simulators" 4 | fi 5 | if test "x${NRNBIN}" = "x" ; then 6 | NRNBIN="/home/docker/simulators/x86_64/bin/" 7 | fi 8 | if test "" = "yes" ; then 9 | NRNIV="${NRNBIN}nrniv.app/Contents/MacOS/nrniv" 10 | else 11 | NRNIV="${NRNBIN}nrniv" 12 | fi 13 | "${NRNIV}" -dll "/home/docker/uncertainpy/examples/interneuron/interneuron_model/x86_64/.libs/libnrnmech.so" "$@" 14 | -------------------------------------------------------------------------------- /examples/interneuron/modelDB_link.txt: -------------------------------------------------------------------------------- 1 | https://senselab.med.yale.edu/modeldb/ShowModel.cshtml?model=140249 2 | -------------------------------------------------------------------------------- /examples/interneuron/uq_interneuron.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | 3 | # Define a parameter list 4 | parameters= {"gna": 0.09, 5 | "gkdr": 0.37, 6 | "gcat": 1.17e-5, 7 | "gcal": 0.0009, 8 | "ghbar": 0.00011, 9 | "gahp": 6.4e-5, 10 | "gcanbar": 2e-8} 11 | 12 | # Create the parameters 13 | parameters = un.Parameters(parameters) 14 | 15 | # Set all parameters to have a uniform distribution 16 | # within a 20% interval around their fixed value 17 | parameters.set_all_distributions(un.uniform(0.2)) 18 | 19 | # Initialize the features 20 | features = un.SpikingFeatures(features_to_run="all") 21 | 22 | # Initialize the model with the start and end time of the stimulus 23 | model = un.NeuronModel(path="interneuron_model/", interpolate=True, 24 | stimulus_start=1000, stimulus_end=1900) 25 | 26 | # Perform the uncertainty quantification 27 | UQ = un.UncertaintyQuantification(model, 28 | parameters=parameters, 29 | features=features) 30 | # We set the seed to easier be able to reproduce the result 31 | data = UQ.quantify(seed=10) 32 | -------------------------------------------------------------------------------- /examples/izhikevich/izhikevich.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/izhikevich/izhikevich.pdf -------------------------------------------------------------------------------- /examples/izhikevich/izhikevich_class.py: -------------------------------------------------------------------------------- 1 | from uncertainpy import Model 2 | 3 | import numpy as np 4 | 5 | class Izhikevich(Model): 6 | def __init__(self): 7 | Model.__init__(self, 8 | labels=["Time (ms)", "Voltage (mV)"]) 9 | 10 | time_end = 100 11 | self.dt = 0.25 12 | self.v0 = -70 13 | self.time = np.linspace(0, time_end, time_end/self.dt) 14 | 15 | self.info = {"stimulus_start": 10, 16 | "stimulus_end": time_end} 17 | 18 | def I(self, time): 19 | if time >= 10: 20 | return 10 21 | else: 22 | return 0 23 | 24 | 25 | def run(self, a=0.02, b=0.2, c=-50, d=2): 26 | 27 | def f(u_in, time): 28 | v, u = u_in 29 | 30 | dvdt = 0.04*v**2 + 5*v + 140 - u + self.I(time) 31 | dudt = a*(b*v - u) 32 | 33 | return np.array([dvdt, dudt]) 34 | 35 | u = np.zeros((len(self.time), 2)) 36 | u[0, 0] = self.v0 37 | u[0, 1] = b*self.v0 38 | 39 | 40 | values = [self.v0]*len(self.time) 41 | 42 | # Runge Kutta 4 43 | dt2 = self.dt/2.0 44 | for n in range(len(self.time) - 1): 45 | K1 = self.dt*f(u[n], self.time[n]) 46 | K2 = self.dt*f(u[n] + 0.5*K1, self.time[n] + dt2) 47 | K3 = self.dt*f(u[n] + 0.5*K2, self.time[n] + dt2) 48 | K4 = self.dt*f(u[n] + K3, self.time[n] + self.dt) 49 | u_new = u[n] + (1/6.0)*(K1 + 2*K2 + 2*K3 + K4) 50 | 51 | if u_new[0] > 30: 52 | u_new[0] = c 53 | u_new[1] += d 54 | values[n] = 30 55 | else: 56 | values[n] = u_new[0] 57 | 58 | u[n+1] = u_new 59 | 60 | return self.time, np.array(values), self.info 61 | -------------------------------------------------------------------------------- /examples/izhikevich/izhikevich_function.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def izhikevich(a=0.02, b=0.2, c=-50, d=2): 5 | time_end = 100 6 | dt = 0.25 7 | v0 = -70 8 | 9 | time = np.linspace(0, time_end, int(time_end/dt)) 10 | 11 | def I(time): 12 | if time >= 10: 13 | return 10 14 | else: 15 | return 0 16 | 17 | info = {"stimulus_start": 10, 18 | "stimulus_end": time_end} 19 | 20 | def f(u_in, time): 21 | v, u = u_in 22 | 23 | dvdt = 0.04*v**2 + 5*v + 140 - u + I(time) 24 | dudt = a*(b*v - u) 25 | 26 | return np.array([dvdt, dudt]) 27 | 28 | u = np.zeros((len(time), 2)) 29 | u[0, 0] = v0 30 | u[0, 1] = b*v0 31 | 32 | values = [v0]*len(time) 33 | 34 | # Runge Kutta 4 35 | dt2 = dt/2.0 36 | for n in range(len(time) - 1): 37 | K1 = dt*f(u[n], time[n]) 38 | K2 = dt*f(u[n] + 0.5*K1, time[n] + dt2) 39 | K3 = dt*f(u[n] + 0.5*K2, time[n] + dt2) 40 | K4 = dt*f(u[n] + K3, time[n] + dt) 41 | u_new = u[n] + (1/6.0)*(K1 + 2*K2 + 2*K3 + K4) 42 | 43 | if u_new[0] > 30: 44 | u_new[0] = c 45 | u_new[1] += d 46 | values[n] = 30 47 | else: 48 | values[n] = u_new[0] 49 | 50 | u[n+1] = u_new 51 | 52 | return time, np.array(values), info 53 | -------------------------------------------------------------------------------- /examples/izhikevich/uq_izhikevich_class.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | from izhikevich_class import Izhikevich 3 | 4 | # Define a parameter list 5 | parameter_list = [["a", 0.02, None], 6 | ["b", 0.2, None], 7 | ["c", -65, None], 8 | ["d", 8, None]] 9 | 10 | # Create the parameters 11 | parameters = un.Parameters(parameter_list) 12 | 13 | # Set all parameters to have a uniform distribution 14 | # within a 50% interval around their fixed value 15 | parameters.set_all_distributions(un.uniform(0.5)) 16 | 17 | # Initialize the model 18 | model = Izhikevich() 19 | features = un.SpikingFeatures(features_to_run="all") 20 | 21 | # Perform the uncertainty quantification 22 | UQ = un.UncertaintyQuantification(model=model, 23 | parameters=parameters, 24 | features=features) 25 | data = UQ.quantify() 26 | -------------------------------------------------------------------------------- /examples/izhikevich/uq_izhikevich_function.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | from izhikevich_function import izhikevich 3 | 4 | # Define a parameter list 5 | parameter_list = [["a", 0.02, None], 6 | ["b", 0.2, None], 7 | ["c", -65, None], 8 | ["d", 8, None]] 9 | 10 | # Create the parameters 11 | parameters = un.Parameters(parameter_list) 12 | 13 | # Set all parameters to have a uniform distribution 14 | # within a 50% interval around their fixed value 15 | parameters.set_all_distributions(un.uniform(0.5)) 16 | 17 | # Create a model from coffee_cup function and add labels 18 | model = un.Model(izhikevich, 19 | labels=["Time (ms)", "Voltage (mV)"]) 20 | 21 | # Initialize features 22 | features = un.SpikingFeatures(features_to_run="all") 23 | 24 | # Perform the uncertainty quantification 25 | UQ = un.UncertaintyQuantification(model=model, 26 | parameters=parameters, 27 | features=features) 28 | data = UQ.quantify() 29 | -------------------------------------------------------------------------------- /examples/mc_vc_pc/valderrama.py: -------------------------------------------------------------------------------- 1 | ../valderrama/valderrama.py -------------------------------------------------------------------------------- /examples/valderrama/uq_valderrama.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | import chaospy as cp 3 | 4 | from valderrama import valderrama 5 | 6 | # Initialize the model 7 | model = un.Model(run=valderrama, 8 | labels=["Time (ms)", "Membrane potential (mV)"]) 9 | 10 | # Define a parameter dictionary 11 | parameters = {"V_0": -10, 12 | "C_m": 1, 13 | "gbar_Na": 120, 14 | "gbar_K": 36, 15 | "gbar_L": 0.3, 16 | "m_0": 0.0011, 17 | "n_0": 0.0003, 18 | "h_0": 0.9998, 19 | "E_Na": 112, 20 | "E_K": -12, 21 | "E_l": 10.613} 22 | 23 | # Create the parameters 24 | parameters = un.Parameters(parameters) 25 | 26 | # Set all parameters to have a uniform distribution 27 | # within a 20% interval around their fixed value 28 | parameters.set_all_distributions(un.uniform(0.2)) 29 | 30 | # Perform the uncertainty quantification 31 | UQ = un.UncertaintyQuantification(model, 32 | parameters=parameters) 33 | # We set the seed to easier be able to reproduce the result 34 | data = UQ.quantify(seed=10) 35 | -------------------------------------------------------------------------------- /examples/valderrama/valderrama.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/examples/valderrama/valderrama.pdf -------------------------------------------------------------------------------- /examples/valderrama/valderrama.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | 3 | import numpy as np 4 | from scipy.integrate import odeint 5 | 6 | 7 | # External stimulus 8 | def I(time): 9 | return 140 # micro A/cm**2 10 | 11 | 12 | def valderrama(V_0=-10, 13 | C_m=1, 14 | gbar_Na=120, 15 | gbar_K=36, 16 | gbar_L=0.3, 17 | E_Na=112, 18 | E_K=-12, 19 | E_l=10.613, 20 | m_0=0.0011, 21 | n_0=0.0003, 22 | h_0=0.9998): 23 | 24 | # Setup time 25 | end_time = 15 # ms 26 | dt = 0.025 # ms 27 | time = np.arange(0, end_time + dt, dt) 28 | 29 | # K channel 30 | def alpha_n(V): 31 | return 0.01*(10 - V)/(np.exp((10 - V)/10.) - 1) 32 | 33 | 34 | def beta_n(V): 35 | return 0.125*np.exp(-V/80.) 36 | 37 | def n_f(n, V): 38 | return alpha_n(V)*(1 - n) - beta_n(V)*n 39 | 40 | def n_inf(V): 41 | return alpha_n(V)/(alpha_n(V) + beta_n(V)) 42 | 43 | 44 | # Na channel (activating) 45 | def alpha_m(V): 46 | return 0.1*(25 - V)/(np.exp((25 - V)/10.) - 1) 47 | 48 | def beta_m(V): 49 | return 4*np.exp(-V/18.) 50 | 51 | def m_f(m, V): 52 | return alpha_m(V)*(1 - m) - beta_m(V)*m 53 | 54 | def m_inf(V): 55 | return alpha_m(V)/(alpha_m(V) + beta_m(V)) 56 | 57 | 58 | # Na channel (inactivating) 59 | def alpha_h(V): 60 | return 0.07*np.exp(-V/20.) 61 | 62 | def beta_h(V): 63 | return 1/(np.exp((30 - V)/10.) + 1) 64 | 65 | def h_f(h, V): 66 | return alpha_h(V)*(1 - h) - beta_h(V)*h 67 | 68 | def h_inf(V): 69 | return alpha_h(V)/(alpha_h(V) + beta_h(V)) 70 | 71 | 72 | def dXdt(X, t): 73 | V, h, m, n = X 74 | 75 | g_Na = gbar_Na*(m**3)*h 76 | g_K = gbar_K*(n**4) 77 | g_l = gbar_L 78 | 79 | dmdt = m_f(m, V) 80 | dhdt = h_f(h, V) 81 | dndt = n_f(n, V) 82 | 83 | dVdt = (I(t) - g_Na*(V - E_Na) - g_K*(V - E_K) - g_l*(V - E_l))/C_m 84 | 85 | return [dVdt, dhdt, dmdt, dndt] 86 | 87 | 88 | initial_conditions = [V_0, h_0, m_0, n_0] 89 | 90 | X = odeint(dXdt, initial_conditions, time) 91 | values = X[:, 0] 92 | 93 | # Only return from 5 seconds onwards, as in the Valderrama paper 94 | values = values[time > 5] 95 | time = time[time > 5] 96 | 97 | # Add info needed by certain spiking features and efel features 98 | info = {"stimulus_start": time[0], "stimulus_end": time[-1]} 99 | 100 | return time, values, info -------------------------------------------------------------------------------- /logo/hh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/logo/hh.pdf -------------------------------------------------------------------------------- /logo/hh_illustration.py: -------------------------------------------------------------------------------- 1 | import uncertainpy as un 2 | 3 | import matplotlib.pyplot as plt 4 | from HodgkinHuxley import HodgkinHuxley 5 | from prettyplot import prettyPlot, set_xlabel, set_ylabel 6 | 7 | # plt.xkcd() 8 | 9 | scale1 = 1.6 10 | scale2 = 0.4 11 | linewidth = 10 12 | 13 | model = HodgkinHuxley() 14 | # parameters_1 = {"gbar_Na": 120, 15 | # "gbar_K": 36, 16 | # "gbar_l": 0.5} 17 | 18 | 19 | # time, V, info = model.run(**parameters_1) 20 | # prettyPlot(time, V, nr_colors=3, style="seaborn-white", linewidth=linewidth) 21 | 22 | # parameters_2 = {"gbar_Na": scale1*120, 23 | # "gbar_K": scale1*36, 24 | # "gbar_l": 0.5} 25 | 26 | # time, V, info = model.run(**parameters_2) 27 | # prettyPlot(time, V, new_figure=False, nr_colors=3, style="seaborn-white", linewidth=linewidth) 28 | 29 | 30 | 31 | # parameters_3 = {"gbar_Na": scale2*120, 32 | # "gbar_K": scale2*36, 33 | # "gbar_l": scale2*0.3} 34 | 35 | # time, V, info = model.run(**parameters_3) 36 | # prettyPlot(time, V, new_figure=False, nr_colors=3, style="seaborn-white", linewidth=linewidth) 37 | 38 | # set_xlabel("Time (ms)") 39 | # set_ylabel("Voltage (mv)") 40 | # plt.xlim([10, 55]) 41 | # plt.savefig("hh.pdf") 42 | # plt.show() 43 | 44 | 45 | # Define a parameter list 46 | parameter_list = [["gbar_Na", 120], 47 | ["gbar_K", 36], 48 | ["gbar_l", 0.3]] 49 | 50 | # Create the parameters 51 | parameters = un.Parameters(parameter_list) 52 | 53 | # Set all parameters to have a uniform distribution 54 | # within a 50% interval around their fixed value 55 | parameters.set_all_distributions(un.uniform(0.25)) 56 | 57 | # Initialize the model 58 | model = HodgkinHuxley() 59 | 60 | # Perform the uncertainty quantification 61 | UQ = un.UncertaintyQuantification(model=model, 62 | parameters=parameters) 63 | UQ.quantify(plot=None, nr_pc_mc_samples=10**2) 64 | 65 | 66 | time = UQ.data["HodgkinHuxley"].time 67 | mean = UQ.data["HodgkinHuxley"].mean 68 | percentile_95 = UQ.data["HodgkinHuxley"].percentile_95 69 | percentile_5 = UQ.data["HodgkinHuxley"].percentile_5 70 | 71 | ax = prettyPlot(time, mean, color=0, palette="deep", linewidth=2) 72 | 73 | ax.fill_between(time, 74 | percentile_5, 75 | percentile_95, 76 | color=(0.45, 0.65, 0.9)) 77 | 78 | plt.savefig("hh_prediction.pdf") 79 | plt.show() -------------------------------------------------------------------------------- /logo/uncertainpy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/logo/uncertainpy.pdf -------------------------------------------------------------------------------- /logo/uncertainpy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/logo/uncertainpy.png -------------------------------------------------------------------------------- /logo/uncertainpy_small.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/logo/uncertainpy_small.pdf -------------------------------------------------------------------------------- /logo/uncertainpy_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/logo/uncertainpy_small.png -------------------------------------------------------------------------------- /run_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | docker build -t python -f .docker/Dockerfile_python . 5 | docker build -t uncertainpy -f .docker/Dockerfile_uncertainpy . 6 | docker run -i -v $(pwd):/home/docker/uncertainpy -t uncertainpy bash -------------------------------------------------------------------------------- /run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | cd uncertainpy 5 | coverage run test.py all-no-simulators 6 | bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /src/uncertainpy/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Uncertainpy is a python toolbox for uncertainty quantification and sensitivity 3 | analysis tailored towards computational neuroscience. 4 | 5 | Uncertainpy is model independent and treats the model as a black box where the 6 | model can be left unchanged. Uncertainpy implements both quasi-Monte Carlo 7 | methods and polynomial chaos expansions using either point collocation or the 8 | pseudo-spectral method. Both of the polynomial chaos expansion methods have 9 | support for the rosenblatt transformation to handle dependent input parameters. 10 | 11 | Uncertainpy is feature based, i.e., if applicable, it recognizes and calculates 12 | the uncertainty in features of the model, as well as the model itself. 13 | Examples of features in neuroscience can be spike timing and the action 14 | potential shape. 15 | 16 | Uncertainpy is tailored towards neuroscience models, and comes with several 17 | common neuroscience models and features built in, but new models and features can 18 | easily be implemented. It should be noted that while Uncertainpy is tailored 19 | towards neuroscience, the implemented methods are general, and Uncertainpy can 20 | be used for many other types of models and features within other fields. 21 | """ 22 | 23 | from __future__ import absolute_import, division, print_function, unicode_literals 24 | 25 | from .data import Data, DataFeature 26 | from .distribution import uniform, normal 27 | from .parameters import Parameter, Parameters 28 | from .uncertainty import UncertaintyQuantification 29 | 30 | from .plotting import PlotUncertainty 31 | from .features import Features, NetworkFeatures, EfelFeatures, GeneralNetworkFeatures 32 | from .features import GeneralSpikingFeatures, SpikingFeatures 33 | from .models import Model, NeuronModel, NestModel 34 | from ._version import __version__ -------------------------------------------------------------------------------- /src/uncertainpy/_version.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.2.3" -------------------------------------------------------------------------------- /src/uncertainpy/core/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function, unicode_literals 2 | 3 | """ 4 | This module contains the classes that are responsible for running the model and 5 | calculate features of the model, both in parallel (``RunModel`` and 6 | ``Parallel``), as well as the class for performing the uncertainty calculations 7 | (``UncertaintyCalculations``. It also contains the base classes that are 8 | responsible for setting and updating parameters, models and features across 9 | classes (``Base`` and ``ParameterBase``). 10 | """ 11 | 12 | from .base import Base, ParameterBase 13 | from .run_model import RunModel 14 | from .uncertainty_calculations import UncertaintyCalculations 15 | from .parallel import Parallel 16 | 17 | __all__ = ["Parallel", 18 | "Base", 19 | "ParameterBase", 20 | "RunModel", 21 | "UncertaintyCalculations"] -------------------------------------------------------------------------------- /src/uncertainpy/distribution.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function, unicode_literals 2 | 3 | import chaospy as cp 4 | 5 | """ 6 | Functions (that work as closures) used to set the distribution of a 7 | parameter to an `interval` around their original value. 8 | """ 9 | 10 | def uniform(interval): 11 | """ 12 | A closure that creates a function that takes a `parameter` as input and 13 | returns a uniform distribution with `interval` around `parameter`. 14 | 15 | Parameters 16 | ---------- 17 | interval : int, float 18 | The interval of the uniform distribution around `parameter`. 19 | 20 | Returns 21 | ------- 22 | distribution : function 23 | A function that takes `parameter` as input and returns a 24 | uniform distribution with `interval` around this `parameter`. 25 | 26 | 27 | Notes 28 | ----- 29 | This function ultimately calculates: 30 | 31 | .. code-block:: Python 32 | 33 | cp.Uniform(parameter - abs(interval/2.*parameter), 34 | parameter + abs(interval/2.*parameter)). 35 | """ 36 | def distribution(parameter): 37 | if parameter == 0: 38 | raise ValueError("Creating a percentage distribution around 0 does not work") 39 | 40 | return cp.Uniform(parameter - abs(interval/2.*parameter), 41 | parameter + abs(interval/2.*parameter)) 42 | return distribution 43 | 44 | 45 | def normal(interval): 46 | """ 47 | A closure that creates a function that takes a `parameter` as input and 48 | returns a Gaussian distribution with standard deviation `interval*parameter` 49 | around `parameter`. 50 | 51 | Parameters 52 | ---------- 53 | interval : int, float 54 | The interval of the standard deviation ``interval*parameter`` for the 55 | Gaussian distribution. 56 | 57 | Returns 58 | ------- 59 | distribution : function 60 | A function that takes a `parameter` as input and 61 | returns a Gaussian distribution standard deviation ``interval*parameter``. 62 | 63 | Notes 64 | ----- 65 | This function ultimately calculates: 66 | 67 | .. code-block:: Python 68 | 69 | cp.Normal(parameter, abs(interval*parameter)) 70 | """ 71 | def distribution(parameter): 72 | if parameter == 0: 73 | raise ValueError("Creating a percentage distribution around 0 does not work") 74 | 75 | return cp.Normal(parameter, abs(interval*parameter)) 76 | return distribution 77 | -------------------------------------------------------------------------------- /src/uncertainpy/features/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function, unicode_literals 2 | 3 | """ 4 | A module for calculating features of the model output. The main class is 5 | ``Features``. This class does not implement any specific models itself, but 6 | contain all common methods used by features. Then there are two general classes 7 | for spiking (``GeneralSpikingFeatures``) and network features 8 | (``GeneralNetworkFeatures``) that implements the common methods used the two 9 | classes of features respectively. Lastly there are three classes that implements 10 | actual features; ``SpikingFeatures`` and ``EfelFeatures`` for models with 11 | spiking behavour (for example models of neurons that contain voltage traces), 12 | and ``NetworkFeatures`` for network models that return spiketrains. 13 | """ 14 | 15 | __all__ = ["Features", 16 | "GeneralSpikingFeatures", 17 | "SpikingFeatures", 18 | "Spike", 19 | "Spikes", 20 | "NetworkFeatures", 21 | "GeneralNetworkFeatures", 22 | "EfelFeatures"] 23 | 24 | from .features import Features 25 | from .general_spiking_features import GeneralSpikingFeatures 26 | from .spiking_features import SpikingFeatures 27 | from .spikes import Spike, Spikes 28 | from .network_features import NetworkFeatures 29 | from .general_network_features import GeneralNetworkFeatures 30 | from .efel_features import EfelFeatures -------------------------------------------------------------------------------- /src/uncertainpy/models/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function, unicode_literals 2 | 3 | """ 4 | A module that contains different model classes. The main class is ``Model``, 5 | for storing the model to perform uncertainty quantification and sensitivity 6 | analysis on. This class does not implement any specific models itself, but 7 | contain all common methods used by models. Then there are two class for specific 8 | simulators: NEURON (``NeuronModel``) and Nest (``NestModel``). 9 | """ 10 | 11 | __all__ = ["Model", "NeuronModel", "NestModel"] 12 | 13 | from .model import Model 14 | from .neuron_model import NeuronModel 15 | from .nest_model import NestModel 16 | 17 | -------------------------------------------------------------------------------- /src/uncertainpy/plotting/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function, unicode_literals 2 | 3 | """ 4 | This module contains ``PlotUncertainpy``, which creates plot of the data from 5 | the uncertainty quantification and sensitivity analysis. ``PlotUncertainpy`` 6 | plots the results for all zero and one dimensional statistical metrics, and some 7 | of the two dimensional statistical metrics It is intended as a quick way to get 8 | an overview of the data, and does not create publication ready plots. Custom 9 | plots of the data can easily be created by retrieving the results from the 10 | ``Data`` class. 11 | """ 12 | 13 | __all__ = ["PlotUncertainty"] 14 | 15 | from .plot_uncertainty import PlotUncertainty -------------------------------------------------------------------------------- /src/uncertainpy/plotting/prettyplot/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | -------------------------------------------------------------------------------- /src/uncertainpy/plotting/prettyplot/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/simetenn/prettyplot 8 | branch = master 9 | commit = f0fcccaf5bd2b99faa0261c4e729de1d4a4b3b24 10 | parent = 1c27559d28ac0f7e37732adfbb13883a86d326e9 11 | cmdver = 0.3.1 12 | -------------------------------------------------------------------------------- /src/uncertainpy/plotting/prettyplot/README.md: -------------------------------------------------------------------------------- 1 | [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 2 | 3 | # prettyplot 4 | Pretty plotting in Python 5 | 6 | ## Requirements 7 | numpy, matplotlib, seaborn, scipy and pandas 8 | 9 | ``` 10 | pip install numpy matplotlib seaborn 11 | ``` 12 | -------------------------------------------------------------------------------- /src/uncertainpy/plotting/prettyplot/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import absolute_import, division, print_function, unicode_literals 3 | 4 | 5 | from .prettyplot import set_figuresize 6 | from .prettyplot import set_legendstyle 7 | from .prettyplot import set_font 8 | from .prettyplot import set_linestyle 9 | from .prettyplot import set_tickstyle 10 | from .prettyplot import reset_style 11 | from .prettyplot import set_grid 12 | from .prettyplot import spines_color 13 | from .prettyplot import remove_ticks 14 | from .prettyplot import get_colormap_tableu20 15 | from .prettyplot import get_colormap 16 | from .prettyplot import get_current_colormap 17 | from .prettyplot import set_title 18 | from .prettyplot import set_xlabel 19 | from .prettyplot import set_axestyle 20 | from .prettyplot import set_ylabel 21 | from .prettyplot import set_style 22 | from .prettyplot import create_figure 23 | from .prettyplot import set_legend 24 | from .prettyplot import prettyPlot 25 | from .prettyplot import prettyBar 26 | 27 | from .prettyplot import axis_grey 28 | from .prettyplot import titlesize 29 | from .prettyplot import fontsize 30 | from .prettyplot import labelsize 31 | from .prettyplot import figsize 32 | from .prettyplot import ticksize 33 | from .prettyplot import ticklabelsize 34 | from .prettyplot import linewidth 35 | from .prettyplot import markersize 36 | from .prettyplot import markeredgewidth -------------------------------------------------------------------------------- /src/uncertainpy/plotting/prettyplot/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | try: 4 | from setuptools import setup, find_packages 5 | 6 | except ImportError: 7 | print("Setuptools is needed to install all dependencies") 8 | print("Setuptools: https://pypi.python.org/pypi/setuptools") 9 | 10 | 11 | name = "prettyplot" 12 | version = "0.9" 13 | 14 | prettyplot_req = ["seaborn", "matplotlib", "numpy"] 15 | 16 | setup(name=name, 17 | url="https://github.com/simetenn/prettyplot", 18 | author="Simen Tennøe", 19 | description='Pretty plotting', 20 | platforms='linux', 21 | packages=find_packages(), 22 | install_requires=prettyplot_req 23 | ) 24 | -------------------------------------------------------------------------------- /src/uncertainpy/plotting/prettyplot/test_prettyplot.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import unittest 4 | 5 | 6 | from prettyplot import prettyPlot, prettyBar 7 | 8 | # TODO compare all plots to an existing plot 9 | 10 | class TestPrettyPlot(unittest.TestCase): 11 | def setUp(self): 12 | self.time= np.arange(0, 10) 13 | self.values = np.arange(0, 10) + 1 14 | 15 | 16 | def test_prettyPlotX(self): 17 | 18 | prettyPlot(self.values) 19 | 20 | plt.close() 21 | 22 | 23 | def test_prettyPlotXY(self): 24 | prettyPlot(self.time, self.values, 25 | xlabel="xlabel", 26 | ylabel="ylabel", 27 | title="Plot") 28 | plt.savefig("test.png") 29 | plt.close() 30 | 31 | 32 | def test_prettyPlotXYColor(self): 33 | prettyPlot(self.time, self.values) 34 | plt.close() 35 | 36 | 37 | def test_prettyPlotFalseNewFigure(self): 38 | prettyPlot(self.values) 39 | prettyPlot(self.time, self.values, new_figure=False) 40 | plt.close() 41 | 42 | 43 | def test_prettyPlotFalseNewFigure2(self): 44 | prettyPlot(self.time, self.values, new_figure=False) 45 | plt.close() 46 | 47 | 48 | class TestPrettyBar(unittest.TestCase): 49 | def setUp(self): 50 | self.values = np.arange(2, 7) 51 | self.error = np.arange(2, 7)*0.1 52 | self.labels = ["1", "2", "3", "4", "5"] 53 | 54 | 55 | def test_PrettyBar(self): 56 | prettyBar(self.values) 57 | plt.close() 58 | 59 | 60 | def test_PrettyBarError(self): 61 | prettyBar(self.values, self.error) 62 | plt.close() 63 | 64 | 65 | def test_PrettyBarLabels(self): 66 | prettyBar(self.values, xlabels=self.labels) 67 | plt.close() 68 | 69 | 70 | def test_prettyBarFalseNewFigure(self): 71 | prettyBar(self.values) 72 | prettyBar(self.values, new_figure=False) 73 | plt.close() 74 | 75 | 76 | def test_prettyPlotFalseNewFigure2(self): 77 | prettyBar(self.values, new_figure=False) 78 | plt.close() 79 | 80 | 81 | if __name__ == "__main__": 82 | unittest.main() 83 | -------------------------------------------------------------------------------- /src/uncertainpy/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function, unicode_literals 2 | 3 | """ 4 | Small utility functions for various purposes. 5 | """ 6 | 7 | __all__ = ["lengths", "none_to_nan", "contains_nan", "is_regular", 8 | "MyFormatter", "TqdmLoggingHandler", "MultiprocessLoggingHandler", 9 | "setup_module_logger", "setup_logger", 10 | "has_handlers", "add_file_handler", "add_screen_handler"] 11 | 12 | from .logger import setup_module_logger, setup_logger 13 | from .logger import has_handlers, add_file_handler, add_screen_handler 14 | from .logger import MyFormatter, TqdmLoggingHandler, MultiprocessLoggingHandler 15 | from .utility import lengths, none_to_nan, contains_nan 16 | from .utility import is_regular, set_nan 17 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | from .test_distribution import TestDistribution 2 | from .test_features import TestFeatures, TestGeneralSpikingFeatures, TestSpikingFeatures 3 | from .test_features import TestNetworkFeatures, TestTestingFeatures, TestGeneralNetworkFeatures 4 | from .test_features import TestEfelFeatures 5 | from .test_logger import TestLogger 6 | 7 | from .test_models import TestModel, TestHodgkinHuxleyModel, TestCoffeeCupModel, TestNestModel 8 | from .test_models import TestIzhikevichModel, TestTestingModel0d, TestTestingModel1d 9 | from .test_models import TestTestingModel2d, TestNeuronModel 10 | 11 | from .test_parameters import TestParameter, TestParameters 12 | from .test_plot_uncertainty import TestPlotUncertainpy 13 | from .test_spike import TestSpike 14 | from .test_spikes import TestSpikes 15 | from .test_uncertainty import TestUncertainty 16 | from .test_data import TestData, TestDataFeature 17 | from .test_run_model import TestRunModel 18 | from .test_uncertainty_calculations import TestUncertaintyCalculations 19 | from .test_parallel import TestParallel 20 | from .test_examples import TestExamples 21 | from .test_base import TestBase, TestParameterBase 22 | from .test_utility import TestLengths, TestNoneToNan, TestContainsNoneOrNan 23 | from .test_utility import TestIsRegular, TestSetNan -------------------------------------------------------------------------------- /tests/data/TestingModel0d.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel0d.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_MC.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_MC.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_MC_a.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_MC_a.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_MC_b.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_MC_b.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_Rosenblatt.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_Rosenblatt.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_Rosenblatt_spectral.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_Rosenblatt_spectral.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_a.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_a.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_b.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_b.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel1d_spectral.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel1d_spectral.h5 -------------------------------------------------------------------------------- /tests/data/TestingModel2d.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/TestingModel2d.h5 -------------------------------------------------------------------------------- /tests/data/U_test.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/U_test.npy -------------------------------------------------------------------------------- /tests/data/UncertaintyCalculations_a.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/UncertaintyCalculations_a.h5 -------------------------------------------------------------------------------- /tests/data/UncertaintyCalculations_b.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/UncertaintyCalculations_b.h5 -------------------------------------------------------------------------------- /tests/data/V_noise.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/V_noise.npy -------------------------------------------------------------------------------- /tests/data/V_spike.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/V_spike.npy -------------------------------------------------------------------------------- /tests/data/example_hoc.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.056442 5 | Rm_axosomatic = 23823.061083 6 | forsec axosomatic_list cm = 2.298892 7 | spinefactor = 0.860211 8 | soma gbar_nat = 284.546493 9 | soma gbar_kfast = 50.802287 10 | soma gbar_kslow = 361.584735 11 | soma gbar_nap = 0.873246 12 | 13 | soma test = 0.873246 14 | soma test = -0.873246 15 | soma test=0.8 16 | soma test = 0.873246 17 | soma test = .873246 18 | soma something test = -23 19 | test = 0.873246 20 | soma test = 2. 21 | soma test = . 22 | soma test = 2.7e-10 23 | soma test = 2.7E10 24 | 25 | 26 | soma gbar_km = 7.123963 27 | basal gbar_ih = 15.709707 28 | tuft gbar_ih = 17.694744 29 | tuft gbar_nat = 6.558244 30 | decay_kfast = 58.520995 31 | decay_kslow = 42.208044 32 | hillock gbar_nat = 8810.657100 33 | iseg gbar_nat = 13490.395442 34 | iseg vshift2_nat = -9.802976 35 | 36 | Ra_apical = 454.05939784 37 | apical Ra = Ra_apical 38 | tuft gbar_sca = 3.67649485 39 | tuft vshift_sca = 7.4783781 40 | tuft gbar_kca = 9.75672674 41 | 42 | 43 | recalculate_passive_properties() 44 | recalculate_channel_densities() 45 | -------------------------------------------------------------------------------- /tests/data/example_hoc_control.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.056442 5 | Rm_axosomatic = 23823.061083 6 | forsec axosomatic_list cm = 2.298892 7 | spinefactor = 0.860211 8 | soma gbar_nat = 284.546493 9 | soma gbar_kfast = 50.802287 10 | soma gbar_kslow = 361.584735 11 | soma gbar_nap = 0.873246 12 | 13 | soma test = 12 14 | soma test = 12 15 | soma test=12 16 | soma test = 12 17 | soma test = 12 18 | soma something test = 12 19 | test = 12 20 | soma test = 12 21 | soma test = . 22 | soma test = 12 23 | soma test = 12 24 | 25 | 26 | soma gbar_km = 7.123963 27 | basal gbar_ih = 15.709707 28 | tuft gbar_ih = 17.694744 29 | tuft gbar_nat = 6.558244 30 | decay_kfast = 58.520995 31 | decay_kslow = 42.208044 32 | hillock gbar_nat = 8810.657100 33 | iseg gbar_nat = 13490.395442 34 | iseg vshift2_nat = -9.802976 35 | 36 | Ra_apical = 454.05939784 37 | apical Ra = Ra_apical 38 | tuft gbar_sca = 3.67649485 39 | tuft vshift_sca = 7.4783781 40 | tuft gbar_kca = 9.75672674 41 | 42 | 43 | recalculate_passive_properties() 44 | recalculate_channel_densities() 45 | -------------------------------------------------------------------------------- /tests/data/example_hoc_control_parameters.hoc: -------------------------------------------------------------------------------- 1 | load_file("stdrun.hoc") 2 | load_file("../reduced_model.hoc") 3 | 4 | forall e_pas = -83.056442 5 | Rm_axosomatic = 23823.061083 6 | forsec axosomatic_list cm = 2.298892 7 | spinefactor = 0.860211 8 | soma gbar_nat = 10 9 | soma gbar_kfast = 50.802287 10 | soma gbar_kslow = 361.584735 11 | soma gbar_nap = 0.873246 12 | 13 | soma test = 0.873246 14 | soma test = -0.873246 15 | soma test=0.8 16 | soma test = 0.873246 17 | soma test = .873246 18 | soma something test = -23 19 | test = 0.873246 20 | soma test = 2. 21 | soma test = . 22 | soma test = 2.7e-10 23 | soma test = 2.7E10 24 | 25 | 26 | soma gbar_km = 7.123963 27 | basal gbar_ih = 10 28 | tuft gbar_ih = 17.694744 29 | tuft gbar_nat = 6.558244 30 | decay_kfast = 58.520995 31 | decay_kslow = 42.208044 32 | hillock gbar_nat = 8810.657100 33 | iseg gbar_nat = 13490.395442 34 | iseg vshift2_nat = 10 35 | 36 | Ra_apical = 454.05939784 37 | apical Ra = Ra_apical 38 | tuft gbar_sca = 3.67649485 39 | tuft vshift_sca = 7.4783781 40 | tuft gbar_kca = 9.75672674 41 | 42 | 43 | recalculate_passive_properties() 44 | recalculate_channel_densities() 45 | -------------------------------------------------------------------------------- /tests/data/model_function.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/model_function.h5 -------------------------------------------------------------------------------- /tests/data/t_noise.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/t_noise.npy -------------------------------------------------------------------------------- /tests/data/t_spike.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/t_spike.npy -------------------------------------------------------------------------------- /tests/data/t_test.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/t_test.npy -------------------------------------------------------------------------------- /tests/data/test_save_empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/test_save_empty -------------------------------------------------------------------------------- /tests/data/test_save_mock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/test_save_mock -------------------------------------------------------------------------------- /tests/data/test_save_mock_irregular: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/test_save_mock_irregular -------------------------------------------------------------------------------- /tests/data/test_save_mock_missing: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/data/test_save_mock_missing -------------------------------------------------------------------------------- /tests/generate_docker_images.py: -------------------------------------------------------------------------------- 1 | import six 2 | import os 3 | import sys 4 | import subprocess 5 | from uncertainpy.utils import _create_module_logger 6 | 7 | 8 | folder = os.path.dirname(os.path.realpath(__file__)) 9 | docker_test_dir = os.path.join(folder, "figures_docker") 10 | 11 | logger = _create_module_logger("debug") 12 | 13 | 14 | def system(cmds): 15 | """Run system command cmd using subprocess module.""" 16 | if isinstance(cmds, six.string_types): 17 | cmds = [cmds] 18 | 19 | output = None 20 | if isinstance(cmds, (tuple, list)): 21 | for cmd in cmds: 22 | logger.debug(cmd) 23 | 24 | try: 25 | output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) 26 | if output: 27 | logger.info(output.decode('utf-8')) 28 | 29 | 30 | except subprocess.CalledProcessError as e: 31 | if e.returncode != 2: 32 | msg = "Command failed: \n {} \n \n Return code: {} ".format(cmd, e.returncode) 33 | logger.error(msg) 34 | logger.error(e.output.decode("utf-8")) 35 | 36 | sys.exit(1) 37 | 38 | else: 39 | raise TypeError("cmd argument is wrong type") 40 | 41 | return output 42 | 43 | 44 | 45 | def generate_docker_images(): 46 | container_name = "generate_test_plot_container" 47 | image_name = "generate_test_plots" 48 | 49 | 50 | try: 51 | system("docker rm {}".format(container_name)) 52 | except: 53 | pass 54 | 55 | 56 | system("docker build -t {} -f {} ../.".format(image_name, 57 | os.path.join(folder, "../.docker/Dockerfile_python2"))) 58 | system("docker run -v $(pwd):/home/docker/uncertainpy --name='{}' --rm=False {} python tests/generate_test_plots.py".format(container_name, image_name)) 59 | system("docker cp {}:uncertainpy/tests/figures/. {}/.".format(container_name, docker_test_dir)) 60 | system("docker stop {}".format(container_name)) 61 | system("docker rm {}".format(container_name)) 62 | system("docker rmi {}".format(image_name)) 63 | 64 | 65 | 66 | if __name__ == "__main__": 67 | generate_docker_images() 68 | -------------------------------------------------------------------------------- /tests/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .hodgkin_huxley import HodgkinHuxley 2 | from .coffee_cup_class import CoffeeCup 3 | from .izhikevich_function import izhikevich 4 | from .brunel_network_function import brunel_network -------------------------------------------------------------------------------- /tests/models/coffee_cup_class.py: -------------------------------------------------------------------------------- 1 | from uncertainpy import Model 2 | from scipy.integrate import odeint 3 | import numpy as np 4 | 5 | # Create the coffee cup model 6 | class CoffeeCup(Model): 7 | # Add labels to the model by calling the constructor of the parent un.Model 8 | def __init__(self): 9 | super(CoffeeCup, self).__init__(labels=["Time (s)", "Temperature (C)"], 10 | logger_level=None) 11 | 12 | 13 | # Define the run method 14 | def run(self, kappa, T_env): 15 | # Initial temperature and time array 16 | time = np.linspace(0, 200, 150) # Minutes 17 | T_0 = 95 # Celsius 18 | 19 | # The equation describing the model 20 | def f(T, time, kappa, T_env): 21 | return -kappa*(T - T_env) 22 | 23 | # Solving the equation by integration. 24 | temperature = odeint(f, T_0, time, args=(kappa, T_env))[:, 0] 25 | 26 | # Return time and model output 27 | return time, temperature -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/Cad.mod: -------------------------------------------------------------------------------- 1 | TITLE decay of internal calcium concentration 2 | : 3 | : Simple extrusion mechanism for internal calium dynamics 4 | : 5 | : Written by Alain Destexhe, Salk Institute, Nov 12, 1992 6 | : Modified by Geir Halnes, Norwegian Life Science University of Life Sciences, June 2011 7 | 8 | 9 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 10 | 11 | NEURON { 12 | SUFFIX Cad 13 | USEION Ca READ iCa, Cai WRITE Cai VALENCE 2 14 | RANGE Cainf,taur,k 15 | } 16 | 17 | UNITS { 18 | (molar) = (1/liter) : moles do not appear in units 19 | (mM) = (millimolar) 20 | (um) = (micron) 21 | (mA) = (milliamp) 22 | (msM) = (ms mM) 23 | } 24 | 25 | 26 | PARAMETER { 27 | depth = .1(um) : depth of shell 28 | taur = 50 (ms) : Zhu et al. used 2 decay terms w/ taus 80ms and 150ms. 1 term 50 ms gives similar decay. 29 | Cainf = 5e-5 (mM) : Basal Ca-level 30 | Cainit = 5e-5 (mM) : Initial Ca-level 31 | k = 0.0155458135 (mmol/C cm) : Phenomenological constant, estimated to give reasonable intracellular calcium concentration 32 | } 33 | 34 | 35 | STATE { 36 | Cai (mM) <1e-8> : to have tolerance of .01nM 37 | } 38 | 39 | 40 | INITIAL { 41 | Cai = Cainit 42 | } 43 | 44 | 45 | ASSIGNED { 46 | iCa (mA/cm2) 47 | drive_channel (mM/ms) 48 | drive_pump (mM/ms) 49 | } 50 | 51 | 52 | BREAKPOINT { 53 | SOLVE state METHOD cnexp 54 | } 55 | 56 | DERIVATIVE state { 57 | drive_channel = - k * iCa 58 | if (drive_channel<=0.) { drive_channel = 0. }: cannot pump inward 59 | Cai' = drive_channel +(Cainf-Cai)/taur 60 | } 61 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/INmodel.hoc: -------------------------------------------------------------------------------- 1 | // dLGN interneuron model 2 | // Geir Halnes, Norwegian University of Life Sciences, June 2011 3 | 4 | load_file("nrngui.hoc") 5 | cvode_active(1) 6 | 7 | load_file("091008A2.hoc") // uses Heggelund morphoplogy 8 | xopen("fixnseg.hoc") 9 | objref stim, hold 10 | 11 | dt = 0.1 12 | celsius = 36.0 13 | actdends = 1 14 | 15 | load_file("Parameters1.hoc") 16 | //load_file("Parameters2.hoc") 17 | 18 | 19 | // Channel distribution (ratio: g_dend/g_soma) 20 | nadendfac = 0.1 21 | ihdendfac = 1 22 | ldendfac = 0.25 23 | iahpdendfac = 0.1 24 | itinc = 2.39/60 25 | icaninc = itinc 26 | 27 | // Insert channels: 28 | forall {insert pas e_pas=Vrest g_pas=1/Rm Ra=rall cm=cap} 29 | forall { 30 | insert iar ghbar_iar=ghbar*ihdendfac 31 | insert Cad 32 | insert ical 33 | insert it2 34 | insert iahp 35 | insert hh2 ena=50 ek=-90 36 | insert ican 37 | } 38 | 39 | 40 | // Initialize 41 | proc init() { 42 | access soma 43 | forall {v=Vrest e_pas=Epas} 44 | forall {insert pas e_pas=Epas g_pas=1/Rm Ra=rall cm=cap} 45 | 46 | forall { 47 | gnabar_hh2 = gna*nadendfac vtraubNa_hh2 = nash 48 | gkbar_hh2 = 0.005 vtraubK_hh2 = kdrsh 49 | pcabar_ical = gcal*ldendfac 50 | gkbar_iahp = gahp*iahpdendfac 51 | ghbar_iar = ghbar*ihdendfac 52 | gcabar_it2 = gcat*(1 + itinc*distance(1))*actdends 53 | gbar_ican = gcanbar*(1 + itinc*distance(1))*actdends 54 | } 55 | 56 | soma { 57 | gnabar_hh2 = gna vtraubNa_hh2 = nash 58 | gkbar_hh2 = gkdr vtraubK_hh2 = kdrsh 59 | gcabar_it2 = gcat 60 | pcabar_ical = gcal 61 | gkbar_iahp = gahp 62 | ghbar_iar = ghbar 63 | gbar_ican = gcanbar 64 | } 65 | 66 | finitialize(Vrest) 67 | fcurrent() 68 | forall {taur_Cad = catau} // Calcium decay needs to know the the volume it enters 69 | cvode.re_init() 70 | } 71 | 72 | access soma 73 | freq=50 74 | geom_nseg() 75 | tot=0 76 | forall {tot=tot+nseg} 77 | distance() 78 | print "total # of segments (50Hz): ",tot 79 | 80 | stim= new IClamp(.5) 81 | stim.del=1000 82 | stim.dur=900 83 | stim.amp=0.055 84 | 85 | hold= new IClamp(.5) 86 | hold.del=0 87 | hold.dur=3000 88 | hold.amp=0.0 89 | 90 | 91 | 92 | ///////////////////////////////////////////////////////// 93 | // SESSIONS, FIGURES AND PANELS: 94 | load_file("INmodel.ses") 95 | PlotShape[0].exec_menu("Shape Plot") 96 | PlotShape[0].show(0) -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/INmodel.ses: -------------------------------------------------------------------------------- 1 | {load_file("nrngui.hoc")} 2 | objectvar save_window_, rvp_ 3 | objectvar scene_vector_[4] 4 | objectvar ocbox_, ocbox_list_, scene_, scene_list_ 5 | {ocbox_list_ = new List() scene_list_ = new List()} 6 | {pwman_place(0,0,0)} 7 | { 8 | xpanel("RunControl", 0) 9 | v_init = -65 10 | xvalue("Init","v_init", 1,"stdinit()", 1, 1 ) 11 | xbutton("Init & Run","run()") 12 | xbutton("Stop","stoprun=1") 13 | runStopAt = 5 14 | xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 ) 15 | runStopIn = 1 16 | xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 ) 17 | xbutton("Single Step","steprun()") 18 | t = 3000 19 | xvalue("t","t", 2 ) 20 | tstop = 3000 21 | xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 ) 22 | dt = 1e-08 23 | xvalue("dt","dt", 1,"setdt()", 0, 1 ) 24 | steps_per_ms = 40 25 | xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 ) 26 | screen_update_invl = 0.05 27 | xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 ) 28 | realtime = 8.7 29 | xvalue("Real Time","realtime", 0,"", 0, 1 ) 30 | xpanel(1290,30) 31 | } 32 | { 33 | xpanel("IClamp[0] at soma(0.5)", 0) 34 | xlabel("IClamp[0] at soma(0.5)") 35 | stim.del = 1000 36 | xvalue("del","stim.del", 1,"", 0, 1 ) 37 | stim.dur = 900 38 | xvalue("dur","stim.dur", 1,"", 0, 1 ) 39 | stim.amp = 0.055 40 | xvalue("amp","stim.amp", 1,"", 0, 1 ) 41 | stim.i = 0 42 | xvalue("i","stim.i", 0,"", 0, 1 ) 43 | xpanel(1302,474) 44 | } 45 | { 46 | save_window_ = new Graph(0) 47 | save_window_.size(0,3000,-80,40) 48 | scene_vector_[2] = save_window_ 49 | {save_window_.view(0, -80, 3000, 120, 858, 384, 300.6, 200.8)} 50 | graphList[0].append(save_window_) 51 | save_window_.save_name("graphList[0].") 52 | save_window_.addexpr("v(.5)", 1, 1, 0.8, 0.9, 2) 53 | } 54 | { 55 | save_window_ = new PlotShape(0) 56 | save_window_.size(-366.324,200.488,-277.361,289.734) 57 | save_window_.variable("v") 58 | scene_vector_[3] = save_window_ 59 | {save_window_.view(-366.324, -277.361, 566.812, 567.095, 972, 30, 200.7, 200.8)} 60 | fast_flush_list.append(save_window_) 61 | save_window_.save_name("fast_flush_list.") 62 | } 63 | objectvar scene_vector_[1] 64 | {doNotify()} 65 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/Ican.mod: -------------------------------------------------------------------------------- 1 | TITLE Slow Ca-dependent cation current 2 | : 3 | : Ca++ dependent nonspecific cation current ICAN 4 | : Differential equations 5 | : 6 | : This file was taken the study of Zhu et al.: Neuroscience 91, 1445-1460, 1999, 7 | : where kinetics were based on Partridge & Swandulla, TINS 11: 69-72, 1988 8 | 9 | : Modified by Geir Halnes, Norwegian University of Life Sciences, June 2011 10 | : (using only 1 of the two calcium pools applied by Zhu et al. 99) 11 | 12 | 13 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 14 | 15 | NEURON { 16 | SUFFIX ican 17 | USEION other WRITE iother VALENCE 1 18 | USEION Ca READ Cai VALENCE 2 19 | RANGE gbar, i, g 20 | GLOBAL m_inf, tau_m, beta, cac, taumin, erev, x 21 | } 22 | 23 | 24 | UNITS { 25 | (mA) = (milliamp) 26 | (mV) = (millivolt) 27 | (molar) = (1/liter) 28 | (mM) = (millimolar) 29 | } 30 | 31 | 32 | PARAMETER { 33 | v (mV) 34 | celsius = 36 (degC) 35 | erev = 10 (mV) 36 | Cai = .00005 (mM) : initial [Ca]i = 50 nM 37 | gbar = 1e-5 (mho/cm2) 38 | beta = 0.003 39 | cac = 1.1e-4 (mM) : middle point of activation fct 40 | taumin = 0.1 (ms) : minimal value of time constant 41 | x = 8 42 | } 43 | 44 | 45 | STATE { 46 | m 47 | } 48 | 49 | INITIAL { 50 | : activation kinetics are assumed to be at 22 deg. C 51 | : Q10 is assumed to be 3 52 | : 53 | VERBATIM 54 | Cai = _ion_Cai; 55 | ENDVERBATIM 56 | 57 | tadj = 3.0 ^ ((celsius-22.0)/10) 58 | evaluate_fct(v,Cai) 59 | m = m_inf 60 | } 61 | 62 | ASSIGNED { 63 | i (mA/cm2) 64 | iother (mA/cm2) 65 | g (mho/cm2) 66 | m_inf 67 | tau_m (ms) 68 | tadj 69 | } 70 | 71 | BREAKPOINT { 72 | SOLVE states METHOD cnexp 73 | g = gbar * m*m 74 | i = g * (v - erev) 75 | iother = i 76 | } 77 | 78 | DERIVATIVE states { 79 | evaluate_fct(v,Cai) 80 | m' = (m_inf - m) / tau_m 81 | } 82 | 83 | UNITSOFF 84 | 85 | PROCEDURE evaluate_fct(v(mV),Cai(mM)) { LOCAL alpha 86 | alpha = beta * (Cai/cac)^x 87 | tau_m = 1 / (alpha + beta) / tadj 88 | m_inf = alpha / (alpha + beta) 89 | if(tau_m < taumin) { tau_m = taumin } : min value of time cst 90 | } 91 | UNITSON 92 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/Parameters1.hoc: -------------------------------------------------------------------------------- 1 | // dLGN interneuron model 2 | // PARAMETERIZATION P1 3 | // Geir Halnes, Norwegian University of Life Sciences, June 2011 4 | 5 | // From fitting of passive properties: 6 | rall = 113 //most people find something like this 7 | cap = 1.1 8 | Rm = 22000 9 | Vrest = -63 10 | Epas = -67 11 | 12 | // Channel densities & shifts (for additional channels see May_dends.hoc) 13 | gna = 0.09 14 | nash = - 52.6 15 | gkdr = 0.37 16 | kdrsh = -51.2 17 | gahp = 6.4e-5 18 | gcat=1.17e-5 19 | gcal=0.0009 20 | ghbar=0.00011 21 | catau = 50 22 | gcanbar = 2e-8 -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/Parameters2.hoc: -------------------------------------------------------------------------------- 1 | // dLGN interneuron model 2 | // PARAMETERIZATION P2 3 | // Geir Halnes, Norwegian University of Life Sciences, June 2011 4 | 5 | 6 | // From fitting of passive properties: 7 | rall = 113 //most people find something like this 8 | cap = 1.1 9 | Rm = 45000 10 | Vrest = -69 11 | Epas = -71.6 12 | 13 | // Channel densities & shifts 14 | gna = 0.09 15 | nash = - 50.3 16 | gkdr = 0.5 17 | kdrsh = -48 18 | gahp = 0.00013 19 | gcat=8.5e-6 20 | gcal=0.0013 21 | ghbar=5e-6 22 | catau = 50 23 | gcanbar = 1e-7 -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/fixnseg.hoc: -------------------------------------------------------------------------------- 1 | /* Sets nseg in each section to an odd value 2 | so that its segments are no longer than 3 | d_lambda x the AC length constant 4 | at frequency freq in that section. 5 | 6 | Be sure to specify your own Ra and cm before calling geom_nseg() 7 | 8 | To understand why this works, 9 | and the advantages of using an odd value for nseg, 10 | see Hines, M.L. and Carnevale, N.T. 11 | NEURON: a tool for neuroscientists. 12 | The Neuroscientist 7:123-135, 2001. 13 | */ 14 | 15 | // these are reasonable values for most models 16 | freq = 100 // Hz, frequency at which AC length constant will be computed 17 | d_lambda = 0.1 18 | 19 | func lambda_f() { local i, x1, x2, d1, d2, lam 20 | if (n3d() < 2) { 21 | return 1e5*sqrt(diam/(4*PI*$1*Ra*cm)) 22 | } 23 | // above was too inaccurate with large variation in 3d diameter 24 | // so now we use all 3-d points to get a better approximate lambda 25 | x1 = arc3d(0) 26 | d1 = diam3d(0) 27 | lam = 0 28 | for i=1, n3d()-1 { 29 | x2 = arc3d(i) 30 | d2 = diam3d(i) 31 | lam += (x2 - x1)/sqrt(d1 + d2) 32 | x1 = x2 d1 = d2 33 | } 34 | // length of the section in units of lambda 35 | lam *= sqrt(2) * 1e-5*sqrt(4*PI*$1*Ra*cm) 36 | 37 | return L/lam 38 | } 39 | 40 | proc geom_nseg() { 41 | soma area(0.5) // make sure diam reflects 3d points 42 | forall { nseg = int((L/(d_lambda*lambda_f(freq))+0.9)/2)*2 + 1 } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/iahp.mod: -------------------------------------------------------------------------------- 1 | TITLE Medium duration Ca-dependent potassium current 2 | : 3 | : Ca++ dependent K+ current IC responsible for medium duration AHP 4 | : 5 | : Original file written by Alain Destexhe, Salk Institute, Nov 3, 1992 6 | : Modified by Geir Halnes, Norwegian University of Life Sciences, Mar 13, 2011 7 | 8 | 9 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 10 | 11 | NEURON { 12 | SUFFIX iahp 13 | USEION k READ ek WRITE ik VALENCE 1 14 | USEION Ca READ Cai VALENCE 2 15 | RANGE gkbar, g, minf, taum 16 | GLOBAL beta, cac, m_inf, tau_m, x 17 | } 18 | 19 | 20 | UNITS { 21 | (mA) = (milliamp) 22 | (mV) = (millivolt) 23 | (molar) = (1/liter) 24 | (mM) = (millimolar) 25 | } 26 | 27 | 28 | PARAMETER { 29 | v (mV) 30 | ek = -90 (mV) 31 | celsius = 36 (degC) 32 | Cai = 5e-5 (mM) : Initial [Ca]i = 50 nM (Cai is simulated by separate mod-file) 33 | gkbar = 1.3e-4 (mho/cm2) : Conductance (modified from hoc-file) 34 | beta = 0.02 (1/ms) : Backward rate constant 35 | cac = 4.3478e-4(mM) : Middle point of m_inf fcn 36 | taumin = 1 (ms) : Minimal value of the time cst 37 | x = 2 : Binding cites 38 | } 39 | 40 | 41 | 42 | 43 | STATE { 44 | m 45 | } 46 | 47 | 48 | ASSIGNED { 49 | ik (mA/cm2) 50 | g (mho/cm2) 51 | m_inf 52 | tau_m (ms) 53 | minf 54 | taum 55 | tadj 56 | } 57 | 58 | 59 | BREAKPOINT { 60 | SOLVE states METHOD cnexp 61 | minf = m_inf 62 | taum = tau_m 63 | g = gkbar*m*m 64 | ik = g * (v - ek) 65 | } 66 | 67 | DERIVATIVE states { 68 | evaluate_fct(v,Cai) 69 | m' = (m_inf - m) / tau_m 70 | } 71 | 72 | 73 | UNITSOFF 74 | INITIAL { 75 | : activation kinetics are assumed to be at 22 deg. C 76 | : Q10 is assumed to be 3 77 | 78 | VERBATIM 79 | Cai = _ion_Cai; 80 | ENDVERBATIM 81 | 82 | tadj = 3 ^ ((celsius-22.0)/10) 83 | evaluate_fct(v,Cai) 84 | m = m_inf 85 | minf = m_inf 86 | taum = tau_m 87 | } 88 | 89 | PROCEDURE evaluate_fct(v(mV),Cai(mM)) { LOCAL car, tcar 90 | car = (Cai/cac)^x 91 | m_inf = car / ( 1 + car ) 92 | tau_m = 1 / beta / (1 + car) / tadj 93 | if(tau_m < taumin) { tau_m = taumin } : min value of time cst 94 | } 95 | 96 | UNITSON 97 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/iar.mod: -------------------------------------------------------------------------------- 1 | TITLE anomalous rectifier channel 2 | : 3 | : Anomalous Rectifier Ih - cation (Na/K) channel for geniculate interneurons 4 | : Differential equations 5 | : 6 | : Written by Jun Zhu, Univ. Wisconsin, Jan 1996 7 | : Modified by Geir Halnes, Norwegian University of Life Sciences, June 2011 8 | : Fitted to data from mice dLGN interneurons. 9 | 10 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 11 | 12 | NEURON { 13 | SUFFIX iar 14 | USEION other WRITE iother VALENCE 1 15 | RANGE ghbar, iother 16 | GLOBAL h_inf, tauh, erev, stp, shift 17 | } 18 | 19 | 20 | UNITS { 21 | (molar) = (1/liter) 22 | (mM) = (millimolar) 23 | (mA) = (milliamp) 24 | (mV) = (millivolt) 25 | (msM) = (ms mM) 26 | } 27 | 28 | 29 | PARAMETER { 30 | v (mV) 31 | erev = -44 (mV) 32 | celsius = 36 (degC) 33 | ghbar = 1.1e-5 (mho/cm2) : Set from hoc-file 34 | shift = 0 (mV) 35 | 36 | : Kinetics fitted to new data from mice dLGN interneurons. 37 | : Halnes et al. 2011 38 | stp = 10 39 | a0 = 96 40 | a1 = 250 41 | a2 = 30.7 42 | a3 = 78.8 43 | a4 = 5.78 44 | } 45 | 46 | 47 | STATE { 48 | h 49 | } 50 | 51 | 52 | ASSIGNED { 53 | i (mA/cm2) 54 | iother (mA/cm2) 55 | h_inf 56 | tauh (ms) 57 | tadj 58 | } 59 | 60 | 61 | BREAKPOINT { 62 | SOLVE state METHOD cnexp 63 | iother = ghbar * h * (v - erev) 64 | } 65 | 66 | DERIVATIVE state { 67 | evaluate_fct(v) 68 | h' = (h_inf - h) / tauh 69 | } 70 | UNITSOFF 71 | 72 | INITIAL { 73 | evaluate_fct(v) 74 | h = h_inf 75 | } 76 | 77 | 78 | PROCEDURE evaluate_fct(v (mV)) { 79 | h_inf = 1 / ( 1 + exp((v+shift+a0)/stp) ) 80 | tauh = exp((v+shift+a1)/a2) / ( 1 + exp((v+shift+a3)/a4)) 81 | } 82 | 83 | 84 | 85 | UNITSON 86 | 87 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/mosinit.hoc: -------------------------------------------------------------------------------- 1 | load_file("nrngui.hoc") 2 | 3 | load_file("INmodel.hoc") 4 | 5 | xpanel("select parameterization") 6 | xbutton("Figure 4 A1, 4th trace. P1:MP = -63","runP1MP()") 7 | xbutton("Figure 4 B1. P1:HP = -57","runP1HP()") 8 | xbutton("Figure 4 A2, 4th trace. P2:MP = -69","runP2MP()") 9 | xbutton("Figure 4 B2. P1:MP = -58","runP2HP()") 10 | xpanel() 11 | 12 | 13 | proc runP1MP() { 14 | {print "Using Parameterization 1, Resting pot. -63mV"} 15 | {xopen("Parameters1.hoc")} 16 | {access soma} 17 | {Vrest = -63} 18 | {IClamp[0].amp = 0.055} 19 | {IClamp[1].amp = 0} 20 | } 21 | 22 | proc runP1HP() { 23 | {print "Using Parameterization 1, Holding pot. -57mV obtained by constant current injection (22pA)"} 24 | {xopen("Parameters1.hoc")} 25 | {access soma} 26 | {Vrest = -57} 27 | {IClamp[0].amp = -0.15} 28 | {IClamp[1].amp = 0.022} 29 | } 30 | 31 | proc runP2MP() { 32 | {print "Using Parameterization 2, Resting pot. -69mV"} 33 | {xopen("Parameters2.hoc")} 34 | {access soma} 35 | {Vrest = -69} 36 | {IClamp[0].amp = 0.04} 37 | {IClamp[1].amp = 0} 38 | } 39 | 40 | proc runP2HP() { 41 | {print "Using Parameterization 2, Holding pot. -58mV obtained by constant current injection (12pA)"} 42 | {xopen("Parameters2.hoc")} 43 | {access soma} 44 | {Vrest = -58} 45 | {IClamp[0].amp = -0.15} 46 | {IClamp[1].amp = 0.012} 47 | } 48 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/screenshot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/screenshot1.jpg -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/screenshot2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/screenshot2.jpg -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/screenshot3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/screenshot3.jpg -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/screenshot4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/screenshot4.jpg -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/Cad.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/Cad.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/HH_traub.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/HH_traub.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/Ican.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/Ican.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/iahp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/iahp.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/iar.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/iar.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/ical.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/ical.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/it2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/it2.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.la: -------------------------------------------------------------------------------- 1 | ../libnrnmech.la -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.lai: -------------------------------------------------------------------------------- 1 | # libnrnmech.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libnrnmech.so.0' 9 | 10 | # Names of this library. 11 | library_names='libnrnmech.so.0.0.0 libnrnmech.so.0 libnrnmech.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/home/docker/simulators/x86_64/lib /home/docker/simulators/x86_64/lib/libnrnoc.la /home/docker/simulators/x86_64/lib/liboc.la -lX11 /home/docker/simulators/x86_64/lib/libmemacs.la /home/docker/simulators/x86_64/lib/libnrnmpi.la /home/docker/simulators/x86_64/lib/libscopmath.la /home/docker/simulators/x86_64/lib/libsparse13.la -lreadline -lncurses /home/docker/simulators/x86_64/lib/libnrniv.la /home/docker/simulators/x86_64/lib/libivoc.la /home/docker/simulators/x86_64/lib/libneuron_gnu.la /home/docker/simulators/x86_64/lib/libmeschach.la /home/docker/simulators/x86_64/lib/libsundials.la /home/docker/simulators/x86_64/lib/libivos.la -lm -ldl' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libnrnmech. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/docker/simulators/x86_64/lib' 42 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.so: -------------------------------------------------------------------------------- 1 | libnrnmech.so.0.0.0 -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.so.0: -------------------------------------------------------------------------------- 1 | libnrnmech.so.0.0.0 -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.so.0.0.0 -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/.libs/mod_func.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simetenn/uncertainpy/ffb2400289743066265b9a8561cdf3b72e478a28/tests/models/interneuron_modelDB/x86_64/.libs/mod_func.o -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/Cad.lo: -------------------------------------------------------------------------------- 1 | # Cad.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/Cad.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/Cad.mod: -------------------------------------------------------------------------------- 1 | .././Cad.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/HH_traub.lo: -------------------------------------------------------------------------------- 1 | # HH_traub.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/HH_traub.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/HH_traub.mod: -------------------------------------------------------------------------------- 1 | .././HH_traub.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/Ican.lo: -------------------------------------------------------------------------------- 1 | # Ican.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/Ican.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/Ican.mod: -------------------------------------------------------------------------------- 1 | .././Ican.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/iahp.lo: -------------------------------------------------------------------------------- 1 | # iahp.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/iahp.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/iahp.mod: -------------------------------------------------------------------------------- 1 | .././iahp.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/iar.lo: -------------------------------------------------------------------------------- 1 | # iar.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/iar.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/iar.mod: -------------------------------------------------------------------------------- 1 | .././iar.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/ical.lo: -------------------------------------------------------------------------------- 1 | # ical.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/ical.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/ical.mod: -------------------------------------------------------------------------------- 1 | .././ical.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/it2.lo: -------------------------------------------------------------------------------- 1 | # it2.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/it2.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/it2.mod: -------------------------------------------------------------------------------- 1 | .././it2.mod -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/libnrnmech.la: -------------------------------------------------------------------------------- 1 | # libnrnmech.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libnrnmech.so.0' 9 | 10 | # Names of this library. 11 | library_names='libnrnmech.so.0.0.0 libnrnmech.so.0 libnrnmech.so' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/home/docker/simulators/x86_64/lib /home/docker/simulators/x86_64/lib/libnrnoc.la /home/docker/simulators/x86_64/lib/liboc.la -lX11 /home/docker/simulators/x86_64/lib/libmemacs.la /home/docker/simulators/x86_64/lib/libnrnmpi.la /home/docker/simulators/x86_64/lib/libscopmath.la /home/docker/simulators/x86_64/lib/libsparse13.la -lreadline -lncurses /home/docker/simulators/x86_64/lib/libnrniv.la /home/docker/simulators/x86_64/lib/libivoc.la /home/docker/simulators/x86_64/lib/libneuron_gnu.la /home/docker/simulators/x86_64/lib/libmeschach.la /home/docker/simulators/x86_64/lib/libsundials.la /home/docker/simulators/x86_64/lib/libivos.la -lm -ldl' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libnrnmech. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=no 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/docker/simulators/x86_64/lib' 42 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/mod_func.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hocdec.h" 3 | extern int nrnmpi_myid; 4 | extern int nrn_nobanner_; 5 | 6 | extern void _Cad_reg(void); 7 | extern void _HH_traub_reg(void); 8 | extern void _Ican_reg(void); 9 | extern void _iahp_reg(void); 10 | extern void _iar_reg(void); 11 | extern void _ical_reg(void); 12 | extern void _it2_reg(void); 13 | 14 | void modl_reg(){ 15 | if (!nrn_nobanner_) if (nrnmpi_myid < 1) { 16 | fprintf(stderr, "Additional mechanisms from files\n"); 17 | 18 | fprintf(stderr," ./Cad.mod"); 19 | fprintf(stderr," ./HH_traub.mod"); 20 | fprintf(stderr," ./Ican.mod"); 21 | fprintf(stderr," ./iahp.mod"); 22 | fprintf(stderr," ./iar.mod"); 23 | fprintf(stderr," ./ical.mod"); 24 | fprintf(stderr," ./it2.mod"); 25 | fprintf(stderr, "\n"); 26 | } 27 | _Cad_reg(); 28 | _HH_traub_reg(); 29 | _Ican_reg(); 30 | _iahp_reg(); 31 | _iar_reg(); 32 | _ical_reg(); 33 | _it2_reg(); 34 | } 35 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/mod_func.lo: -------------------------------------------------------------------------------- 1 | # mod_func.lo - a libtool object file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Name of the PIC object. 8 | pic_object='.libs/mod_func.o' 9 | 10 | # Name of the non-PIC object 11 | non_pic_object=none 12 | 13 | -------------------------------------------------------------------------------- /tests/models/interneuron_modelDB/x86_64/special: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if test "x${NRNHOME}" = "x" ; then 3 | NRNHOME="/home/docker/simulators" 4 | fi 5 | if test "x${NRNBIN}" = "x" ; then 6 | NRNBIN="/home/docker/simulators/x86_64/bin/" 7 | fi 8 | if test "" = "yes" ; then 9 | NRNIV="${NRNBIN}nrniv.app/Contents/MacOS/nrniv" 10 | else 11 | NRNIV="${NRNBIN}nrniv" 12 | fi 13 | "${NRNIV}" -dll "/home/docker/uncertainpy/tests/models/interneuron_modelDB/x86_64/.libs/libnrnmech.so" "$@" 14 | -------------------------------------------------------------------------------- /tests/models/izhikevich_function.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def izhikevich(a=0.02, b=0.2, c=-50, d=2): 5 | time_end = 100 6 | dt = 0.25 7 | v0 = -70 8 | 9 | time = np.linspace(0, time_end, int(time_end/dt)) 10 | 11 | def I(time): 12 | if time >= 10: 13 | return 10 14 | else: 15 | return 0 16 | 17 | info = {"stimulus_start": 10, 18 | "stimulus_end": time_end} 19 | 20 | def f(u_in, time): 21 | v, u = u_in 22 | 23 | dvdt = 0.04*v**2 + 5*v + 140 - u + I(time) 24 | dudt = a*(b*v - u) 25 | 26 | return np.array([dvdt, dudt]) 27 | 28 | u = np.zeros((len(time), 2)) 29 | u[0, 0] = v0 30 | u[0, 1] = b*v0 31 | 32 | values = [v0]*len(time) 33 | 34 | # Runge Kutta 4 35 | dt2 = dt/2.0 36 | for n in range(len(time) - 1): 37 | K1 = dt*f(u[n], time[n]) 38 | K2 = dt*f(u[n] + 0.5*K1, time[n] + dt2) 39 | K3 = dt*f(u[n] + 0.5*K2, time[n] + dt2) 40 | K4 = dt*f(u[n] + K3, time[n] + dt) 41 | u_new = u[n] + (1/6.0)*(K1 + 2*K2 + 2*K3 + K4) 42 | 43 | if u_new[0] > 30: 44 | u_new[0] = c 45 | u_new[1] += d 46 | values[n] = 30 47 | else: 48 | values[n] = u_new[0] 49 | 50 | u[n+1] = u_new 51 | 52 | return time, np.array(values), info 53 | -------------------------------------------------------------------------------- /tests/test_distribution.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import chaospy as cp 3 | from uncertainpy import uniform, normal 4 | 5 | class TestDistribution(unittest.TestCase): 6 | def test_normal(self): 7 | dist = normal(0.1) 8 | self.assertIsInstance(dist(5), cp.Distribution) 9 | 10 | def test_uniform(self): 11 | dist = uniform(0.1) 12 | self.assertIsInstance(dist(5), cp.Distribution) 13 | 14 | 15 | def test_normal_error(self): 16 | dist = uniform(0.1) 17 | 18 | with self.assertRaises(ValueError): 19 | dist(0) 20 | 21 | def test_uniform_error(self): 22 | dist = uniform(0.1) 23 | 24 | with self.assertRaises(ValueError): 25 | dist(0) 26 | 27 | 28 | if __name__ == "__main__": 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /tests/testing_classes/__init__.py: -------------------------------------------------------------------------------- 1 | from .testing_models import TestingModel0d, TestingModel1d, TestingModel2d 2 | from .testing_models import TestingModelNoTime, TestingModelNoTimeU 3 | from .testing_models import TestingModelAdaptive, TestingModelConstant 4 | from .testing_models import TestingModelIncomplete 5 | from .testing_models import PostprocessErrorNumpy, PostprocessErrorValue, PostprocessErrorOne 6 | from .testing_models import model_function 7 | 8 | from .testing_features import TestingFeatures 9 | from .testing_uncertainty import TestingUncertaintyCalculations 10 | from .testcase_plot import TestCasePlot -------------------------------------------------------------------------------- /tests/testing_classes/load_python_test.py: -------------------------------------------------------------------------------- 1 | def testing(**parameters): 2 | return "time", "values" 3 | 4 | def testing_default(test="", **parameters): 5 | return "time", test 6 | 7 | def testing_info(**parameters): 8 | return "time", "values", {"info": True} -------------------------------------------------------------------------------- /tests/testing_classes/testcase_plot.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os 3 | import subprocess 4 | 5 | class TestCasePlot(unittest.TestCase): 6 | def __init__(self, test_name, parameter=False): 7 | super(TestCasePlot, self).__init__(test_name) 8 | 9 | self.exact_plots = parameter 10 | 11 | self.figureformat = ".png" 12 | self.output_test_dir = ".tests/" 13 | 14 | 15 | def compare_plot(self, name): 16 | if self.exact_plots: 17 | folder = os.path.dirname(os.path.realpath(__file__)) 18 | compare_file = os.path.join(folder, "figures", 19 | name + self.figureformat) 20 | 21 | plot_file = os.path.join(self.output_test_dir, name + self.figureformat) 22 | 23 | result = subprocess.call(["diff", plot_file, compare_file]) 24 | self.assertEqual(result, 0) 25 | else: 26 | plot_file = os.path.join(self.output_test_dir, name + self.figureformat) 27 | self.assertTrue(os.path.isfile(plot_file)) -------------------------------------------------------------------------------- /tests/testing_classes/testing_uncertainty.py: -------------------------------------------------------------------------------- 1 | from uncertainpy.core import UncertaintyCalculations 2 | from uncertainpy.core import UncertaintyCalculations 3 | from uncertainpy.data import Data 4 | 5 | class TestingUncertaintyCalculations(UncertaintyCalculations): 6 | def polynomial_chaos(self, 7 | uncertain_parameters=None, 8 | method="collocation", 9 | rosenblatt=False, 10 | polynomial_order=4, 11 | nr_collocation_nodes=None, 12 | quadrature_order=4, 13 | nr_pc_mc_samples=10**4, 14 | allow_incomplete=False, 15 | seed=None): 16 | 17 | arguments = {} 18 | 19 | arguments["function"] = "PC" 20 | arguments["uncertain_parameters"] = uncertain_parameters 21 | arguments["method"] = method 22 | arguments["rosenblatt"] = rosenblatt 23 | arguments["polynomial_order"] = polynomial_order 24 | arguments["nr_collocation_nodes"] = nr_collocation_nodes 25 | arguments["quadrature_order"] = quadrature_order 26 | arguments["nr_pc_mc_samples"] = nr_pc_mc_samples 27 | arguments["seed"] = seed 28 | arguments["allow_incomplete"] = allow_incomplete 29 | 30 | 31 | data = Data(logger_level=None) 32 | data.arguments = arguments 33 | 34 | return data 35 | 36 | 37 | def monte_carlo(self, 38 | uncertain_parameters=None, 39 | nr_samples=10**3, 40 | seed=None): 41 | arguments = {} 42 | 43 | arguments["function"] = "MC" 44 | arguments["uncertain_parameters"] = uncertain_parameters 45 | arguments["seed"] = seed 46 | arguments["nr_samples"] = nr_samples 47 | 48 | data = Data(logger_level=None) 49 | data.arguments = arguments 50 | 51 | return data 52 | 53 | 54 | 55 | def custom_uncertainty_quantification(self, custom_keyword="custom_value"): 56 | arguments = {} 57 | 58 | arguments["function"] = "custom_uncertainty_quantification" 59 | arguments["custom_keyword"] = custom_keyword 60 | 61 | data = Data(logger_level=None) 62 | data.arguments = arguments 63 | 64 | return data --------------------------------------------------------------------------------