-
Notifications
You must be signed in to change notification settings - Fork 0
get mean neighboring channels #508
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| return NCC, shifts | ||
|
|
||
| def get_neighboring_channel_index(elec_pos, distance=0.75): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about having this function take "ch_idx" as an argument, and only return neighboring_idx[ch_idx], instead of the whole matrix?
i think it might be more useful that way?
probably it will be slower, so in get_mean_neighboring_channels() you might not use this function
| Args: | ||
| data (nch): neural data | ||
| elec_pos (nch, 2): x, y position of each channel | ||
| distance (float): define neighboring channels based on this distance. 0.75 is for 4 neighboring channels and 1.3 is for 9 channels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.75 and 1.3 only applies to ECoG244 array
|
|
||
| return neighboring_idx | ||
|
|
||
| def get_mean_neighboring_channels(data, elec_pos, distance=0.75): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't want to derail this function -- it's fine and you can push it -- but just a note for the future: we should really make a spatial smoothing function that takes an arbitrary 2d kernel and smooths the data that way, rather than only doing average and only limited to a radius
| data_test = np.arange(1,10) | ||
| m_data_test = aopy.analysis.get_mean_neighboring_channels(data_test, elec_pos_test, distance=1) | ||
| self.assertTrue(m_data_test[0] == np.sum(data_test[0]+data_test[1]+data_test[3])/3) | ||
| self.assertTrue(m_data_test[4] == np.sum(data_test[1]+data_test[3]+data_test[4]+data_test[5]+data_test[7])/5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be great to add a couple more lines to get a spatial map of the test data before and after smoothing and make a plot of before/after. then you could include the plot and the example code in the function docstring as well.
Average ECoG data across neighboring channels based on distance.