{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Wherever the current working directory is move to `~/cerebmodels`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/main-dev/cerebtests/docs/notebooks\r\n" ] } ], "source": [ "!pwd" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/main-dev/cerebtests/docs\n" ] } ], "source": [ "cd .." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/main-dev/cerebtests\n" ] } ], "source": [ "cd .." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/main-dev\n" ] } ], "source": [ "cd .." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/main-dev/cerebmodels\n" ] } ], "source": [ "cd cerebmodels/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Load executive control" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "from executive import ExecutiveControl as ec" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "#ec.list_modelscales()\n", "#ec.list_models( modelscale=\"cells\" )\n", "exc = ec()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1.1. Load desired model" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "%%capture\n", "desired_model = ec.choose_model( modelscale=\"cells\", modelname=\"PC2003Khaliq\" )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Load dataset" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "scrolled": true }, "outputs": [], "source": [ "import requests\n", "import json" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "datasetlink = \"https://raw.githubusercontent.com/cerebunit/cerebdata/master/expdata/cells/PurkinjeCell/Llinas_Sugimori_1980_soma_restVm.json\"" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "dataset = json.loads( requests.get(datasetlink).text )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Load desired validation test" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "from cerebunit.validation_tests.cells.Purkinje import SomaRestingVmTest as srvt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1. Instantiate test class" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Validate Observation ...\n", "Validated.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/envs/py3-cerebmodels/lib/python3.5/site-packages/scipy/stats/stats.py:1450: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=10\n", " \"anyway, n=%i\" % int(n))\n" ] } ], "source": [ "vtest = srvt(dataset)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2. Run validation test" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Testing ...\n", "Sim produce_soma v_restingVm starting ...\n", "Simulation produce_voltage_response starting ...\n", "--- 0.11563400000000001 seconds ---\n", "File saving ...\n", "File saved.\n", "Simulation produce_voltage_response Done.\n", "--- 0.19566200000000045 seconds ---\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/envs/py3-cerebmodels/lib/python3.5/site-packages/pynwb/file.py:619: UserWarning: Date is missing timezone information. Updating to local timezone.\n", " warn(\"Date is missing timezone information. Updating to local timezone.\")\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Simulation produce_soma v_restingVm Done.\n", "--- 3.605861 seconds ---\n", "Computing score ...\n", "Done.\n", "eta0 = -63.99954201896992 mV, eta = -66.5 mV, n = 10\n", "H0: eta = eta0\n", "Ha: eta =/= eta0\n", "Test statistic: z = 2.5298221281347035\n", "Assuming H0 is true, p-value = 0.011412036386001651\n" ] } ], "source": [ "test_statistic = vtest.judge(desired_model)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 2 }