|
| 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 |
0 commit comments