{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import nixio\n", "\n", "def identify_metadata(nix_container, nix_entity_name):\n", " cnt = 0\n", " for itm in nix_container:\n", " print(f\"Name: {itm.name}; Metadata: {itm.metadata}\")\n", " if itm.metadata != None:\n", " cnt = cnt + 1\n", " print(f\"{nix_entity_name} with metadata: {cnt}\")\n", "\n", "fname = \"resources/2010-04-28-af.nix\"\n", "f = nixio.File.open(fname, nixio.FileMode.ReadOnly)\n", "f.blocks\n", "\n", "identify_metadata(f.blocks, \"Blocks\")\n", "identify_metadata(f.blocks[0].data_arrays, \"DataArrays\")\n", "identify_metadata(f.blocks[0].groups, \"Groups\")\n", "identify_metadata(f.blocks[0].tags, \"Tags\")\n", "identify_metadata(f.blocks[0].multi_tags, \"MultiTags\")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "f.blocks[0].tags[\"stimspikes_contrast_20_cutoff_50_all_spikes_output_spectra\"].metadata.pprint(max_depth=2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(f.sections)\n", "\n", "for sec in f.sections[0].sections:\n", " print(f\"Name: {sec.name}; Type: {sec.type}\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "rec_sec = f.sections[0].sections[\"Recording\"]\n", "rec_sec.pprint()\n", "len(rec_sec.props)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for sec in f.sections[0].sections:\n", " print(f\"Name: {sec.name}; references: {sec.referring_objects}\")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "f.close()" ] } ], "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.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }