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

Detect mismatch errors between group and group names when writing ElectrodeGroups #1165

Merged

Conversation

h-mayorquin
Copy link
Collaborator

This should come after #1164 and has it as its base.

This should close #932 as we have now a function that decides the right priority between "group_name" and "group". This PR adds some errors for two different types of mismatch:

  1. The group_names have different number of unique entries than groups.
  2. The group_names and the groups are consistent across the array

@alejoe91 could you take a look?

@h-mayorquin h-mayorquin requested a review from alejoe91 December 18, 2024 22:58
@h-mayorquin h-mayorquin self-assigned this Dec 18, 2024
@h-mayorquin h-mayorquin changed the title add tests to detect mismatch errors and fix it Detect mismatch errors between group and group names when writing ElectrodeGroups Dec 18, 2024
@@ -259,6 +267,23 @@ def _get_group_name(recording: BaseRecording) -> np.ndarray:
# If for any reason the group names are empty, fill them with the default
group_names[group_names == ""] = default_value

# Validate group names against groups
if groups is not None:
unique_groups = np.unique(groups)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mmm I will change this to sets as I remember np.unique being buggy for strings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made the correction.

@h-mayorquin h-mayorquin marked this pull request as ready for review December 19, 2024 14:05
@h-mayorquin h-mayorquin marked this pull request as draft December 19, 2024 14:06
Base automatically changed from fix_electrode_groups_ephys to main December 19, 2024 15:52
"""
default_value = "ElectrodeGroup"
group_names = recording.get_property("group_name")
groups = recording.get_channel_groups()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this us never None, so L262 will never be reached

@h-mayorquin h-mayorquin marked this pull request as ready for review January 15, 2025 00:31
@h-mayorquin h-mayorquin enabled auto-merge (squash) January 15, 2025 01:48
@h-mayorquin h-mayorquin merged commit a66fd20 into main Jan 15, 2025
43 of 48 checks passed
@h-mayorquin h-mayorquin deleted the add_electrode_group_and_mismatch_test_on_spikeinterface branch January 15, 2025 02:13
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.12%. Comparing base (96dfdff) to head (00753b3).
Report is 17 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1165      +/-   ##
==========================================
- Coverage   90.69%   90.12%   -0.58%     
==========================================
  Files         129      129              
  Lines        8189     8300     +111     
==========================================
+ Hits         7427     7480      +53     
- Misses        762      820      +58     
Flag Coverage Δ
unittests 90.12% <100.00%> (-0.58%) ⬇️

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

Files with missing lines Coverage Δ
...c/neuroconv/tools/spikeinterface/spikeinterface.py 91.50% <100.00%> (+0.38%) ⬆️
src/neuroconv/tools/testing/mock_interfaces.py 94.40% <100.00%> (-4.75%) ⬇️

... and 16 files with indirect coverage changes

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.

Decide and test priority of group_name and group in /tools/spikeinterface/spikeinterface.py functions.
2 participants