|
@@ -299,9 +299,9 @@
|
|
|
"name": "stdout",
|
|
|
"output_type": "stream",
|
|
|
"text": [
|
|
|
- "id: 87eb188a-9859-40fb-847b-d693f99eb484\n",
|
|
|
- "created at: 2023-07-14 21:02:14\n",
|
|
|
- "updated at: 2023-07-14 21:02:14\n"
|
|
|
+ "id: 877147e5-e94d-421d-addc-8ca1aa445304\n",
|
|
|
+ "created at: 2023-07-15 00:21:29\n",
|
|
|
+ "updated at: 2023-07-15 00:21:29\n"
|
|
|
]
|
|
|
}
|
|
|
],
|
|
@@ -737,7 +737,7 @@
|
|
|
},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
- "# Let us create a new block to store our analysis\n",
|
|
|
+ "# Let us to store SUA spiketrains used in our analysis\n",
|
|
|
"for st in sua_spiketrains_with_spikes:\n",
|
|
|
" st_data_array = analysis_nixblock.create_data_array(name=f\"{st.name}\", array_type=\"nix.analysis.spiketrain\", \n",
|
|
|
" data=st,\n",
|
|
@@ -1719,6 +1719,76 @@
|
|
|
"Here, we have associated the metdata section `recording.20230715` with the entire nix `analyis` block. We can also associate metadata to also to individual `data arrays` or `tags` if we need to add metadata on finer level."
|
|
|
]
|
|
|
},
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 42,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "# Use nixio to create a block with spiketrains and add the annotations from Neo as metadata\n",
|
|
|
+ "st_sec = nixfile.create_section(name=\"spiketrains\", \n",
|
|
|
+ " type_=\"data.analysis\")\n",
|
|
|
+ "\n",
|
|
|
+ "all_st_block = nixfile.create_block(name=\"spiketrains\", type_=\"nix.analysed.spiketrains\")\n",
|
|
|
+ "\n",
|
|
|
+ "for st in trial.spiketrains:\n",
|
|
|
+ " st_data_array = all_st_block.create_data_array(name=f\"{st.name}\", array_type=\"nix.analysis.spiketrain\", \n",
|
|
|
+ " data=st,\n",
|
|
|
+ " label=\"Time\", \n",
|
|
|
+ " unit=\"s\") \n",
|
|
|
+ " st_data_array.append_range_dimension_using_self()\n",
|
|
|
+ " \n",
|
|
|
+ " st_sub_sec = st_sec.create_section(name=f\"{st.name}\", \n",
|
|
|
+ " type_=\"nix.analysis.spiketrain\")\n",
|
|
|
+ " \n",
|
|
|
+ " for key, value in st.annotations.items():\n",
|
|
|
+ " st_sub_sec.create_property(name=key, \n",
|
|
|
+ " values_or_dtype=str(value))\n",
|
|
|
+ " \n",
|
|
|
+ " st_data_array.metadata = st_sub_sec\n",
|
|
|
+ " \n",
|
|
|
+ " "
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 43,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "# Select only SUA spike trains with spikes and certain quality criteria\n",
|
|
|
+ "# But this time using the metadata and data arrays we explicitly just created in our nix file\n",
|
|
|
+ "spiketrain_block_st = [spiketrain for spiketrain in nixfile.blocks[\"spiketrains\"].data_arrays if\n",
|
|
|
+ " spiketrain.metadata['sua']=='True' and # Is SUA\n",
|
|
|
+ " spiketrain.metadata['electrode_reject_HFC']=='False' and # Bad quality is marked as True\n",
|
|
|
+ " spiketrain.metadata['electrode_reject_IFC']=='False' and\n",
|
|
|
+ " spiketrain.metadata['electrode_reject_LFC']=='False'and\n",
|
|
|
+ " spiketrain.metadata['noise']== 'False' and\n",
|
|
|
+ " int(spiketrain.metadata['spike_count'])> 10000] # Spike count"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 44,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "data": {
|
|
|
+ "text/plain": [
|
|
|
+ "True"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "execution_count": 44,
|
|
|
+ "metadata": {},
|
|
|
+ "output_type": "execute_result"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "# We can then compare the data arrays selected by explicitly using metadata in NIX file and by using Neo annotations \n",
|
|
|
+ "analysis_block_st = [da for da in analysis_nixblock.data_arrays if \"nix.analysis.spiketrain\" in da.type]\n",
|
|
|
+ "[st_da.name for st_da in spiketrain_block_st] == [st_da.name for st_da in analysis_block_st]"
|
|
|
+ ]
|
|
|
+ },
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
"metadata": {
|
|
@@ -1747,7 +1817,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 42,
|
|
|
+ "execution_count": 45,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "fragment"
|
|
@@ -1773,7 +1843,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 43,
|
|
|
+ "execution_count": 46,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "fragment"
|
|
@@ -1788,7 +1858,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 44,
|
|
|
+ "execution_count": 47,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "fragment"
|
|
@@ -1798,10 +1868,10 @@
|
|
|
{
|
|
|
"data": {
|
|
|
"text/plain": [
|
|
|
- "[Block: {name = analysis, type = nix.Analyis}, Block: {name = neo.block.8fbb61ca054546ac9175cfa9c89e17d2, type = neo.block}]"
|
|
|
+ "[Block: {name = analysis, type = nix.Analyis}, Block: {name = spiketrains, type = nix.analysed.spiketrains}, Block: {name = neo.block.e14ae98847a7462db984532b6bf49497, type = neo.block}]"
|
|
|
]
|
|
|
},
|
|
|
- "execution_count": 44,
|
|
|
+ "execution_count": 47,
|
|
|
"metadata": {},
|
|
|
"output_type": "execute_result"
|
|
|
}
|
|
@@ -1814,7 +1884,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 45,
|
|
|
+ "execution_count": 48,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "slide"
|
|
@@ -2279,7 +2349,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 46,
|
|
|
+ "execution_count": 49,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "slide"
|
|
@@ -2294,7 +2364,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 47,
|
|
|
+ "execution_count": 50,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "fragment"
|
|
@@ -2305,8 +2375,8 @@
|
|
|
"name": "stdout",
|
|
|
"output_type": "stream",
|
|
|
"text": [
|
|
|
- "Block: {name = neo.block.8fbb61ca054546ac9175cfa9c89e17d2, type = neo.block}\n",
|
|
|
- " Group: {name = neo.segment.8d1e6e414d1943568ed4ce46e33a8c27, type = neo.segment}\n",
|
|
|
+ "Block: {name = neo.block.e14ae98847a7462db984532b6bf49497, type = neo.block}\n",
|
|
|
+ " Group: {name = neo.segment.cce577ad60c64d3a86446e12e5c00c48, type = neo.segment}\n",
|
|
|
" *DataArray: {name = neo.analogsignal.18037944fdf2472d9c49cff8ea26e4ff.0, type = neo.analogsignal}\n",
|
|
|
" Shape: (2000,) Unit:uV\n",
|
|
|
" SampledDimension: {index = 1}\n",
|
|
@@ -2597,7 +2667,7 @@
|
|
|
" SampledDimension: {index = 1}\n",
|
|
|
" *MultiTag: {name = neo.event.a89cbc9d1ef24da3b4f7d457677f403f, type = neo.event}\n",
|
|
|
" Position Shape:(4,) Units: ()\n",
|
|
|
- " *MultiTag: {name = neo.epoch.ad2bf3d7dbad4ea28380ef67dd53220d, type = neo.epoch}\n",
|
|
|
+ " *MultiTag: {name = neo.epoch.2d20903c983044cfa6124ec94fd70caa, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.22a41c20c0614a238d32dea2d46673ca, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(3,) Units: ()\n",
|
|
@@ -2756,7 +2826,13 @@
|
|
|
" *MultiTag: {name = neo.spiketrain.55fa058510b04f01964d3de511aa4be3, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(21,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.cee9ef9dab014ca98fb215226afd08a4, type = neo.spiketrain}\n",
|
|
|
- " Position Shape:(14,) Units: ()\n",
|
|
|
+ " Position Shape:(14,) Units: ()\n"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "name": "stdout",
|
|
|
+ "output_type": "stream",
|
|
|
+ "text": [
|
|
|
" *MultiTag: {name = neo.spiketrain.4c3ee2faa2314ca9948ef3b36e174e84, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(3,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.bf651124845b4406a2be5e295b861988, type = neo.spiketrain}\n",
|
|
@@ -3141,7 +3217,7 @@
|
|
|
" Position Shape:(0,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.f659d3d7de144272b45cf20c90b76d94, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(17,) Units: ()\n",
|
|
|
- " Group: {name = neo.segment.af57bb8d436e4b08915e5c4cc1bd9d2c, type = neo.segment}\n",
|
|
|
+ " Group: {name = neo.segment.347b5c5fd0d545e7bbed4f220a2945a6, type = neo.segment}\n",
|
|
|
" *DataArray: {name = neo.analogsignal.18037944fdf2472d9c49cff8ea26e4ff.0, type = neo.analogsignal}\n",
|
|
|
" Shape: (2000,) Unit:uV\n",
|
|
|
" SampledDimension: {index = 1}\n",
|
|
@@ -3432,7 +3508,7 @@
|
|
|
" SampledDimension: {index = 1}\n",
|
|
|
" *MultiTag: {name = neo.event.a89cbc9d1ef24da3b4f7d457677f403f, type = neo.event}\n",
|
|
|
" Position Shape:(4,) Units: ()\n",
|
|
|
- " *MultiTag: {name = neo.epoch.25ba9de9665a4fb3a5ec9d9931c2940b, type = neo.epoch}\n",
|
|
|
+ " *MultiTag: {name = neo.epoch.8e37249edd38402687607357c2a45288, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.22a41c20c0614a238d32dea2d46673ca, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(3,) Units: ()\n",
|
|
@@ -3976,7 +4052,7 @@
|
|
|
" Position Shape:(0,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.f659d3d7de144272b45cf20c90b76d94, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(17,) Units: ()\n",
|
|
|
- " Group: {name = neo.segment.03da131fec164558936d15b8973b0d61, type = neo.segment}\n",
|
|
|
+ " Group: {name = neo.segment.90a431f458cf4db28eeaf941c67e785e, type = neo.segment}\n",
|
|
|
" *DataArray: {name = neo.analogsignal.18037944fdf2472d9c49cff8ea26e4ff.0, type = neo.analogsignal}\n",
|
|
|
" Shape: (2000,) Unit:uV\n",
|
|
|
" SampledDimension: {index = 1}\n",
|
|
@@ -4267,7 +4343,7 @@
|
|
|
" SampledDimension: {index = 1}\n",
|
|
|
" *MultiTag: {name = neo.event.a89cbc9d1ef24da3b4f7d457677f403f, type = neo.event}\n",
|
|
|
" Position Shape:(4,) Units: ()\n",
|
|
|
- " *MultiTag: {name = neo.epoch.a9d4478ee4f24431ada1dc38386e9b8d, type = neo.epoch}\n",
|
|
|
+ " *MultiTag: {name = neo.epoch.d6c44b2e17a6479d80bf565ad9c2f88c, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.22a41c20c0614a238d32dea2d46673ca, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(3,) Units: ()\n",
|
|
@@ -4811,7 +4887,7 @@
|
|
|
" Position Shape:(0,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.f659d3d7de144272b45cf20c90b76d94, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(17,) Units: ()\n",
|
|
|
- " Group: {name = neo.segment.3d01cc52c59a4608b51f8baa95774be6, type = neo.segment}\n",
|
|
|
+ " Group: {name = neo.segment.5fd44f6d88624912b9f2f1564789a833, type = neo.segment}\n",
|
|
|
" *DataArray: {name = neo.analogsignal.18037944fdf2472d9c49cff8ea26e4ff.0, type = neo.analogsignal}\n",
|
|
|
" Shape: (2000,) Unit:uV\n",
|
|
|
" SampledDimension: {index = 1}\n",
|
|
@@ -5102,7 +5178,7 @@
|
|
|
" SampledDimension: {index = 1}\n",
|
|
|
" *MultiTag: {name = neo.event.a89cbc9d1ef24da3b4f7d457677f403f, type = neo.event}\n",
|
|
|
" Position Shape:(4,) Units: ()\n",
|
|
|
- " *MultiTag: {name = neo.epoch.107cbcf6a5bb42a89302c9191a62817f, type = neo.epoch}\n",
|
|
|
+ " *MultiTag: {name = neo.epoch.8af5ca70ae8b4e13a0a34efe3d22e00f, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
" *MultiTag: {name = neo.spiketrain.22a41c20c0614a238d32dea2d46673ca, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(3,) Units: ()\n",
|
|
@@ -5937,10 +6013,10 @@
|
|
|
" DataArray: {name = neo.event.a89cbc9d1ef24da3b4f7d457677f403f.times, type = neo.event.times}\n",
|
|
|
" Shape: (4,) Unit:s\n",
|
|
|
" SetDimension: {index = 1}\n",
|
|
|
- " DataArray: {name = neo.epoch.ad2bf3d7dbad4ea28380ef67dd53220d.times, type = neo.epoch.times}\n",
|
|
|
+ " DataArray: {name = neo.epoch.2d20903c983044cfa6124ec94fd70caa.times, type = neo.epoch.times}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
" SetDimension: {index = 1}\n",
|
|
|
- " DataArray: {name = neo.epoch.ad2bf3d7dbad4ea28380ef67dd53220d.durations, type = neo.epoch.durations}\n",
|
|
|
+ " DataArray: {name = neo.epoch.2d20903c983044cfa6124ec94fd70caa.durations, type = neo.epoch.durations}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
" DataArray: {name = neo.spiketrain.22a41c20c0614a238d32dea2d46673ca.times, type = neo.spiketrain.times}\n",
|
|
|
" Shape: (3,) Unit:s\n",
|
|
@@ -6484,24 +6560,24 @@
|
|
|
" Shape: (0,) Unit:s\n",
|
|
|
" DataArray: {name = neo.spiketrain.f659d3d7de144272b45cf20c90b76d94.times, type = neo.spiketrain.times}\n",
|
|
|
" Shape: (17,) Unit:s\n",
|
|
|
- " DataArray: {name = neo.epoch.25ba9de9665a4fb3a5ec9d9931c2940b.times, type = neo.epoch.times}\n",
|
|
|
+ " DataArray: {name = neo.epoch.8e37249edd38402687607357c2a45288.times, type = neo.epoch.times}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
" SetDimension: {index = 1}\n",
|
|
|
- " DataArray: {name = neo.epoch.25ba9de9665a4fb3a5ec9d9931c2940b.durations, type = neo.epoch.durations}\n",
|
|
|
+ " DataArray: {name = neo.epoch.8e37249edd38402687607357c2a45288.durations, type = neo.epoch.durations}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
- " DataArray: {name = neo.epoch.a9d4478ee4f24431ada1dc38386e9b8d.times, type = neo.epoch.times}\n",
|
|
|
+ " DataArray: {name = neo.epoch.d6c44b2e17a6479d80bf565ad9c2f88c.times, type = neo.epoch.times}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
" SetDimension: {index = 1}\n",
|
|
|
- " DataArray: {name = neo.epoch.a9d4478ee4f24431ada1dc38386e9b8d.durations, type = neo.epoch.durations}\n",
|
|
|
+ " DataArray: {name = neo.epoch.d6c44b2e17a6479d80bf565ad9c2f88c.durations, type = neo.epoch.durations}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
- " DataArray: {name = neo.epoch.107cbcf6a5bb42a89302c9191a62817f.times, type = neo.epoch.times}\n",
|
|
|
+ " DataArray: {name = neo.epoch.8af5ca70ae8b4e13a0a34efe3d22e00f.times, type = neo.epoch.times}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
" SetDimension: {index = 1}\n",
|
|
|
- " DataArray: {name = neo.epoch.107cbcf6a5bb42a89302c9191a62817f.durations, type = neo.epoch.durations}\n",
|
|
|
+ " DataArray: {name = neo.epoch.8af5ca70ae8b4e13a0a34efe3d22e00f.durations, type = neo.epoch.durations}\n",
|
|
|
" Shape: (1,) Unit:s\n",
|
|
|
" MultiTag: {name = neo.event.a89cbc9d1ef24da3b4f7d457677f403f, type = neo.event}\n",
|
|
|
" Position Shape:(4,) Units: ()\n",
|
|
|
- " MultiTag: {name = neo.epoch.ad2bf3d7dbad4ea28380ef67dd53220d, type = neo.epoch}\n",
|
|
|
+ " MultiTag: {name = neo.epoch.2d20903c983044cfa6124ec94fd70caa, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
" MultiTag: {name = neo.spiketrain.22a41c20c0614a238d32dea2d46673ca, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(3,) Units: ()\n",
|
|
@@ -7045,11 +7121,11 @@
|
|
|
" Position Shape:(0,) Units: ()\n",
|
|
|
" MultiTag: {name = neo.spiketrain.f659d3d7de144272b45cf20c90b76d94, type = neo.spiketrain}\n",
|
|
|
" Position Shape:(17,) Units: ()\n",
|
|
|
- " MultiTag: {name = neo.epoch.25ba9de9665a4fb3a5ec9d9931c2940b, type = neo.epoch}\n",
|
|
|
+ " MultiTag: {name = neo.epoch.8e37249edd38402687607357c2a45288, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
- " MultiTag: {name = neo.epoch.a9d4478ee4f24431ada1dc38386e9b8d, type = neo.epoch}\n",
|
|
|
+ " MultiTag: {name = neo.epoch.d6c44b2e17a6479d80bf565ad9c2f88c, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n",
|
|
|
- " MultiTag: {name = neo.epoch.107cbcf6a5bb42a89302c9191a62817f, type = neo.epoch}\n",
|
|
|
+ " MultiTag: {name = neo.epoch.8af5ca70ae8b4e13a0a34efe3d22e00f, type = neo.epoch}\n",
|
|
|
" Position Shape:(1,) Units: ()\n"
|
|
|
]
|
|
|
}
|
|
@@ -7061,7 +7137,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 48,
|
|
|
+ "execution_count": 51,
|
|
|
"metadata": {
|
|
|
"slideshow": {
|
|
|
"slide_type": "slide"
|