|
@@ -10,75 +10,59 @@ The repository contains the P-unit data sets. They are provided in the nixio for
|
|
|
## Example code to load the data of a cell:
|
|
|
|
|
|
|
|
|
+-import the nixo package
|
|
|
```
|
|
|
-import the nixo pacakge
|
|
|
-
|
|
|
import nixio as nix
|
|
|
-
|
|
|
from matplotlib import pyplot as plt
|
|
|
-
|
|
|
import numpy as np
|
|
|
```
|
|
|
|
|
|
-#- load cell, (works if you are in the cell folder)
|
|
|
+- load cell, (works if you are in the cell folder)
|
|
|
+```
|
|
|
file = nix.File.open('2019-05-07-aq-invivo-1.nix', nix.FileMode.ReadOnly)
|
|
|
b = file.blocks[0]
|
|
|
-
|
|
|
+```
|
|
|
|
|
|
- choice of a beat multi_tag
|
|
|
-
|
|
|
```
|
|
|
mt_nr = 1
|
|
|
-
|
|
|
mt = b.multi_tags[mt_nr]
|
|
|
```
|
|
|
|
|
|
- load the array of interes: hier the EOD of the fish and the spike times
|
|
|
```
|
|
|
EOD = b.data_arrays['LocalEOD-1']
|
|
|
-
|
|
|
spikes_all = b.data_arrays['Spikes-1']
|
|
|
-
|
|
|
voltage = b.data_arrays['V-1']
|
|
|
```
|
|
|
|
|
|
- slice the whole dataarray at with the bignning and the extend of the multitag
|
|
|
-
|
|
|
```
|
|
|
eod = EOD.get_slice([mt.positions[:][mt_nr]], [mt.extents[:][mt_nr]], nix.DataSliceMode.Data)[:]
|
|
|
-
|
|
|
spikes = spikes_all.get_slice([mt.positions[:][mt_nr]], [mt.extents[:][mt_nr]], nix.DataSliceMode.Data)[:] - mt.positions[:][mt_nr]
|
|
|
-
|
|
|
volt = voltage.get_slice([mt.positions[:][mt_nr]], [mt.extents[:][mt_nr]], nix.DataSliceMode.Data)[:]
|
|
|
```
|
|
|
|
|
|
- get the sampling
|
|
|
-
|
|
|
-`sampling = len(EOD.get_slice([0], [0.1], nix.DataSliceMode.Data)[:]) * 10`
|
|
|
+```
|
|
|
+sampling = len(EOD.get_slice([0], [0.1], nix.DataSliceMode.Data)[:]) * 10
|
|
|
+```
|
|
|
|
|
|
- get the time array
|
|
|
-
|
|
|
-`time_array = np.arange(0, mt.extents[:][mt_nr], 1 / sampling)`
|
|
|
+```
|
|
|
+time_array = np.arange(0, mt.extents[:][mt_nr], 1 / sampling)
|
|
|
+```
|
|
|
|
|
|
- example plot of a beat and the P-unit response
|
|
|
-
|
|
|
```
|
|
|
fig, ax = plt.subplots(2, 1, sharex = True)
|
|
|
-
|
|
|
ax[0].set_ylabel('mV')
|
|
|
-
|
|
|
ax[0].plot(time_array, eod)
|
|
|
-
|
|
|
ax[1].plot(time_array, volt)
|
|
|
-
|
|
|
ax[1].set_ylabel('mV')
|
|
|
-
|
|
|
ax[1].set_xlabel('Time [s]')
|
|
|
-
|
|
|
ax[1].set_xlim(0,0.1)
|
|
|
-
|
|
|
ax[1].scatter(spikes, np.ones(len(spikes))*np.max(volt))
|
|
|
-
|
|
|
plt.show()
|
|
|
```
|
|
|
|