Skip to content

Improve automatic local referencing#209

Merged
vinaysraghavan merged 10 commits intomainfrom
Improve-automatic-local-referencing
Jan 15, 2025
Merged

Improve automatic local referencing#209
vinaysraghavan merged 10 commits intomainfrom
Improve-automatic-local-referencing

Conversation

@vinaysraghavan
Copy link
Collaborator

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Change the make_contact_rereference_arr function to handle input channelnames in any order (not strictly ascending) and to properly handle local referencing on ECoG grid

Any other comments?

Change the make_contact_rereference_arr function to handle input channelnames in any order (not strictly ascending) and to properly handle local referencing on ECoG grid
Added input `grid_sizes` to allow custom input of grid sizes. After talking with Max Nentwich, I realized that, while square and 1 x 2 rectangle grids are relatively standard/common, grids are occasionally cut, so custom shapes as input is needed.
@codecov
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 22.64151% with 41 lines in your changes missing coverage. Please review.

Project coverage is 74.03%. Comparing base (2f853cf) to head (8be3445).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
naplib/preprocessing/rereference.py 22.64% 41 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
- Coverage   74.62%   74.03%   -0.60%     
==========================================
  Files          58       58              
  Lines        4233     4287      +54     
==========================================
+ Hits         3159     3174      +15     
- Misses       1074     1113      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gavinmischler gavinmischler left a comment

Choose a reason for hiding this comment

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

Just a couple small things, then looks good!

Remove debugging print statement
Copy link
Collaborator

@gavinmischler gavinmischler left a comment

Choose a reason for hiding this comment

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

Looks good!

Removed the assumption that channels 1-N are always provided for a given contact. Now, any channel numbers on a contact can be provided, and local average referencing will be robust to this. 

This is useful in cases where depth electrodes are inserted through the brain, e.g. some electrodes are in the CSF beyond the brain, some electrodes are in the brain, and some are in the skull/scalp, since only electrodes in the brain should be used for re-referencing.

It now also notifies the user if channels cannot properly be re-referenced because `extent` is too small due to a lack of spatially local sites.
@vinaysraghavan vinaysraghavan merged commit 9268737 into main Jan 15, 2025
4 checks passed
@vinaysraghavan vinaysraghavan deleted the Improve-automatic-local-referencing branch January 15, 2025 15:57
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