{ "cells": [ { "cell_type": "code", "execution_count": 19, "id": "df96262b", "metadata": {}, "outputs": [], "source": [ "import urllib\n", "\n", "import numpy as np\n", "import quantities as pq\n", "from matplotlib import pyplot as plt\n", "\n", "import h5py\n", "import nixio as nix\n", "import neo\n", "from nixio import *\n", "from utils.plotting import Plotter\n", "from utils.notebook import print_stats, print_metadata_table" ] }, { "cell_type": "code", "execution_count": 20, "id": "4d771023", "metadata": {}, "outputs": [], "source": [ "reader = neo.io.BlackrockIO(filename='i140703-001-03.nev')\n", "blk_obj = reader.read(lazy=False)[0]\n" ] }, { "cell_type": "code", "execution_count": 21, "id": "dc66d39b", "metadata": {}, "outputs": [], "source": [ "unit_channel_array = reader.header['unit_channels']" ] }, { "cell_type": "code", "execution_count": 22, "id": "db4ac039", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Neo version: 0.9.0\n", "NIX version: v1.5.0b3\n" ] } ], "source": [ "f = 'test2.h5'\n", "\n", "print(\"Neo version:\", neo.__version__)\n", "print(\"NIX version:\", nix.__version__)\n", "\n", "with neo.NixIO(f, mode='ow') as writer:\n", " writer.write_block(blk_obj)" ] }, { "cell_type": "code", "execution_count": 23, "id": "55fa6d4d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "nix (1, 1, 0) 1622807825\n" ] } ], "source": [ "nixfile = nix.File.open(f, nix.FileMode.Overwrite)\n", "print(nixfile.format, nixfile.version, nixfile.created_at)" ] }, { "cell_type": "code", "execution_count": 24, "id": "0630983b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nixfile" ] }, { "cell_type": "code", "execution_count": 25, "id": "62968e5d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nixfile.is_open()" ] }, { "cell_type": "code", "execution_count": 33, "id": "ae547303", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pretty printing has been turned OFF\n" ] } ], "source": [ "pprint(nixfile)" ] }, { "cell_type": "code", "execution_count": 7, "id": "0189a4ee", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nixfile.blocks" ] }, { "cell_type": "code", "execution_count": 26, "id": "f5e8847a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nixfile.find_sections()" ] }, { "cell_type": "code", "execution_count": 36, "id": "10a079b9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "''" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "format(nixfile)" ] }, { "cell_type": "code", "execution_count": 28, "id": "0d5261ec", "metadata": {}, "outputs": [], "source": [ "print_stats(nixfile.blocks)" ] }, { "cell_type": "code", "execution_count": 27, "id": "48be8926", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "nix (1, 1, 0) 1622807825\n" ] } ], "source": [ "print(nixfile.format, nixfile.version, nixfile.created_at)" ] }, { "cell_type": "code", "execution_count": 29, "id": "91cb07d2", "metadata": {}, "outputs": [], "source": [ "nixfile.close()" ] }, { "cell_type": "code", "execution_count": 30, "id": "b8d46d08", "metadata": {}, "outputs": [], "source": [ "nixfile = nix.File.open(f, nix.FileMode.ReadOnly)" ] }, { "cell_type": "code", "execution_count": 32, "id": "ea8402e0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nixfile.blocks" ] } ], "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.9.5" } }, "nbformat": 4, "nbformat_minor": 5 }