Bladeren bron

upgrade .nix files to 1.5.2

Moritz-Alexander-Kern 2 jaren geleden
bovenliggende
commit
6076f35f09

+ 3 - 0
tutorials/tutorial_unitary_event_analysis/.idea/.gitignore

@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml

+ 13 - 0
tutorials/tutorial_unitary_event_analysis/.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,13 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="PyPep8Inspection" enabled="true" level="WARNING" enabled_by_default="true" />
+    <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="ignoredErrors">
+        <list>
+          <option value="N806" />
+        </list>
+      </option>
+    </inspection_tool>
+  </profile>
+</component>

+ 6 - 0
tutorials/tutorial_unitary_event_analysis/.idea/inspectionProfiles/profiles_settings.xml

@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="USE_PROJECT_PROFILE" value="false" />
+    <version value="1.0" />
+  </settings>
+</component>

+ 4 - 0
tutorials/tutorial_unitary_event_analysis/.idea/misc.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (elephant) (2)" project-jdk-type="Python SDK" />
+</project>

+ 8 - 0
tutorials/tutorial_unitary_event_analysis/.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/tutorial_unitary_event_analysis.iml" filepath="$PROJECT_DIR$/.idea/tutorial_unitary_event_analysis.iml" />
+    </modules>
+  </component>
+</project>

+ 8 - 0
tutorials/tutorial_unitary_event_analysis/.idea/tutorial_unitary_event_analysis.iml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
tutorials/tutorial_unitary_event_analysis/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
+  </component>
+</project>

BIN
tutorials/tutorial_unitary_event_analysis/data/dataset-1.nix


+ 152 - 0
tutorials/tutorial_unitary_event_analysis/src/.ipynb_checkpoints/conversion_hd5_to_nix-checkpoint.ipynb

@@ -0,0 +1,152 @@
+{
+ "cells": [
+  {
+   "cell_type": "markdown",
+   "id": "723581d7",
+   "metadata": {},
+   "source": [
+    "# Conversion\n",
+    "This Notebook converts  the dataset for the unitary events tutorial from .h5 to.nix format"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "id": "6c6d2774",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import neo\n",
+    "from neo.core import Block, Segment, Group, AnalogSignal\n",
+    "import numpy as np\n",
+    "import quantities as pq\n",
+    "\n",
+    "import random\n",
+    "import string\n",
+    "import matplotlib.pyplot as plt\n",
+    "import elephant.unitary_event_analysis as ue\n",
+    "# Fix random seed to guarantee fixed output\n",
+    "random.seed(1224)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "id": "26914203",
+   "metadata": {},
+   "source": [
+    "## Download data"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "id": "8c798f2b",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n",
+      "                                 Dload  Upload   Total   Spent    Left  Speed\n",
+      "100   369  100   369    0     0   7096      0 --:--:-- --:--:-- --:--:--  7096\n",
+      "100  289k    0  289k    0     0   255k      0 --:--:--  0:00:01 --:--:-- 1562k\n"
+     ]
+    }
+   ],
+   "source": [
+    "!curl https://web.gin.g-node.org/INM-6/elephant-data/raw/master/dataset-1/dataset-1.h5 --output dataset-1.h5 --location"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "id": "903fc908",
+   "metadata": {},
+   "source": [
+    "## Load Data"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "id": "870b8b77",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "/home/kern/miniconda3/envs/elephant/lib/python3.9/site-packages/neo/io/hdf5io.py:63: FutureWarning: NeoHdf5IO will be removed in the next release of Neo. If you still have data in this format, we recommend saving it using NixIO which is also based on HDF5.\n",
+      "  warn(warning_msg, FutureWarning)\n",
+      "/home/kern/miniconda3/envs/elephant/lib/python3.9/site-packages/numpy/core/shape_base.py:121: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
+      "  ary = asanyarray(ary)\n"
+     ]
+    }
+   ],
+   "source": [
+    "block = neo.io.NeoHdf5IO(\"./dataset-1.h5\")\n",
+    "sts1 = block.read_block().segments[0].spiketrains\n",
+    "sts2 = block.read_block().segments[1].spiketrains\n",
+    "spiketrains = np.vstack((sts1,sts2)).T"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "id": "c52a2a89",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# create empty block\n",
+    "blk = Block()\n",
+    "# add segments and spike trains\n",
+    "for ind in range (len(sts1)):\n",
+    "    seg = Segment(name='segment %d' % ind, index=ind)\n",
+    "    seg.spiketrains.append(sts1[ind])\n",
+    "    seg.spiketrains.append(sts2[ind])\n",
+    "    blk.segments.append(seg)\n"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "id": "28a2e17f",
+   "metadata": {},
+   "source": [
+    "## Save as .nix"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "id": "2a06477e",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "filename = 'dataset-1.nix'\n",
+    "with neo.io.NixIO(filename, 'ow') as io:\n",
+    "    io.write_block(blk)"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "elephant_old",
+   "language": "python",
+   "name": "elephant_old"
+  },
+  "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.9.6"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}