Skip to content

Commit 7a4fba9

Browse files
authored
Merge pull request #44 from bendichter/convert_to_nwb
Convert to nwb
2 parents 14517a2 + 9ee6088 commit 7a4fba9

File tree

7 files changed

+695
-1
lines changed

7 files changed

+695
-1
lines changed

element_array_ephys/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
# ephys_acute as default
12
import element_array_ephys.ephys_acute as ephys

element_array_ephys/ephys_acute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ def make(self, key):
301301
shank, shank_col, shank_row, _ = spikeglx_recording.apmeta.shankmap['data'][recorded_site]
302302
electrode_keys.append(probe_electrodes[(shank, shank_col, shank_row)])
303303
elif acq_software == 'Open Ephys':
304-
305304
session_dir = find_full_path(get_ephys_root_data_dir(),
306305
get_session_directory(key))
307306

element_array_ephys/export/__init__.py

Whitespace-only changes.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Exporting data to NWB
2+
3+
The `export/nwb/nwb.py` module maps from the element-array-ephys data structure to NWB.
4+
The main function is `ecephys_session_to_nwb`, which contains flags to control calling the following functions,
5+
which can be called independently:
6+
7+
1. `session.export.nwb.session_to_nwb`: Gathers session-level metadata
8+
9+
10+
2. `add_electrodes_to_nwb`: Add electrodes table to NWBFile. This is needed for any ElectricalSeries, including
11+
raw source data and LFP.
12+
13+
14+
ephys.InsertionLocation -> ElectrodeGroup.location
15+
16+
probe.Probe::probe -> device.name
17+
probe.Probe::probe_comment -> device.description
18+
probe.Probe::probe_type -> device.manufacturer
19+
20+
probe.ProbeType.Electrode::electrode -> electrodes["id_in_probe"]
21+
probe.ProbeType.Electrode::y_coord -> electrodes["rel_y"]
22+
probe.ProbeType.Electrode::x_coord -> electrodes["rel_x"]
23+
probe.ProbeType.Electrode::shank -> electrodes["shank"]
24+
probe.ProbeType.Electrode::shank_col -> electrodes["shank_col"]
25+
probe.ProbeType.Electrode::shank_row -> electrodes["shank_row"]
26+
27+
3. `add_ephys_recording_to_nwb`: Read voltage data directly from source files and iteratively transfer them to the
28+
NWB file. Automatically applies lossless compression to the data, so the final file might be smaller than the original, but there is no
29+
data loss. Currently supports Neuropixels data acquired with SpikeGLX or Open Ephys, and relies on SpikeInterface to read the data.
30+
31+
32+
source data -> acquisition["ElectricalSeries"]
33+
34+
4. `add_ephys_units_to_nwb`: Add spiking data from CuratedClustering to NWBFile.
35+
36+
37+
ephys.CuratedClustering.Unit::unit -> units.id
38+
ephys.CuratedClustering.Unit::spike_times -> units["spike_times"]
39+
ephys.CuratedClustering.Unit::spike_depths -> units["spike_depths"]
40+
ephys.CuratedClustering.Unit::cluster_quality_label -> units["cluster_quality_label"]
41+
42+
ephys.WaveformSet.PeakWaveform::peak_electrode_waveform -> units["waveform_mean"]
43+
44+
5. `add_ephys_lfp_from_dj_to_nwb`: Read LFP data from the data in element-array-ephys and convert to NWB.
45+
46+
47+
ephys.LFP.Electrode::lfp -> processing["ecephys"].lfp.electrical_series["ElectricalSeries{insertion_number}"].data
48+
ephys.LFP::lfp_time_stamps -> processing["ecephys"].lfp.electrical_series["ElectricalSeries{insertion_number}"].timestamps
49+
50+
6. `add_ephys_lfp_from_source_to_nwb`: Read the LFP data directly from the source file. Currently, only works for
51+
SpikeGLX data. Can be used instead of `add_ephys_lfp_from_dj_to_nwb`.
52+
53+
54+
source data -> processing["ecephys"].lfp.electrical_series["ElectricalSeries{insertion_number}"].data
55+
source data -> processing["ecephys"].lfp.electrical_series["ElectricalSeries{insertion_number}"].timestamps
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .nwb import ecephys_session_to_nwb, write_nwb

0 commit comments

Comments
 (0)