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

Support arbitrary multi probe and multi trigger structures in spikeglx #1150

Merged
merged 13 commits into from
Dec 10, 2024

Conversation

h-mayorquin
Copy link
Collaborator

@h-mayorquin h-mayorquin commented Dec 4, 2024

This should fix #1149 and #978

@h-mayorquin h-mayorquin marked this pull request as ready for review December 5, 2024 14:43

data_interfaces = dict()
for stream in streams:
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 the critical part of this. Previously, the Converter assumed a fix structure of the files. This PR gets rids of that assumption.

es_key: Optional[str] = None,
verbose: bool = True,
file_path: Optional[FilePath] = None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would like to deprecate this but I don't want this discussion to get in the way of this PR. If people who review this agree we could start a soft deprecation as we usually do.

Reminder: Spiekinterface takes folder path as input (as in this PR) and not file_path as we currently do in main.

@@ -193,7 +194,7 @@ def test_electrode_table_writing(tmp_path):
np.testing.assert_array_equal(saved_channel_names, expected_channel_names_nidq)

# Test AP
electrical_series = nwbfile.acquisition["ElectricalSeriesAPImec0"]
electrical_series = nwbfile.acquisition["ElectricalSeriesAP"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously, the Converter always writes the ElectricalSeries using the name f"ElectricalSeriesAPImec{probe_index}" whereas the interface uses the name ElectricalSeriesAP only. This PR makes the behavior of the converter and the interface consistent in the single probe case hence the change.

"ElectricalSeriesAPImec0": {
"name": "ElectricalSeriesAPImec0",
"description": "Acquisition traces for the ElectricalSeriesAPImec0."
"ElectricalSeriesAP": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@h-mayorquin h-mayorquin changed the title Support multi probe and multi trigger structure in spikeglx Support arbitrary multi probe and multi trigger structures in spikeglx Dec 6, 2024
@h-mayorquin
Copy link
Collaborator Author

The failing test is unrelated to this and should be fixed by #1151

CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines 57 to 60
file_path: FilePath,
verbose: bool = True,
folder_path: Optional[DirectoryPath] = None,
stream_id: Optional[str] = None,
es_key: Optional[str] = None,
verbose: bool = True,
file_path: Optional[FilePath] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's preserve the order of the args so we do not cause a breaking change for ordered args

Comment on lines 40 to 41
folder_path: Optional[DirectoryPath] = None,
file_path: Optional[FilePath] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, let's keep file_path as the first arg for now

@bendichter bendichter self-requested a review December 9, 2024 16:24
Copy link
Contributor

@bendichter bendichter left a comment

Choose a reason for hiding this comment

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

minor fixes

self.folder_path = Path(file_path).parent

else:
self.stream_id = stream_id
Copy link
Contributor

Choose a reason for hiding this comment

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

could we check here to ensure that stream_id is one of the valid streams and give an error message with a list of valid streams if it is not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SpikeInterface already throws an error that is similar, example:

image

Does this work or would you like something more specific?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok great! Yeah that works

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Anything else missing to merge thigs?

@h-mayorquin h-mayorquin enabled auto-merge (squash) December 10, 2024 13:49
@h-mayorquin h-mayorquin merged commit 737468c into main Dec 10, 2024
40 checks passed
@h-mayorquin h-mayorquin deleted the equate_spikeglx_in_spikeinterface branch December 10, 2024 15:39
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.87%. Comparing base (96dfdff) to head (4d21be6).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...terfaces/ecephys/spikeglx/spikeglxnidqinterface.py 91.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1150      +/-   ##
==========================================
+ Coverage   90.69%   90.87%   +0.18%     
==========================================
  Files         129      129              
  Lines        8189     8209      +20     
==========================================
+ Hits         7427     7460      +33     
+ Misses        762      749      -13     
Flag Coverage Δ
unittests 90.87% <97.36%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...tainterfaces/ecephys/spikeglx/spikeglxconverter.py 100.00% <100.00%> (ø)
...terfaces/ecephys/spikeglx/spikeglxdatainterface.py 96.92% <100.00%> (+1.92%) ⬆️
...terfaces/ecephys/spikeglx/spikeglxnidqinterface.py 96.55% <91.66%> (-1.49%) ⬇️

... and 3 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpikeGLX converter should support arbitrary multi probe and multi trigger structure
2 participants