|
@@ -2,6 +2,7 @@
|
|
|
"cells": [
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"# Hand-on session 1: Basics\n",
|
|
|
"\n",
|
|
@@ -16,18 +17,18 @@
|
|
|
"5. Create a new nix-file with the name `file_2.nix` using the ``nixio.FileMode.ReadOnly`` mode. What happens.\n",
|
|
|
"\n",
|
|
|
"### Your solution"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "source": [],
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ "source": []
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"## Exercise 2: Storing regularly sampled data\n",
|
|
|
"\n",
|
|
@@ -39,12 +40,13 @@
|
|
|
" 2. What is the sampling rate (or sampling interval)?\n",
|
|
|
"3. You may want to plot it to get an impression of the data.\n",
|
|
|
" 1. What might be the correct labeling of the plot?\n"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": 1,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
"source": [
|
|
|
"import os\n",
|
|
|
"import scipy.io as spio\n",
|
|
@@ -59,12 +61,11 @@
|
|
|
" data = spio.loadmat(os.path.join(\"resources\", \"intra_data.mat\"))\n",
|
|
|
"\n",
|
|
|
" return data[\"time\"][0], data[\"voltage\"][0]"
|
|
|
- ],
|
|
|
- "outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"### Now we want to store the data in a nix file\n",
|
|
|
"\n",
|
|
@@ -75,18 +76,18 @@
|
|
|
"5. Close the file to ensure proper saving (best practice).\n",
|
|
|
"\n",
|
|
|
"### Your solution"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "source": [],
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ "source": []
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"## Exercise 3: reading data from the file and creating a fully labeled plot\n",
|
|
|
"\n",
|
|
@@ -98,12 +99,13 @@
|
|
|
"5. Get a time axis of the appropriate length \n",
|
|
|
"6. Plot the data\n",
|
|
|
"7. label the x- and y-axis (you may want to use the function ``get_label`` below)"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": 2,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
"source": [
|
|
|
"def get_label(obj):\n",
|
|
|
" \"\"\" Returns a string that can be used as an axis label. Constructs the label from DataArray or Dimension objects.\n",
|
|
@@ -121,26 +123,25 @@
|
|
|
" label = obj.label\n",
|
|
|
"\n",
|
|
|
" return label\n"
|
|
|
- ],
|
|
|
- "outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"### Your solution"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "source": [],
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ "source": []
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"## Exercise 4: Irregularly sampled data.\n",
|
|
|
"\n",
|
|
@@ -152,31 +153,32 @@
|
|
|
"5. If you have time, reopen in ``ReadOnly`` mode and create a fully labeled plot that contains the membrane voltage and the respective spike times.\n",
|
|
|
"\n",
|
|
|
"### Your solution"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "source": [],
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ "source": []
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"## Exercise 5: Storing multidimensional data\n",
|
|
|
"\n",
|
|
|
- "1. Load the data and find out the dimensionality of the data. (One dimension represents time, the other the local field potentials measured in paralell recording channels).\n",
|
|
|
+ "1. Load the data and find out the dimensionality of the data. (One dimension represents time, the other the local field potentials measured in parallel recording channels).\n",
|
|
|
"2. Store it in a nix file. Don't forget to add the dimension descriptors.\n",
|
|
|
"\n",
|
|
|
"3. Create a labeled plot of the data."
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": 3,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
"source": [
|
|
|
"import os\n",
|
|
|
"\n",
|
|
@@ -190,61 +192,59 @@
|
|
|
" data = spio.loadmat(os.path.join(\"resources\", \"lfp_fake_data.mat\"))\n",
|
|
|
"\n",
|
|
|
" return data[\"time\"][0], data[\"lfp\"]"
|
|
|
- ],
|
|
|
- "outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"### Your solution"
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "source": [],
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ "source": []
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
+ "metadata": {},
|
|
|
"source": [
|
|
|
"## Bonus: Did you bring your own data? Try to store it in NIX..."
|
|
|
- ],
|
|
|
- "metadata": {}
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "source": [],
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
- "metadata": {}
|
|
|
+ "source": []
|
|
|
}
|
|
|
],
|
|
|
"metadata": {
|
|
|
- "orig_nbformat": 4,
|
|
|
+ "interpreter": {
|
|
|
+ "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
|
|
|
+ },
|
|
|
+ "kernelspec": {
|
|
|
+ "display_name": "Python 3 (ipykernel)",
|
|
|
+ "language": "python",
|
|
|
+ "name": "python3"
|
|
|
+ },
|
|
|
"language_info": {
|
|
|
- "name": "python",
|
|
|
- "version": "3.9.5",
|
|
|
- "mimetype": "text/x-python",
|
|
|
"codemirror_mode": {
|
|
|
"name": "ipython",
|
|
|
"version": 3
|
|
|
},
|
|
|
- "pygments_lexer": "ipython3",
|
|
|
+ "file_extension": ".py",
|
|
|
+ "mimetype": "text/x-python",
|
|
|
+ "name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
- "file_extension": ".py"
|
|
|
- },
|
|
|
- "kernelspec": {
|
|
|
- "name": "python3",
|
|
|
- "display_name": "Python 3.9.5 64-bit"
|
|
|
- },
|
|
|
- "interpreter": {
|
|
|
- "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
|
|
|
+ "pygments_lexer": "ipython3",
|
|
|
+ "version": "3.9.6"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|
|
|
"nbformat_minor": 2
|
|
|
-}
|
|
|
+}
|