Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SpikeEventSeries data type #92

Merged
merged 34 commits into from
Sep 11, 2024
Merged

Add SpikeEventSeries data type #92

merged 34 commits into from
Sep 11, 2024

Conversation

stephprince
Copy link
Collaborator

@stephprince stephprince commented Sep 9, 2024

These changes add the SpikeEventSeries data type for recording threshold crossings during data acquisition. In addition to adding the new data type, these changes check whether the ElectrodesTable already exists on the NWBFile. (Note: what I've written so far assumes that once the electrodes table has been created, all electrodes have been added. I think the ElectrodesTable / DynamicTable classes would require further changes if we want to append to an existing table).

I think some additional tests are needed to check that the code :

  • succeeds for different dimensions of the SpikeEventSeries ([nEvents x nSamples], [nEvents x nChannels x nSamples])
  • succeeds if user makes file with both spike event series + electrical series

@stephprince stephprince requested a review from oruebel September 9, 2024 23:41
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/hdf5/HDF5IO.hpp Outdated Show resolved Hide resolved
src/nwb/NWBFile.cpp Outdated Show resolved Hide resolved
src/nwb/NWBFile.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@oruebel oruebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good. The main question I have is how we can prevent duplication of 1) channels in the ElectrodeTable, 2) ElectrodeGroups , 3) Devices

@stephprince
Copy link
Collaborator Author

For duplication of channels in the ElectrodesTable, my first thought is to:

  1. In ElectrodeTable->addElectrodes(), add a check using the global index/rowIds to only add channels not yet included
  2. In ElectrodeTable->finalize(), if the columns already exist, use an addRow method to append additional channels, otherwise create the columns with all the data.

Thoughts on that approach?

std::string devicePath = "/general/devices/" + groupName;
std::string electrodePath = "/general/extracellular_ephys/" + groupName;
std::string electricalSeriesPath = rootPath + groupName;
std::string sourceName = channelVector[0].sourceName;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I realized when adding tests for a file that has both ElectricalSeries and SpikeEventSeries was that we needed to have a way to specify that data came from the same source (e.g. the same device) but had different names within the acquisition group. I added this sourceName as a separate input to the Channel class as a way to accommodate this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is sourceName the same as the name of the device?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now updated so that groupName is used for the ElectrodeGroup and Device and is pulled from the channelVector input. The name of the dataset within the acquisition group is set by a recordingArrayNames input to createElectricalSeries and createSpikeEventSeries.

@stephprince
Copy link
Collaborator Author

Added tests and now also have it integrated with OpenEphys - see here for the latest version of that branch.

@oruebel
Copy link
Contributor

oruebel commented Sep 10, 2024

For duplication of channels in the ElectrodesTable, my first thought is to:

1. In `ElectrodeTable->addElectrodes()`, add a check using the global index/rowIds to only add channels not yet included

2. In `ElectrodeTable->finalize()`, if the columns already exist, use an `addRow` method to append additional channels, otherwise create the columns with all the data.

Thoughts on that approach?

Seems reasonable. I think 2. assumes that there are no custom columns added to the table. We may want to at least check that we have data for all columns

@stephprince stephprince marked this pull request as ready for review September 11, 2024 18:31
@stephprince
Copy link
Collaborator Author

@oruebel this is ready for you to review again. I've created issues for what we want to address outside this PR

@stephprince
Copy link
Collaborator Author

Will fix #30

// Setup electrodes and devices
std::string groupName = channelVector[0].groupName;
std::string devicePath = "/general/devices/" + groupName;
std::string electrodePath = "/general/extracellular_ephys/" + groupName;
std::string electricalSeriesPath = rootPath + groupName;
std::string electricalSeriesPath = acquisitionPath + "/" + recordingName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now this seems fine. I assume this is part of #93 to address the groupName?

Copy link
Collaborator Author

@stephprince stephprince Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By address the groupName do you mean allowing different options for Device and ElectrodeGroup?

From what I had in my notes we also discussed having a single groupName for a channelVector. That would be part of #37

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@stephprince stephprince merged commit 3a12145 into main Sep 11, 2024
8 checks passed
@stephprince stephprince deleted the add-spike-event-series branch September 11, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants