Browse Source

Frissítés "README.md"

Richárd Fiáth 3 years ago
parent
commit
c35b9b4174
1 changed files with 40 additions and 1 deletions
  1. 40 1
      README.md

+ 40 - 1
README.md

@@ -56,7 +56,46 @@ gin get-content
 More information and guides for the GIN Client are available [here](https://github.com/G-Node/gin-cli).
 For more ways of accessing the data, please refer to GIN's [FAQ](https://gin.g-node.org/G-Node/Info/wiki/FAQ+Troubleshooting#how-can-i-access-the-data).
 
-## 
+## Interacting with NWB files
+Users can import data from NWB files using the [PyNWB](https://github.com/NeurodataWithoutBorders/pynwb) and [MatNWB](https://github.com/NeurodataWithoutBorders/matnwb) APIs, or using [SpikeInterface](https://github.com/SpikeInterface). Loaded samples of the raw data have to be multiplied by a conversion number (0.195) to get the amplitudes in microvolts. Here we provide some examples how users can import data from NWB files using the MatNWB API.
+
+Loading a short segment (20.000 samples corresponding to 1 second of data) of the raw wideband recording on all (128) channels:
+```
+1.	nwb = nwbRead('Rat01_Insertion1_Depth1.nwb');
+2.	dataChunk=nwb.acquisition.get('wideband_multichannel_recording').data.load([1, 1], [128, 20000]);
+```
+It is important to note that TimeSeries data types in NWB files are stored with time in the first dimension and channels in the second, but dimensions are reversed in MatNWB.
+
+Loading and plotting the mean spike waveform of a specific single unit on the peak waveform channel:
+```
+3.	peakChannels = nwb.units.vectordata.get('peak_waveform_channel').data.load();
+4.	meanWaveforms = nwb.units.vectordata.get('mean_waveform_all_channels_filt').data.load();
+5.	mySingleUnit = 11;
+6.	singleUnitWaveform = meanWaveforms(peakChannels(mySingleUnit), :, mySingleUnit);
+7.	plot(singleUnitWaveform);
+```
+
+Loading the isolation distance quality metric of all units found in a single NWB file:
+```
+8.	IDvalues = nwb.units.vectordata.get('isolation_distance').data.load();
+```
+
+Spike times are stored in a special structure called ragged arrays15. We can load the spikes times of a specific single unit (in seconds) the following way:
+```
+9.	allSpikeTimes = nwb.units.spike_times.data.load();
+10.	spikeTimesIndex = nwb.units.spike_times_index.data.load();
+11.	spikesOfSingleUnit2 = allSpikeTimes(spikeTimesIndex(1)+1 : spikeTimesIndex(2));
+```
+
+Spikeinterface can also be used to load the wideband data and single unit properties:
+```
+1.	import spikeextractors as se
+2.	nwbPath = 'Rat01_Insertion1_Depth1.nwb'
+3.	recording = se.NwbRecordingExtractor(nwbPath)
+4.	sorting = se.NwbSortingExtractor(nwbPath)
+5.	mySingleUnit = 2
+6.	sorting.get_unit_property(mySingleUnit,'isolation_distance')
+```
 
 ## Related Publications
 * Fiáth, R., Raducanu, B. C., Musa, S., Andrei, A., Lopez, C. M., van Hoof, C., Ruther, P., Aarts, A., Horváth, D., Ulbert, I. (2018) A silicon-based neural probe with densely-packed low-impedance titanium nitride microelectrodes for ultrahigh-resolution in vivo recordings. Biosensors and Bioelectronics 106: 86-92. https://doi.org/10.1016/j.bios.2018.01.060